import java.util.*; import java.lang.*; import java.io.*; public class Main { public static void main (String[] args) throws java.lang.Exception { // your code goes here // 入力 Scanner sc = new Scanner(System.in); int N = sc.nextInt(); long[] work = new long[N]; // 計算 work[0] = 0L; if(N > 1){ work[1] = 3L; int MOD = 1000000007; for(int i = 2; i < N; i++){ long w1 = (work[i-2] * 3) % MOD; long w2 = (work[i-1] * 2) % MOD; work[i] = (w1 + w2) % MOD; } } // 出力 System.out.println(work[N-1]); } }