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 11:29:46.069232 */#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<cctype>
#include<algorithm>

using namespace std;

typedef long long LL;

const int Mo = 1000000007;

const int MaxN = 2000 + 5, MaxM = 2000 + 5;

int N, M;
int f[MaxN][MaxM], f1[MaxN][MaxM], f2[MaxN][MaxM], ff2[MaxN][MaxM];
int sum[MaxN][MaxM], sum2[MaxN][MaxM];
int g[MaxN];

int main() {

    scanf("%d%d", &N, &M); 
    sum[1][1] = 0;
    sum2[1][1] = 0;
    for (int j = 2; j <= M; ++j) {
        f[1][j] = 1;
        sum[1][j] = ((LL)sum[1][j - 1] + f[1][j]) % Mo;
        sum2[1][j] = ((LL)sum2[1][j - 1] + (LL)f[1][j] * j % Mo) % Mo;
    }
    for (int i = 2; i <= N; ++i) {
        sum[i][1] = 0;
        sum2[i][1] = 0;
        for (int j = 2; j <= M; ++j) {
            f[i][j] = ((LL)sum[i - 1][j - 1] * (j + 1) - (LL)sum2[i - 1][j - 1]) % Mo;
            sum[i][j] = ((LL)sum[i][j - 1] + f[i][j]) % Mo;
            sum2[i][j] = ((LL)sum2[i][j - 1] + (LL)f[i][j] * j % Mo) % Mo;
        }
    }

    for (int j = 2; j <= M; ++j) {
        f1[0][j] = 0;
        for (int i = 1; i <= N; ++i) {
            f1[i][j] = ((LL)f1[i - 1][j] + f[i][j]) % Mo;
        }
    }

    sum[1][1] = 0;
    sum2[1][1] = 0;
    for (int j = 2; j <= M; ++j) {
        f[1][j] = 1;
        sum[1][j] = ((LL)sum[1][j - 1] + f[1][j]) % Mo;
        sum2[1][j] = ((LL)sum2[1][j - 1] + (LL)f[1][j] * j % Mo) % Mo;
    }
    for (int i = 2; i <= N; ++i) {
        sum[i][1] = 0;
        sum2[i][1] = 0;
        for (int j = 2; j <= M; ++j) {
            f[i][j] = ((LL)sum[i - 1][j] * (j + 1) - (LL)sum2[i - 1][j]) % Mo;
            sum[i][j] = ((LL)sum[i][j - 1] + f[i][j]) % Mo;
            sum2[i][j] = ((LL)sum2[i][j - 1] + (LL)f[i][j] * j % Mo) % Mo;
        }
    }
    for (int j = 2; j <= M; ++j) {
        f2[0][j] = 0;
        for (int i = 1; i <= N; ++i) {
            f2[i][j] = ((LL)f2[i - 1][j] + f[i][j]) % Mo;
        }
    }

    memset(ff2, 0, sizeof(ff2));
    for (int i = 1; i <= N; ++i)
        for (int len = 2; len <= M; ++len) {
            ff2[i][len] = ff2[i][len - 1] + f2[i][len];
        }

    int ans = 0;
    for (int k = 1; k <= N; ++k)
        for (int len = 2; len <= M; ++len) {
            int delta = (LL)f2[k][len] * ff2[N - k][len - 1] % Mo * (M - len + 1) % Mo;
            ans = ((LL)delta + ans) % Mo;
            ans = ((LL)ans + (LL)ff2[k][len] * (M - len + 1) % Mo) % Mo;
        }
    cout << (ans % Mo + Mo) % Mo << endl;
    
    return 0;

}
