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 _ {
  _() { ios_base::sync_with_stdio(0); }
} _;
template <class A, class B>
ostream &operator<<(ostream &o, pair<A, B> t) {
  o << "(" << t.first << ", " << t.second << ")";
  return o;
}
template <class T>
string tostring(T first, int len = 0, char c = '0') {
  stringstream ss;
  ss << first;
  string r = ss.str();
  if (r.length() < len) r = string(len - r.length(), c) + r;
  return r;
}
template <class T>
void PV(T a, T b, int n = 0, int w = 0, string s = " ") {
  int c = 0;
  while (a != b) {
    cout << tostring(*a++, w, ' ');
    if (a != b && (n == 0 || ++c % n))
      cout << s;
    else
      cout << "\n";
    cout.flush();
  }
}
template <class T>
inline bool chmin(T &a, T b) {
  return a > b ? a = b, 1 : 0;
}
template <class T>
inline bool chmax(T &a, T b) {
  return a < b ? a = b, 1 : 0;
}
const long long linf = 0x3f3f3f3f3f3f3f3fLL;
const int inf = 0x3f3f3f3f;
const int mod = int(1e9) + 7;
const int N = 2001;
int n, m;
long long f[N][N];
long long sum1[N][N];
long long sum2[N][N];
long long sumh[N][N];
long long sum[N][N];
long long ssum[N][N];
int main() {
  for (int h = 1; h < N; h++) {
    for (int i = 2; i < N; i++) {
      if (h == 1) {
        f[h][i] = 1;
      } else {
        f[h][i] = ((i + 1) * sum1[h - 1][i] - sum2[h - 1][i] + mod) % mod;
      }
      sum1[h][i] = (sum1[h][i - 1] + f[h][i]) % mod;
      sum2[h][i] = (sum2[h][i - 1] + f[h][i] * i) % mod;
      sum[h][i] =
          (sum[h - 1][i] + sum[h][i - 1] - sum[h - 1][i - 1] + f[h][i] + mod) %
          mod;
      ssum[h][i] = (ssum[h - 1][i] + ssum[h][i - 1] - ssum[h - 1][i - 1] +
                    i * f[h][i] + mod) %
                   mod;
      sumh[h][i] = (sumh[h - 1][i] + f[h][i]) % mod;
    }
  }
  cin >> n >> m;
  long long res = 0;
  for (int i = 0; i < n; i++)
    for (int l = 2; l <= m; l++) {
      long long up = (1 + sum[i][l - 1] * (l + 1) - ssum[i][l - 1] + mod) % mod;
      long long dn = sumh[n - i][l];
      res += up * dn % mod * (m - l + 1) % mod;
    }
  res %= mod;
  cout << res << endl;
  return 0;
}
