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
#include <bits/stdc++.h>
const int MAX_SIZE = 2000;
const int MOD = 1000000000 + 7;
int h, w;
int f[MAX_SIZE + 10][MAX_SIZE + 10];
int fsum[MAX_SIZE + 10][MAX_SIZE + 10][4];
int main() {
  scanf("%d%d", &h, &w);
  if (w < 2) {
    printf("0\n");
    return 0;
  }
  w -= 2;
  for (int i = 0; i <= w; i++) f[1][i] = 1;
  for (int i = 2; i <= h; i++) {
    int sum1 = 0, sum2 = 0;
    for (int j = 0; j <= w; j++) {
      {
        (sum1) += (f[i - 1][j]);
        if ((sum1) >= MOD) (sum1) -= MOD;
      };
      {
        (sum2) += ((int)((long long)f[i - 1][j] * j % MOD));
        if ((sum2) >= MOD) (sum2) -= MOD;
      };
      f[i][j] = (int)((long long)sum1 * (j + 1) % MOD);
      {
        (f[i][j]) -= (sum2);
        if ((f[i][j]) < 0) (f[i][j]) += MOD;
      };
    }
  }
  for (int i = 1; i <= h; i++) {
    for (int j = 0; j <= w; j++) {
      int& v = f[i][j];
      {
        (fsum[i][j][0]) += (v);
        if ((fsum[i][j][0]) >= MOD) (fsum[i][j][0]) -= MOD;
      };
      {
        (fsum[i][j][1]) += ((int)((long long)v * i % MOD));
        if ((fsum[i][j][1]) >= MOD) (fsum[i][j][1]) -= MOD;
      };
      {
        (fsum[i][j][2]) += ((int)((long long)v * j % MOD));
        if ((fsum[i][j][2]) >= MOD) (fsum[i][j][2]) -= MOD;
      };
      {
        (fsum[i][j][3]) += ((int)((long long)v * i * j % MOD));
        if ((fsum[i][j][3]) >= MOD) (fsum[i][j][3]) -= MOD;
      };
      for (register int k = 0; k < 4; k++) {
        int& t = fsum[i][j][k];
        {
          (t) += (fsum[i - 1][j][k]);
          if ((t) >= MOD) (t) -= MOD;
        };
        if (j > 0) {
          {
            (t) += (fsum[i][j - 1][k]);
            if ((t) >= MOD) (t) -= MOD;
          };
          {
            (t) -= (fsum[i - 1][j - 1][k]);
            if ((t) < 0) (t) += MOD;
          };
        }
      }
    }
  }
  int ans = 0;
  for (int i = 1; i <= h; i++) {
    for (int j = 0; j <= w; j++) {
      {
        (ans) += ((int)((long long)f[i][j] * (h - i + 1) * (w - j + 1) % MOD));
        if ((ans) >= MOD) (ans) -= MOD;
      };
      if (j > 0) {
        int t = 0;
        {
          (t) += ((int)((long long)(h - i + 1) * (j + 1) *
                        fsum[h - i][j - 1][0] % MOD));
          if ((t) >= MOD) (t) -= MOD;
        };
        {
          (t) -= ((int)((long long)(h - i + 1) * fsum[h - i][j - 1][2] % MOD));
          if ((t) < 0) (t) += MOD;
        };
        {
          (t) -= ((int)((long long)(j + 1) * fsum[h - i][j - 1][1] % MOD));
          if ((t) < 0) (t) += MOD;
        };
        {
          (t) += (fsum[h - i][j - 1][3]);
          if ((t) >= MOD) (t) -= MOD;
        };
        {
          (ans) += ((int)((long long)t * f[i][j] % MOD * (w - j + 1) % MOD));
          if ((ans) >= MOD) (ans) -= MOD;
        };
      }
    }
  }
  printf("%d\n", ans);
  return 0;
}
