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;
namespace io {
char ibuf[(1 << 20)], *iS, *iT, obuf[(1 << 20)],
    *oS = obuf, *oT = oS + (1 << 20) - 1, c, qu[55];
int f, qr;
inline void flush(void) {
  return fwrite(obuf, 1, oS - obuf, stdout), oS = obuf, void();
}
inline char getch(void) {
  return (iS == iT ? (iT = (iS = ibuf) + fread(ibuf, 1, (1 << 20), stdin),
                      (iS == iT ? EOF : *iS++))
                   : *iS++);
}
inline void putch(char x) {
  *oS++ = x;
  if (oS == oT) flush();
  return;
}
string getstr(void) {
  string s = "";
  char c = getch();
  while (c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == EOF)
    c = getch();
  while (!(c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == EOF))
    s.push_back(c), c = getch();
  return s;
}
void putstr(string str, int begin = 0, int end = -1) {
  if (end == -1) end = str.size();
  for (register int i = begin; i < end; i++) putch(str[i]);
  return;
}
template <typename T>
inline T read() {
  register T x = 0;
  for (f = 1, c = getch(); c < '0' || c > '9'; c = getch())
    if (c == '-') f = -1;
  for (x = 0; c <= '9' && c >= '0'; c = getch()) x = x * 10 + (c & 15);
  return x * f;
}
template <typename T>
inline void write(const T& t) {
  register T x = t;
  if (!x) putch('0');
  if (x < 0) putch('-'), x = -x;
  while (x) qu[++qr] = x % 10 + '0', x /= 10;
  while (qr) putch(qu[qr--]);
  return;
}
struct Flusher_ {
  ~Flusher_() { flush(); }
} io_flusher_;
}  // namespace io
using io::getch;
using io::getstr;
using io::putch;
using io::putstr;
using io::read;
using io::write;
long long f[2005][2005], g[2005][2005], h[2005][2005], cac[2005][2005];
int main() {
  int n = read<int>(), m = read<int>();
  for (register int i = 0; i <= m - 2; i++) f[1][i] = 1;
  for (register int i = 2; i <= n; i++) {
    f[i][0] = cac[i][0] = f[i - 1][0];
    for (register int j = 1; j <= m - 2; j++)
      cac[i][j] = (cac[i][j - 1] + f[i - 1][j]) % 1000000007,
      f[i][j] = (f[i][j - 1] + cac[i][j]) % 1000000007;
  }
  for (register int i = 1; i <= n; i++)
    for (register int j = 0; j <= m - 2; j++)
      g[i][j] = (g[i - 1][j] + f[i][j]) % 1000000007;
  memset(cac, 0, sizeof(cac));
  for (register int i = 1; i < n; i++)
    for (register int j = 1; j <= m - 2; j++)
      cac[i][j] = (cac[i][j - 1] + g[i][j - 1]) % 1000000007,
      h[i][j] = (h[i][j - 1] + cac[i][j] + g[i][j - 1]) % 1000000007;
  long long answer = 0;
  for (register int i = 1; i <= n; i++)
    for (register int j = 0; j <= m - 2; j++)
      answer =
          (answer + (m - j - 1) * g[i][j] % 1000000007 * (1 + h[n - i][j])) %
          1000000007;
  write(answer), putch('\n');
  return 0;
}
