#include <bits/stdc++.h>
using namespace std;
template <typename T>
T nextInt() {
  T x = 0, p = 1;
  char ch;
  do {
    ch = getchar();
  } while (ch <= ' ');
  if (ch == '-') {
    p = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + (ch - '0');
    ch = getchar();
  }
  return x * p;
}
const int maxN = (int)5e5 + 10;
const int INF = (int)1e9 + 5;
const int mod = (int)1e6 + 3;
const long long LLINF = (long long)1e18 + 5;
int fact[maxN];
int inv[maxN];
int mul(int x, int y) { return (1LL * x * y) % mod; }
int binpow(int x, int n) {
  int ret = 1;
  while (n) {
    if (n % 2 == 1) ret = mul(ret, x);
    x = mul(x, x);
    n /= 2;
  }
  return ret;
}
int C(int n, int k) {
  if (n < 0 || k < 0 || k > n) return 0;
  return mul(fact[n], mul(inv[k], inv[n - k]));
}
int getsum(int n, int k) {
  int a = n - k;
  int b = C(n, k);
  int c = k;
  int d = C(0, k);
  int e = binpow(k + 1, mod - 2);
  a = mul(a, b);
  c = mul(c, d);
  a += c;
  if (a >= mod) a -= mod;
  a = mul(a, e);
  return a;
}
int main() {
  fact[0] = inv[0] = 1;
  for (int i = 1; i < maxN; ++i) {
    fact[i] = mul(fact[i - 1], i);
    inv[i] = binpow(fact[i], mod - 2);
  }
  int n, c;
  cin >> n >> c;
  int res = 0;
  for (int k = 1; k <= c; ++k) {
    res += mul(getsum(n, k - 1), C(c, k));
    if (res >= mod) res -= mod;
  }
  cout << res << endl;
  return 0;
}
