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 // 入力 FastScanner sc = new FastScanner(System.in); int N = sc.nextInt(); int[][] dp = new int[4][N+10]; int DIV = 1000000007; // DP表の作成 dp[0][0] = 1; dp[1][0] = 0; dp[1][0] = 0; dp[1][0] = 0; for(int i = 0; i < N; i++){ dp[0][i+1] = mod(dp[1][i], dp[2][i], dp[3][i], DIV); dp[1][i+1] = mod(dp[0][i], dp[2][i], dp[3][i], DIV); dp[2][i+1] = mod(dp[0][i], dp[1][i], dp[3][i], DIV); dp[3][i+1] = mod(dp[0][i], dp[1][i], dp[2][i], DIV); } // 出力 System.out.println(dp[0][N]); } // 3数の和を指定数で割った余りを求める関数 public static int mod(int a, int b, int c, int DIV){ int result = (a + b) % DIV; result = (result + c) % DIV; return result; } // 高速スキャナー static class FastScanner { private BufferedReader reader = null; private StringTokenizer tokenizer = null; public FastScanner(InputStream in) { reader = new BufferedReader(new InputStreamReader(in)); tokenizer = null; } public String next() { if (tokenizer == null || !tokenizer.hasMoreTokens()) { try { tokenizer = new StringTokenizer(reader.readLine()); } catch (IOException e) { throw new RuntimeException(e); } } return tokenizer.nextToken(); } public String nextLine() { if (tokenizer == null || !tokenizer.hasMoreTokens()) { try { return reader.readLine(); } catch (IOException e) { throw new RuntimeException(e); } } return tokenizer.nextToken("\n"); } public long nextLong() { return Long.parseLong(next()); } public int nextInt() { return Integer.parseInt(next()); } public double nextDouble() { return Double.parseDouble(next()); } public int[] nextIntArray(int n) { int[] a = new int[n]; for (int i = 0; i < n; i++) a[i] = nextInt(); return a; } public long[] nextLongArray(int n) { long[] a = new long[n]; for (int i = 0; i < n; i++) a[i] = nextLong(); return a; } } }