Թաքցված խնդիր
|Այս խնդիրը թաքցված է խմբագրական խրհրդի անդամի կողմից քանի որ կամ այն ոչ ճիշտ լեզվով է գրված,|կամ թեստային տվյալներն են սխալ, կամ խնդրի ձևակերպումը պարզ չէ։|

ACM_0140 - GUESS NUMBER

   My tech-lover son has been attracted by the exciting game “Guess Number”. In this game, the player must find a hidden positive integer number by at most T guesses (or turns). The parameter T together with a health parameter H is determined at the beginning of the game. In each turn, the player must enter a number. If the number is equal to the hidden number, he wins provided that H ≥ 0. If the number is bigger than the hidden number, H is decreased by 1 unit of health. Otherwise, H remains unchanged. When H becomes negative or T reaches 0, the player definitely loses. The player can see the remaining turns and units of health after each turn. Although the game seems to be constructive, but something makes me suspicious! my son always wins. He claims he has a searching algorithm to find the hidden number but I can’t believe him as for the given H and T there must be a big number which is not guessable by any searching algorithm. To prove my son claim is wrong, I kindly ask you to help me find the smallest M for which at least a number from 1 through M as the hidden number can’t be guessed for the given T and H. For example, there is not any algorithm for finding all positive integers not greater than M = 3 by 2 turns and 0 units of health.

Input

   There are multiple test cases. Each test case consists of one line containing two non-negative integers T and H (0 ≤ T, H ≤ 100). The input terminates with “0 0” which should not be processed.

Output

   For each test case output M described above in one line. As M maybe too large, output it modulo 109+7.

Examples

stdin

stdout

1

3 0

3 1

0 0

4

7


Ավելացրեց.Հրանտ Հովհաննիսյան
Ամսաթիվ.2014-02-09
Ժամանակի սահմանափակումը.1s
Ծրագրի տեքստի սահմանափակումը.50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Լեզուներ.Բոլորը բացի ASM32 ASM64 GAWK CLPS CLOJURE D ERL FSHARP FORTRAN GOSU HASK ICON ICK NEM NIM OBJC-CLANG PICO PIKE PYPY PYPY3 PY_NBC RUST SCM guile CHICKEN SED TCL WHITESPACE
Աղբյուրը.Iran Internet 2013.F

© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.