#include <algorithm>
#include <vector>
#include <iostream>
using namespace std;
typedef long long ll;
vector<ll> cache(1001, -1);
//2xn 크기 직사각형을 채우는 방법의 수
ll solve(int n) {
//base caes
if (n <= 1) return 1;
ll& res = cache[n];
if (res != -1) return res;
res = 0LL;
res += solve(n - 1);
res %= 10007;
res += (2 * solve(n - 2));
res %= 10007;
return res;
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL); cout.tie(NULL);
int n;
cin >> n;
cout << solve(n);
return 0;
}