#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e5 + 10;
const long long MOD = 1e6 + 3;
inline int in() {
  int x = 0, flag = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') flag = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9')
    x = (x << 3) + (x << 1) + (ch ^ 48), ch = getchar();
  return x * flag;
}
long long n;
long long fastpow(long long a, long long b) {
  long long ret = 1;
  while (b) {
    if (b % 2 == 0)
      (a *= a) %= MOD, b /= 2;
    else
      (ret *= a) %= MOD, b--;
  }
  return ret;
}
int main() {
  n = in();
  if (n == 0) return printf("1"), 0;
  printf("%lld\n", fastpow(3LL, n - 1));
  return 0;
}
