import sys sys.setrecursionlimit(10**7) def I(): return int(sys.stdin.readline().rstrip()) def MI(): return map(int,sys.stdin.readline().rstrip().split()) def LI(): return list(map(int,sys.stdin.readline().rstrip().split())) def LI2(): return list(map(int,sys.stdin.readline().rstrip())) def S(): return sys.stdin.readline().rstrip() def LS(): return list(sys.stdin.readline().rstrip().split()) def LS2(): return list(sys.stdin.readline().rstrip()) N = I() mod = 10**9+7 dp1 = [0]*(N+1) # dp1[i] = i段の登り方の方法の数(最後が1段) dp2 = [0]*(N+1) # dp2[i] = i段の登り方の方法の数(最後が2段) dp3 = [0]*(N+1) # dp3[i] = i段の登り方の方法の数(最後が3段) if N == 1 or N == 2: print(1) exit() dp1[1] = 1 dp2[2] = 1 dp1[3] = 1 dp2[3] = 1 dp3[3] = 1 for i in range(4,N+1): dp1[i] = dp2[i-1]+dp3[i-1] dp2[i] = dp1[i-2]+dp3[i-2] dp3[i] = dp1[i-3]+dp2[i-3] dp1[i] %= mod dp2[i] %= mod dp3[i] %= mod print((dp1[-1]+dp2[-1]+dp3[-1]) % mod)