Problem: 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.

<image>

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 109 + 7.

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 ≤ r, g ≤ 2·105, r + g ≥ 1).

Output

Output the only integer — the number of different possible red-green towers of height h modulo 109 + 7.

Examples

Input

4 6


Output

2


Input

9 7


Output

6


Input

1 1


Output

2

Note

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

Solution (in JAVA):

Solution:

import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintStream;
import java.io.PrintWriter;
import java.util.HashMap;
import java.util.Map;
import java.util.StringTokenizer;

/*
public class _478D {

}

 */

class node2
{
	int r;
	//int g;
	int h;

	@Override
	public String toString() {
		return "node [r=" + r + ", h=" + h + "]";
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + r;
		result = prime * result + h;
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		node2 other = (node2) obj;
		if (r != other.r || h != other.h)
			return false;
		return true;
	}
}

public class _478D {
	private static PrintWriter printWriter;

	Map<node2, Integer> nh = new HashMap<node2, Integer>();

	int[][] dp = new int[200001][2];

	int mod = 1000000007;
	int ir = 0, ig = 0, ih = 0, ub = 0;

	public void solve() throws FileNotFoundException {
		InputStream inputStream = System.in;

		InputHelper inputHelper = new InputHelper(inputStream);

		PrintStream out = System.out;

		//actual solution

		int r = inputHelper.readInteger();
		int g = inputHelper.readInteger();

		int h;

		for(h = 1; ; h++)
		{
			if(((h * (h + 1)) / 2) > r + g)
				break;
		}

		h--;

		ub = ((h * (h + 1)) / 2);

		ir = r;
		ig = g;
		ih = h;

		System.out.println(bu());
		//end here

		//printWriter.close();
	}

	private long bu()
	{
		for(int r = 0; r <= ir; r++)
		{
			int u = ub - 1;

			int g = ig - (u - (ir - r));

			if(r >= 1 && g >= 1)
				dp[r][0] = 2;
			else if(r >= 1 || g >= 1)
				dp[r][0] = 1;
			else
				dp[r][0] = 0;
		}

		for(int h = 2; h <= ih; h++)
		{
			int u = ub - ((h * (h + 1)) / 2);
			
			int x = ig - u + ir;
			
			for(int r = 0; r <= ir; r++)
			{
				int g = x - r;
				// ig - u + ir - r
				
				if(r >= h)
					dp[r][1] = dp[r - h][0];
				if(g >= h)
					dp[r][1] += dp[r][0];
				
				if(dp[r][1] >= mod)
				{
					dp[r][1] -= mod;
				}
			}
			
			for(int r = 0; r <= ir; r++)
			{
				dp[r][0] = dp[r][1];
				dp[r][1] = 0;
			}
		}
		
		return dp[ir][0];
	}

	private long rec(int r, int h) 
	{
		if(h < 1)
			return 0;

		int u = (ub - ((h * (h + 1)) / 2));

		int g = ig - (u - (ir - r));

		if(r < h && g < h)
			return 0;

		node2 inode = new node2();

		inode.r = r;
		inode.h = h;

		if(nh.containsKey(inode))
		{
			//System.out.println("Yes");
			return nh.get(inode);
		}

		/*if(dp[r][h] != 0)
		{
			return dp[r][h];
		}*/
		long ans = 0;

		if(h == 1)
		{
			if(r >= 1 && g >= 1)
				ans = 2;
			else
				ans = 1;

			//System.out.println(inode);
			nh.put(inode, (int)ans);

			dp[r][h] = 1;//(int)ans;
			return ans;
		}

		if(r >= h)
		{
			long ans1 = rec(r - h, h - 1);

			ans += ans1;
			ans %= mod;
		}
		if(g >= h)
		{
			long ans2 = rec(r, h - 1);

			ans += ans2;
			ans %= mod;
		}

		//System.out.println(inode);
		nh.put(inode, (int)ans);
		dp[r][h] = 1;//(int)ans;
		return ans;
	}

	public static void main(String[] args) throws FileNotFoundException {
		(new _478D()).solve();
	}

	class InputHelper {
		StringTokenizer tokenizer = null;
		private BufferedReader bufferedReader;

		public InputHelper(InputStream inputStream) {
			InputStreamReader inputStreamReader = new InputStreamReader(
					inputStream);
			bufferedReader = new BufferedReader(inputStreamReader, 16384);
		}

		public String read() {
			while (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					String line = bufferedReader.readLine();
					if (line == null) {
						return null;
					}
					tokenizer = new StringTokenizer(line);
				} catch (IOException e) {
					e.printStackTrace();
				}
			}

			return tokenizer.nextToken();
		}

		public Integer readInteger() {
			return Integer.parseInt(read());
		}

		public Long readLong() {
			return Long.parseLong(read());
		}
	}
}