Codeforces Beta Round 89 (Div. 2)
D
Caesar's Legions
Codeforces
1700
原题
← CE →
翻译中…

Gaius Julius Caesar, a famous general, loved to line up his soldiers. Overall the army had $*n*_{1}$ footmen and $*n*_{2}$ horsemen. Caesar thought that an arrangement is not beautiful if somewhere in the line there are strictly more that $*k*_{1}$ footmen standing successively one after another, or there are strictly more than $*k*_{2}$ horsemen standing successively one after another. Find the number of beautiful arrangements of the soldiers.

翻译中…

Note that all $*n*_{1} + *n*_{2}$ warriors should be present at each arrangement. All footmen are considered indistinguishable among themselves. Similarly, all horsemen are considered indistinguishable among themselves.

翻译中…

Input

翻译中…

The only line contains four space-separated integers $*n*_{1}$, $*n*_{2}$, $*k*_{1}$, $*k*_{2}$ ($1 ≤ *n*_{1}, *n*_{2} ≤ 100, 1 ≤ *k*_{1}, *k*_{2} ≤ 10$) which represent how many footmen and horsemen there are and the largest acceptable number of footmen and horsemen standing in succession, correspondingly.

翻译中…

Output

翻译中…

Print the number of beautiful arrangements of the army modulo $100000000$ $(10^{8})$. That is, print the number of such ways to line up the soldiers, that no more than $*k*_{1}$ footmen stand successively, and no more than $*k*_{2}$ horsemen stand successively.

翻译中…

Note

翻译中…

Let's mark a footman as 1, and a horseman as 2.

翻译中…

In the first sample the only beautiful line-up is: 121

翻译中…

In the second sample 5 beautiful line-ups exist: 12122, 12212, 21212, 21221, 22121

翻译中…

样例

Input #1
2 1 1 10
Output #1
1
InputCopy OutputCopy
Input #2
2 3 1 2
Output #2
5
InputCopy OutputCopy
Input #3
2 4 1 1
Output #3
0
InputCopy OutputCopy
题目信息
题号
118D
时间限制
2 s
内存限制
256 MB
标签
动态规划

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。