import times, strutils, sequtils, math, algorithm, tables, sets, lists, intsets import critbits, future, strformat, deques template `max=`(x,y) = x = max(x,y) template `min=`(x,y) = x = min(x,y) template `mod=`(x,y) = x = x mod y template scan2 = (scan(), scan()) template scan3 = (scan(), scan()) let read* = iterator: string {.closure.} = while true: (for s in stdin.readLine.split: yield s) proc scan(): int = read().parseInt proc scanf(): float = read().parseFloat proc toInt(c:char): int = return int(c) - int('0') proc solve():int= var n = scan() md = 10^9+7 dp = newseqwith(10^6,newseqwith(4,0)) if n>10^6: return 0 else: dp[0][0]=1 for i in 1..n: for t in 0..<4: for s in 0..<4: if t!=s: dp[i][t]+=dp[i-1][s] dp[i][t].mod=md #echo dp[0..5] return dp[n][0] echo solve()