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;
struct FFT {
  struct node {
    double x, y;
    node() {}
    node(double a, double b) : x(a), y(b) {}
    node operator+(const node &a) const {
      return node(this->x + a.x, this->y + a.y);
    }
    node operator-(const node a) const {
      return node(this->x - a.x, this->y - a.y);
    }
    node operator*(const node a) const {
      return node(this->x * a.x - this->y * a.y, this->x * a.y + a.x * this->y);
    }
  };
  long long M;
  vector<node> A, B, w[2];
  vector<long long> rev;
  long double pi = acos(-1.0);
  void init(long long n) {
    M = 1;
    while (M < n) M <<= 1;
    M <<= 1;
    A.resize(M);
    B.resize(M);
    w[0].resize(M);
    w[1].resize(M);
    rev.resize(M);
    for (long long i = 0; i < M; i++) {
      long long j = i, y = 0;
      for (long long x = 1; x < M; x <<= 1, j >>= 1) (y <<= 1) += j & 1;
      rev[i] = y;
    }
    for (long long i = 0; i < M; i++) {
      w[0][i] = node(cos(2 * pi * i / M), sin(2 * pi * i / M));
      w[1][i] = node(cos(2 * pi * i / M), -sin(2 * pi * i / M));
    }
  }
  void ftransform(vector<node> &A, long long p) {
    for (long long i = 0; i < M; i++)
      if (i < rev[i]) swap(A[i], A[rev[i]]);
    for (long long i = 1; i < M; i <<= 1)
      for (long long j = 0, t = M / (i << 1); j < M; j += i << 1)
        for (long long k = 0, l = 0; k < i; k++, l += t) {
          node x = w[p][l] * A[i + j + k];
          node y = A[j + k];
          A[j + k] = y + x;
          A[j + k + i] = y - x;
        }
    if (p)
      for (long long i = 0; i < M; i++) A[i].x /= M;
  }
  void multiply(vector<long long> &P, vector<long long> &Q,
                vector<long long> &res) {
    init(max(P.size(), Q.size()));
    for (long long i = 0; i < M; i++) A[i].x = A[i].y = B[i].x = B[i].y = 0;
    for (long long i = 0; i < P.size(); i++) A[i].x = P[i];
    for (long long i = 0; i < Q.size(); i++) B[i].x = Q[i];
    ftransform(A, 0);
    ftransform(B, 0);
    for (long long k = 0; k < M; k++) A[k] = A[k] * B[k];
    ftransform(A, 1);
    res.resize(M);
    for (long long i = 0; i < M; i++) res[i] = round(A[i].x);
  }
} fft;
long long dp[2005][2005];
long long pd[2005][2005];
const long long mod = 1e9 + 7;
int main() {
  long long n, m;
  cin >> n >> m;
  for (int width = 2; width <= m; width++) {
    dp[1][width] = 1;
    pd[1][width] = 1;
  }
  for (int len = 2; len <= n; len++) {
    vector<long long> mul(m, 0);
    for (int i = 0; i < m; i++) {
      mul[i] = i + 1;
    }
    vector<long long> f(m + 1, 0);
    for (int i = 1; i <= m; i++) f[i] = dp[len - 1][i];
    vector<long long> res;
    fft.multiply(mul, f, res);
    for (int i = 2; i <= m; i++)
      dp[len][i] = res[i], pd[len][i] = dp[len][i] - dp[len - 1][i];
  }
  long long ans = 0;
  for (int base = 2; base <= m; base++) {
    vector<long long> up(n + 1, 0), down(n + 1, 0);
    for (int len = 1; len <= n; len++) {
      up[len] = pd[len][base];
      down[len] = dp[len][base];
    }
    vector<long long> res;
    fft.multiply(up, down, res);
    long long cur = 0;
    for (int len = 1; len <= n; len++) {
      long long x = (res[len + 1] * (n - len + 1)) % mod;
      cur += x;
      cur %= mod;
    }
    cur *= (m - base + 1);
    cur %= mod;
    ans += cur;
    ans %= mod;
  }
  cout << ans << "\n";
}
