import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int N = Integer.parseInt(br.readLine());
if(2<N) {
int[] dp = new int[N+1];
dp[1] = 1;
dp[2] = 3;
for(int i=3; i<=N; i++){
dp[i] = (dp[i-1]+2*dp[i-2])%10007;
}
System.out.println(dp[N]);
}
else if(1<N) System.out.println(3);
else System.out.println(1);
}
}