#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e6 + 3;
long long FastPow(int x, int y) {
  if (y == 0) return 1;
  long long t = FastPow(x, (y >> 1));
  t *= t, t %= MOD;
  if (y & 1) t *= x, t %= MOD;
  return t;
}
int main() {
  int n;
  scanf("%d", &n);
  if (n == 0) printf("1"), exit(0);
  printf("%lld", FastPow(3, n - 1));
  return 0;
}
