AlgoUniversity
  • Go Back
Discussion
Red Green Towers :

Author

Ayush Gangwani

Difficulty Level : Medium

Submissions : 609

Asked In : Uber

Marks :15

: 10 | : 2

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.

The task is to determine how many different red-green towers 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.

Input

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 \le r, g \le 2 \cdot 10^5, r + g \ge 1)$$$.

Output

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

Examples

Input
4 6
Output
14 
Input
9 7
Output
32 
Input
1 1
Output
2 

You need to login to view your submissions.

You need to login to view all submissions.

Loading...

Result : Executed

Loading...

Feel something is wrong with the test cases?

Result : Accepted

Test Cases :

You need to Log In
We're glad that you want to attempt this problem!

But to Run or Submit the Problem, you need to Log In.

Continue to Log In
Challenge Submitted!

Your challenge has been submitted successfully.

You will get a response soon via WhatsApp or Email.

Challenge
Facing issue while trying to solve the problem! Don't worry, we got you covered!

Do let us know your issue.

Looks good!
Please enter your issue / feedback.

How do we get in touch with you?
Looks good!
Please enter your phone no.
Looks good!
Please enter your email address.