#include <bits/stdc++.h>
using namespace std;
typedef long double ld;
typedef long long ll;
typedef pair<double, double> pdd;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<int, int> pii;
typedef vector<pii> vii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
const int mod = 1000000007;

int dw(int x) {
  return x < mod ? x : x - mod;
}

const int N = 4100;
int bin[N][N];
int bins[N][N + 1];
int bin2[N][N + 1];

int main() {
  std::ios::sync_with_stdio(false); std::cin.tie(0);
  int a, b;
  cin >> a >> b;
  if (a == 1 || b == 1) {
    cout << a + b << endl;
    return 0;
  }
  if (a == 2 || b == 2) {
    cout << (a + b) * (a + b - 1) / 2 % mod << endl;
    return 0;
  }
  for (int i = 0; i < N; ++i) {
    bin[i][0] = 1;
    for (int j = 1; j <= i; ++j) bin[i][j] = dw(bin[i-1][j] + bin[i-1][j-1]);
    bins[i][0] = 0;
    for (int j = 0; j < N; ++j) bins[i][j+1] = dw(bins[i][j] + bin[i][j]);
    bin2[i][0] = 0;
    for (int j = 0; j < N; ++j) bin2[i][j+1] = dw(bin2[i][j] + bins[i][j]);
  }
  ll res = 0;
  for (int i = 1; i <= a + 1; ++i) {
    res += 1;
//    if (i == a + 1) continue;
    for (int cb = max(0, b - 2 - a + i); cb <= b - 2; ++cb) {
      int l = a + 1 - i;
      int remb = b - 1 - cb;
      int rema = l - remb;
      assert(l >= remb && remb >= 1);
      int c0 = max(0, rema - remb + 1);
      res = (res + bin[b-1][cb] * (ll)bins[remb - 1][remb] % mod * c0) % mod;
      res = (res + bin[b-1][cb] * (ll)(bin2[remb - 1][rema - c0 + 2] - bin2[remb-1][1])) % mod;
//      for (int ca = 1; ca <= rema - c0 + 1; ++ca) {
//        res = (res + bin[b-1][cb] * (ll)bins[remb - 1][ca]) % mod;
//      }
//      cerr << i << ' ' << cb << ' ' << l << ' ' << remb << endl;
    }
  }
  cout << (res % mod + mod) % mod << endl;
  return 0;
}