S = int(eval(input()))



if S == 1 or S ==2:

  print((0))

  

elif S == 3:

  print((1))

  

else:

  

  #初期化

  dp = [0]*S

  dp[2] = 1

  dp_S = 0

  

  #dp

  for i in range(3,S):

    dp_S += dp[i-3] 

    dp[i] = 1+dp_S



  print((dp[S-1]%1000000007))
S = int(eval(input()))

  

#初期化

dp = [0]*S

if S > 2:

  dp[2] = 1

  dp_S = 0



#dp

  for i in range(3,S):

    dp_S += dp[i-3] 

    dp[i] = 1+dp_S



print((dp[S-1]%1000000007))
S = int(eval(input()))
if S == 1 or S == 2:
    print((0))
elif S == 3:
    print((1))
else:
    # 初期化
    dp = [0] * S
    dp[2] = 1
    dp_S = 0
    # dp
    for i in range(3, S):
        dp_S += dp[i - 3]
        dp[i] = 1 + dp_S
    print((dp[S - 1] % 1000000007))

S = int(eval(input()))
# 初期化
dp = [0] * S
if S > 2:
    dp[2] = 1
    dp_S = 0
    # dp
    for i in range(3, S):
        dp_S += dp[i - 3]
        dp[i] = 1 + dp_S
print((dp[S - 1] % 1000000007))

-if S == 1 or S == 2: -    print((0)) -elif S == 3: -    print((1)) -else: -    # 初期化 -    dp = [0] * S +# 初期化 +dp = [0] * S +if S > 2: -    print((dp[S - 1] % 1000000007)) +print((dp[S - 1] % 1000000007))