def twoDimArray(row,column,n): return [[n for j in range(column)] for i in range(row)] n = int(input()) div = 10**9 + 7 if n <= 1: print(1) exit() elif n == 2: print(1) exit() t1 = [0, 1, 0,1] t2 = [0, 0, 1,1] t3 = [0, 0, 0,1] for i in range(4, n + 1): t1.append((t2[i - 1] + t3[i - 1]) % div) t2.append((t1[i - 2] + t3[i - 2]) % div) t3.append((t1[i - 3] + t2[i - 3]) % div) print((t1[-1] + t2[-1] + t3[-1]) % div)