#include <iostream>
using namespace std;
int n;
int arr[1001];
int solution(int deep)
{
if (deep == 0)
return arr[0] = 1;
if (deep == 1)
return arr[1] = 1;
if (arr[deep])
return arr[deep];
else
return arr[deep] = (solution(deep - 1) + (solution(deep - 2) * 2)) % 10007;
}
int main(void)
{
cin >> n;
solution(n);
cout << arr[n];
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgoKdXNpbmcgbmFtZXNwYWNlIHN0ZDsKaW50IG47CmludCBhcnJbMTAwMV07CmludCBzb2x1dGlvbihpbnQgZGVlcCkKewoJaWYgKGRlZXAgPT0gMCkKCQlyZXR1cm4gYXJyWzBdID0gMTsKCWlmIChkZWVwID09IDEpCgkJcmV0dXJuIGFyclsxXSA9IDE7CglpZiAoYXJyW2RlZXBdKQoJCXJldHVybiBhcnJbZGVlcF07CgllbHNlCgkJcmV0dXJuIGFycltkZWVwXSA9IChzb2x1dGlvbihkZWVwIC0gMSkgKyAoc29sdXRpb24oZGVlcCAtIDIpICogMikpICUgMTAwMDc7Cn0KCmludCBtYWluKHZvaWQpCnsKCWNpbiA+PiBuOwoKCXNvbHV0aW9uKG4pOwoJY291dCA8PCBhcnJbbl07CglyZXR1cm4gMDsKfQ==