Red-Green Towers

题意翻译

**题目描述** 你有 $r$ 块红色的积木和 $g$ 块绿色的积木,它们用于建造红绿塔。红绿塔按照下面的规则来建造: - 红绿塔有若干层; - 如果红绿塔有 $n$ 层,那么塔的第一层应该有 $n$ 块积木,第二层有 $n-1$ 块,第三层有 $n-2$ 块,以此类推,最后一层只有一块。换言之,每一层应该比前面一层少一块; - 红绿塔的每一层必须使用相同颜色的积木。 令 $h$ 表示用 $r$ 个红积木和 $g$ 个绿积木所能搭建的满足上述规则的塔的最大层数。现在你的任务是确定可以建造出多少不同的有 $h$ 层的红绿塔。 如果两个红绿塔相同的一层使用的是不同的颜色,它们就被认为不同的。 你需要写一个程序来求出有多少种高度为 $h$ 的不同的红绿塔。由于答案很大,你只需要输出答案模 $10^9+7$(也就是$1000000007$)后的值。 **输入格式:** 输入仅有一行,用空格隔开的两个数 $r$ 和 $g$,表示可用的红色、绿色积木的数量 **输出格式:** 输出仅一行,高度为 $h$ 的不同红绿塔的个数模 $10^9+7$ 的值 **数据规模** $0\le r,g\le 2\times 10^5$, $r+g\ge 1$ **其他提示** 题目描述中的图片解释了第一个样例数据中的两种建造方式

题目描述

There are $ r $ red and $ g $ green blocks for construction of the red-green tower. Red-green tower can be built following next rules: - Red-green tower is consisting of some number of levels; - Let the red-green tower consist of $ n $ levels, then the first level of this tower should consist of $ n $ blocks, second level — of $ n-1 $ blocks, the third one — of $ n-2 $ blocks, and so on — the last level of such tower should consist of the one block. In other words, each successive level should contain one block less than the previous one; - Each level of the red-green tower should contain blocks of the same color. ![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF478D/b14f84ada3066f1060f8ffbea88b7c393a3362c6.png)Let $ h $ be the maximum possible number of levels of red-green tower, that can be built out of $ r $ red and $ g $ green blocks meeting the rules above. The task is to determine how many different red-green towers having $ h $ levels can be built out of the available blocks. Two red-green towers are considered different if there exists some level, that consists of red blocks in the one tower and consists of green blocks in the other tower. You are to write a program that will find the number of different red-green towers of height $ h $ modulo $ 10^{9}+7 $ .

输入输出格式

输入格式


The only line of input contains two integers $ r $ and $ g $ , separated by a single space — the number of available red and green blocks respectively ( $ 0<=r,g<=2·10^{5} $ , $ r+g>=1 $ ).

输出格式


Output the only integer — the number of different possible red-green towers of height $ h $ modulo $ 10^{9}+7 $ .

输入输出样例

输入样例 #1

4 6

输出样例 #1

2

输入样例 #2

9 7

输出样例 #2

6

输入样例 #3

1 1

输出样例 #3

2

说明

The image in the problem statement shows all possible red-green towers for the first sample.