PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN

#QHD0000027. Đội quân Caesar (Caesars Legions)

HỌC THEO LỘ TRÌNH

Bài tập thuộc lộ trình

1 lộ trình

Đội quân Caesar (Caesars Legions)

Caesars Legions

Source: Codeforces

Version: Phuoc Hung OJ Extended

Problem Statement

Caesar has n1n_1 foot soldiers and n2n_2 horse soldiers. Soldiers of the same type are indistinguishable, and all soldiers must be placed in one row.

A valid formation contains no more than k1k_1 consecutive foot soldiers and no more than k2k_2 consecutive horse soldiers. Every soldier must be included exactly once.

Count all distinct valid formations modulo 10810^8.

Input

One line contains the integers n1n_1, n2n_2, k1k_1, and k2k_2.

Output

Print the number of valid formations modulo 10810^8.

Subtasks

  • Subtask 1 (20 points): 1≤n1≤81\le n_1\le 8; 1≤n2≤1001\le n_2\le 100; 1≤k1≤101\le k_1\le 10; 1≤k2≤101\le k_2\le 10.
  • Subtask 2 (30 points): 1≤n1≤301\le n_1\le 30; 1≤n2≤1001\le n_2\le 100; 1≤k1≤101\le k_1\le 10; 1≤k2≤101\le k_2\le 10.
  • Subtask 3 (50 points): 1≤n1≤1001\le n_1\le 100; 1≤n2≤1001\le n_2\le 100; 1≤k1≤101\le k_1\le 10; 1≤k2≤101\le k_2\le 10.

Examples

Input

2 1 1 2

Output

1

Explanation

We have two foot soldiers and one horse soldier. Because k1=1k_1=1, the two foot soldiers cannot be adjacent. The only valid arrangement is foot–horse–foot, and it also satisfies k2=2k_2=2. Thus the answer is 11.