Greg has a pad. The pad's screen is an n × m rectangle, each cell can be either black or white. We'll consider the pad rows to be numbered with integers from 1 to n from top to bottom. Similarly, the pad's columns are numbered with integers from 1 to m from left to right.

Greg thinks that the pad's screen displays a cave if the following conditions hold:

  * There is a segment [l, r] (1 ≤ l ≤ r ≤ n), such that each of the rows l, l + 1, ..., r has exactly two black cells and all other rows have only white cells. 
  * There is a row number t (l ≤ t ≤ r), such that for all pairs of rows with numbers i and j (l ≤ i ≤ j ≤ t) the set of columns between the black cells in row i (with the columns where is these black cells) is the subset of the set of columns between the black cells in row j (with the columns where is these black cells). Similarly, for all pairs of rows with numbers i and j (t ≤ i ≤ j ≤ r) the set of columns between the black cells in row j (with the columns where is these black cells) is the subset of the set of columns between the black cells in row i (with the columns where is these black cells). 



Greg wondered, how many ways there are to paint a cave on his pad. Two ways can be considered distinct if there is a cell that has distinct colors on the two pictures.

Help Greg.

Input

The first line contains two integers n, m — the pad's screen size (1 ≤ n, m ≤ 2000).

Output

In the single line print the remainder after dividing the answer to the problem by 1000000007 (109 + 7).

Examples

Input

1 1


Output

0


Input

4 4


Output

485


Input

3 5


Output

451
/* 2013-07-26 10:15:58.449795 */#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <cmath>
#include <iostream>
#include <algorithm>
#define p 1000000007

using namespace std;

int n, m;
long long f[2001][2001][2], v[2001][2001][2], t[2001][2001][2], w[2001][2001][2];

int main(){
	//freopen("d.in", "r", stdin);
	scanf("%d%d", &n, &m);
	memset(f, 0, sizeof(f));
	for (int i = 0; i <= m - 2; i++) f[1][i][0] = 1;
	memset(t, 0, sizeof(t));
	memset(w, 0, sizeof(w));
	for (int i = 0; i <= m - 2; i++) t[1][i][0] = i + 1,
									 w[1][i][0] = (i + 2) * (i + 1) / 2;
	for (int i = 2; i <= n; i++)
	{
       for (int j = 0; j <= m - 2; j++)
       {
       	   if (j > 0) f[i][j][0] = (w[i - 1][j - 1][0] + t[i - 1][j - 1][0] + t[i - 1][j - 1][1] + w[i - 1][j - 1][1]) % p;
           f[i][j][1] += f[i - 1][j][0]; f[i][j][1] %= p;
           f[i][j][1] += f[i - 1][j][1]; f[i][j][1] %= p;
       }
       t[i][0][0] = f[i][0][0];
       t[i][0][1] = f[i][0][1];
       for (int j = 1; j <= m - 2; j++) t[i][j][0] = (t[i][j - 1][0] + f[i][j][0] ) % p, t[i][j][1] = (t[i][j - 1][1] + f[i][j][1] ) % p;
       w[i][0][0] = f[i][0][0];
       w[i][0][1] = f[i][0][1];
       for (int j = 1; j <= m - 2; j++) w[i][j][0] = (w[i][j - 1][0] + t[i][j][0] ) % p, w[i][j][1] = (w[i][j - 1][1] + t[i][j][1] ) % p;
    }
    memset(v, 0, sizeof(v));
    for (int i = 1; i <= n; i++)
        for (int j = 0; j <= m - 2; j++)
            v[i][j][0] = v[i - 1][j][0] + f[i][j][0], v[i][j][0] %= p,
            v[i][j][1] = v[i - 1][j][1] + f[i][j][1], v[i][j][1] %= p;
    int ans = 0;
    for (int i = 1; i <= n; i++)
       for (int j = 0; j <= m - 2; j++)
       {
			int up = i, down = n - i + 1;
			long long value = 1;
			long long now1 = v[up][j][0], now2 = (v[down][j][0] + v[down][j][1]) % p;
			value = m - 2 - j + 1;
			value *= now1; value %= p;
			value *= now2; value %= p;
			ans += value; ans %= p;
	   }
	printf("%d\n", ans);
}