https://www.acmicpc.net/problem/11727
n=int(input()) num=[0]*1002 num[1]=1 num[2]=3 for i in range(3,n+1): num[i]=(num[i-1]+2*num[i-2])%10007 print(num[n])