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>
using namespace std;
const int MAXN = (1 << 11);
const int mod = (int)1e9 + 7;
const long double PI = acos(-1);
int rev(int x, int lg) {
  int ret = 0;
  for (int i = 0; i < lg; i++)
    if ((x >> i) & 1) ret |= (1 << (lg - i - 1));
  return ret;
}
void fft(vector<complex<long double>> &a) {
  int lgn = 0, n = a.size();
  while ((1 << lgn) < n) lgn++;
  for (int i = 0; i < n; i++)
    if (rev(i, lgn) < i) swap(a[i], a[rev(i, lgn)]);
  for (int len = 2; len <= n; len <<= 1) {
    long double ang = 2.0 * PI / len;
    complex<long double> wn(cos(ang), sin(ang));
    for (int i = 0; i < n; i += len) {
      complex<long double> w(1);
      for (int j = 0; j < len / 2; j++) {
        complex<long double> u = a[i + j], v = w * a[i + j + len / 2];
        a[i + j] = u + v;
        a[i + j + len / 2] = u - v;
        w *= wn;
      }
    }
  }
}
void inv_fft(vector<complex<long double>> &a) {
  int lgn = 0, n = a.size();
  while ((1 << lgn) < n) lgn++;
  for (int i = 0; i < n; i++)
    if (rev(i, lgn) < i) swap(a[i], a[rev(i, lgn)]);
  for (int len = 2; len <= n; len <<= 1) {
    long double ang = -2.0 * PI / len;
    complex<long double> wn(cos(ang), sin(ang));
    for (int i = 0; i < n; i += len) {
      complex<long double> w(1);
      for (int j = 0; j < len / 2; j++) {
        complex<long double> u = a[i + j], v = w * a[i + j + len / 2];
        a[i + j] = u + v;
        a[i + j + len / 2] = u - v;
        w *= wn;
      }
    }
  }
  for (int i = 0; i < n; i++) a[i] /= n;
}
vector<complex<long double>> mult(vector<complex<long double>> a,
                                  vector<complex<long double>> b) {
  vector<complex<long double>> ret;
  int sz = 1;
  while (sz < max(a.size(), b.size())) sz <<= 1;
  sz <<= 1;
  a.resize(sz);
  b.resize(sz);
  ret.resize(sz);
  fft(a);
  fft(b);
  for (int i = 0; i < sz; i++) ret[i] = a[i] * b[i];
  inv_fft(ret);
  return ret;
}
int n, m;
void read() { cin >> n >> m; }
int64_t dp[MAXN][MAXN], back_dp[MAXN][MAXN], back_all_dp[MAXN][MAXN];
void solve() {
  for (int i = 2; i <= m; i++) dp[1][i] = 1;
  for (int i = 2; i <= n; i++) {
    int64_t sum = 0, val_dp = 1;
    for (int l = 2; l <= m; l++) {
      sum = (sum + dp[i - 1][l]) % mod;
      val_dp = (val_dp + sum) % mod;
      dp[i][l] = val_dp;
    }
  }
  for (int i = 2; i <= m; i++) back_dp[n][i] = 1, back_all_dp[n][i] = 1;
  for (int i = n - 1; i >= 1; i--) {
    int64_t sum = 0, val_dp = 1;
    for (int l = 2; l <= m; l++) {
      sum = (sum + back_all_dp[i + 1][l]) % mod;
      val_dp = (val_dp + sum) % mod;
      back_dp[i][l] = (val_dp - back_all_dp[i + 1][l] + mod) % mod;
      back_all_dp[i][l] = (val_dp + mod) % mod;
    }
  }
  int64_t ans = 0;
  for (int i = 1; i <= n; i++)
    for (int j = 2; j <= m; j++)
      ans = (ans + ((dp[i][j] * back_dp[i][j]) % mod) * (m - j + 1)) % mod;
  cout << ans << '\n';
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  read();
  solve();
  return 0;
}
