from copy import deepcopy MOD = 10 ** 9 + 7 n = int(input()) if n % 2 == 0: n //= 2 A = [[0, 1], [1, 1]] B = [0, 1] while n: if n & 1: C = [0, 0] for i in range(2): for j in range(2): C[i] += A[i][j] * B[j] C[i] %= MOD B = C[:] n >>= 1 C = [[0, 0], [0, 0]] for i in range(2): for j in range(2): for k in range(2): C[i][j] += A[i][k] * A[k][j] C[i][j] %= MOD A = deepcopy(C) print(B[1]) else: A = [[0, 0, 0, 1], [1, 0, 1, 0], [2, 1, 1, 0], [1, 0, 0, 1]] B = [0, 0, 0, 1] n //= 2 while n: if n & 1: C = [0] * 4 for i in range(4): for j in range(4): C[i] += A[i][j] * B[j] C[i] %= MOD B = C[:] n >>= 1 C = [[0] * 4 for _ in range(4)] for i in range(4): for j in range(4): for k in range(4): C[i][j] += A[i][k] * A[k][j] C[i][j] %= MOD A = deepcopy(C) ans = B[0] * 2 + B[1] + B[2] + B[3] print(ans % MOD)