MOD = 1000000007
def mul(a, b):
c = [[0, 0, 0], [0, 0, 0], [0, 0, 0]]
for i in range(0, 3):
for j in range(0, 3):
for k in range(0, 3):
c[i][j] = (c[i][j] + a[i][k]*b[k][j])%MOD
for i in range(0, 3):
for j in range(0, 3):
c[i][j] = c[i][j] % MOD
return c
def pow_mod(n):
d = [ [1, 1, 1],[1, 0, 0],[0, 0, 1]]
ans = [[1, 0, 0], [0, 1, 0], [0, 0, 1]]
while n:
if n&1:
ans = mul(ans, d)
d = mul(d, d)
n >>= 1
return ans
def solve(n):
print n, " : ",
ans = 0
if n < 2:
print 1
else:
ans = pow_mod(n - 1)
res = ans[0][0] + ans[0][1] + ans[0][2]
print res % MOD
#test for 1 to 100
def main():
for i in range(0, 100):
solve(i)
main()
#1 1 3 5 9
"""
#brute force
def main():
s = [1, 1]
for i in range(2, 100):
s.append(s[i-1] + s[i-2] + 1)
for i in range(0, 100):
print i, " : ", s[i] % (10**9 + 7)
main()
"""
TU9EID0gMTAwMDAwMDAwNwpkZWYgbXVsKGEsIGIpOgoJYyA9IFtbMCwgMCwgMF0sIFswLCAwLCAwXSwgWzAsIDAsIDBdXQoJZm9yIGkgaW4gcmFuZ2UoMCwgMyk6CgkJZm9yIGogaW4gcmFuZ2UoMCwgMyk6CgkJCWZvciBrIGluIHJhbmdlKDAsIDMpOgoJCQkJY1tpXVtqXSA9IChjW2ldW2pdICsgYVtpXVtrXSpiW2tdW2pdKSVNT0QKCWZvciBpIGluIHJhbmdlKDAsIDMpOgoJCWZvciBqIGluIHJhbmdlKDAsIDMpOgoJCQljW2ldW2pdID0gY1tpXVtqXSAlIE1PRAoJcmV0dXJuIGMKZGVmIHBvd19tb2Qobik6CglkID0gWyBbMSwgMSwgMV0sWzEsIDAsIDBdLFswLCAwLCAxXV0KCWFucyA9IFtbMSwgMCwgMF0sIFswLCAxLCAwXSwgWzAsIDAsIDFdXQoJd2hpbGUgbjoKCQlpZiBuJjE6CgkJCWFucyA9IG11bChhbnMsIGQpC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