https://www.acmicpc.net/problem/11727
import sys
input = sys.stdin.readline
def sol(n):
res = [1]
for i in range(2, n+1):
if i % 2 == 1:
res.append(res[-1] * 2 - 1)
else:
res.append(res[-1]*2+1)
return (res[-1] % 10007)
n = int(input())
print(sol(n))