a,b,c=1,0,0

exec('a,b,c=b,c,(a+c)%(10**9+7);'*(int(eval(input()))-2))

print(c)
a,b,c=1,0,0

exec('a,b,c=b,c,a+c;'*(int(eval(input()))-2))

print((c%(10**9+7)))
a, b, c = 1, 0, 0
exec("a,b,c=b,c,(a+c)%(10**9+7);" * (int(eval(input())) - 2))
print(c)

a, b, c = 1, 0, 0
exec("a,b,c=b,c,a+c;" * (int(eval(input())) - 2))
print((c % (10**9 + 7)))

-exec("a,b,c=b,c,(a+c)%(10**9+7);" * (int(eval(input())) - 2)) -print(c) +exec("a,b,c=b,c,a+c;" * (int(eval(input())) - 2)) +print((c % (10**9 + 7)))