#include <stdio.h>
int memo[100000] = {};
int pbo(int k) {
if(k<=2) {
return memo[k] = 1;
}
if(memo[k] != 0) {
return memo[k];
}
if(k==3) {
return 1*2+1;
}
if(k==4) {
return 3*2-1;
}
if(k%2==0) {
memo[k] = pbo(k-1) * 2 + 1;
}
if(k%2!=0) {
memo[k] = pbo(k-1) * 2 - 1;
}
return memo[k];
}
int main()
{
int n;
scanf("%d", &n);
if(n==1) {
printf("1");
return 0;
}
if(n==2) {
printf("3");
return 0;
}
printf("%d", pbo(n)%100007);
}