package BOJ._0119;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
public class BOJ_1309 {
static int[][] answer;
static int mod = 9901;
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int n = Integer.parseInt(br.readLine());
answer = new int[n + 1][3];
solve(n);
}
private static void solve(int n) {
answer[1][0] = 1;
answer[1][1] = 1;
answer[1][2] = 1;
for(int i=2; i<=n; i++){
answer[i][0] = answer[i-1][0]%mod + answer[i-1][1]%mod + answer[i-1][2]%mod;
answer[i][1] = answer[i-1][0]%mod + answer[i-1][2]%mod;
answer[i][2] = answer[i-1][0]%mod + answer[i-1][1]%mod;
}
System.out.println((Arrays.stream(answer[n]).sum())%mod);
}
}