s = int(eval(input()))

a = [None, 0, 0] + [1] * (s - 2)

for i in range(3, s - 2):

  a[i + 3] += a[i]

  a[i + 1] += a[i]

print((a[s] % (10**9 + 7)))

s = int(eval(input()))

a = b = 0; c = int(s > 2)

for _ in range(s - 3):

  a, b, c = b, c, (a + c) % (10**9 + 7)

print(c)

s = int(eval(input()))
a = [None, 0, 0] + [1] * (s - 2)
for i in range(3, s - 2):
    a[i + 3] += a[i]
    a[i + 1] += a[i]
print((a[s] % (10**9 + 7)))

s = int(eval(input()))
a = b = 0
c = int(s > 2)
for _ in range(s - 3):
    a, b, c = b, c, (a + c) % (10**9 + 7)
print(c)

-a = [None, 0, 0] + [1] * (s - 2) -for i in range(3, s - 2): -    a[i + 3] += a[i] -    a[i + 1] += a[i] -print((a[s] % (10**9 + 7))) +a = b = 0 +c = int(s > 2) +for _ in range(s - 3): +    a, b, c = b, c, (a + c) % (10**9 + 7) +print(c)