n = int(input()) m = 10**9+7 a = [] b = [] c = [] d = [] a.append(1) b.append(0) c.append(0) d.append(0) for x in range(n): a.append(b[x]+c[x]+d[x]) b.append(a[x]+c[x]+d[x]) c.append(a[x]+b[x]+d[x]) d.append(a[x]+b[x]+c[x]) print(a[n]%m)