s = int(eval(input()))

mod = 10**9 + 7



# dp[i]: 最後に切った場所がi

dp = [0]*(s + 1)

dp[0] = 1



for i in range(3, s+1):

    for j in range(0, (i-3)+1):

        dp[i] += dp[j]

        dp[i] %= mod



print((dp[s]))
s = int(eval(input()))

mod = 10**9 + 7



# dp[i]: 最後に切った場所がi

dp = [0]*(s + 1)

dp[0] = 1

total = 0

for i in range(3, s+1):

    total += dp[i-3]

    total %= mod

    dp[i] = total



print((dp[s]))
s = int(eval(input()))
mod = 10**9 + 7
# dp[i]: 最後に切った場所がi
dp = [0] * (s + 1)
dp[0] = 1
for i in range(3, s + 1):
    for j in range(0, (i - 3) + 1):
        dp[i] += dp[j]
        dp[i] %= mod
print((dp[s]))

s = int(eval(input()))
mod = 10**9 + 7
# dp[i]: 最後に切った場所がi
dp = [0] * (s + 1)
dp[0] = 1
total = 0
for i in range(3, s + 1):
    total += dp[i - 3]
    total %= mod
    dp[i] = total
print((dp[s]))

+total = 0 -    for j in range(0, (i - 3) + 1): -        dp[i] += dp[j] -        dp[i] %= mod +    total += dp[i - 3] +    total %= mod +    dp[i] = total