You are given a tetrahedron. Let's mark its vertices with letters A, B, C and D correspondingly.

<image>

An ant is standing in the vertex D of the tetrahedron. The ant is quite active and he wouldn't stay idle. At each moment of time he makes a step from one vertex to another one along some edge of the tetrahedron. The ant just can't stand on one place.

You do not have to do much to solve the problem: your task is to count the number of ways in which the ant can go from the initial vertex D to itself in exactly n steps. In other words, you are asked to find out the number of different cyclic paths with the length of n from vertex D to itself. As the number can be quite large, you should print it modulo 1000000007 (109 + 7). 

Input

The first line contains the only integer n (1 ≤ n ≤ 107) — the required length of the cyclic path.

Output

Print the only integer — the required number of ways modulo 1000000007 (109 + 7).

Examples

Input

2


Output

3


Input

4


Output

21

Note

The required paths in the first sample are: 

  * D - A - D
  * D - B - D
  * D - C - D

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.PriorityQueue;
import java.util.StringTokenizer;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
/**
 *
 * @author Trung Pham
 */
public class E {

    public static void main(String[] args) {
        Scanner in = new Scanner();
        PrintWriter out = new PrintWriter(System.out);
        //  String line = in.next().toLowerCase();
        int n = in.nextInt();
        int Mod = 1000000007;
        if (n == 1) {
            out.println(0);
        } else if (n == 2) {
            out.println(3);
        } else if (n == 3) {
            out.println(6);
        } else {
            int val = n - 4;
            long start = 7;
            long last = 2;
            for(int i = 0; i < val; i++){
                long temp = start;
                start = 2*(start)%Mod + (3*last)%Mod;
                last = temp;
                start %=Mod;
            }
            
           // out.println(cal(0,0,n));
            out.println((start*3) % Mod);
        }
        out.close();
        //System.out.print(builder.toString());
    }

    public static int cal(int node, int left , int total) {
        if (left == total) {
            if (node == 0) {
                return 1;
            }
            return 0;
        }
        int result = 0;
        for (int i = 0; i < 4; i++) {
            if (i != node) {

                int val = cal(i, left + 1,total);
                result += val;                
            }
        }
        return result;
    }

    static class State implements Comparable<State> {

        int sum, index;

        public State(int sum, int index) {
            this.sum = sum;
            this.index = index;
        }

        @Override
        public int compareTo(State o) {
            if (sum != o.sum) {
                return sum - o.sum;
            } else {
                return index - o.index;
            }
        }
    }

    static void divide(Point a, int b) {
        a.x /= b;
        a.y /= b;
        a.z /= b;
    }

    static void mul(Point a, double b) {
        a.x *= b;
        a.y *= b;
        a.z *= b;
    }

    static Point add(Point a, Point b) {
        return new Point(a.x + b.x, a.y + b.y, a.z + b.z);
    }

    static Point minus(Point a, Point b) {
        return new Point(a.x - b.x, a.y - b.y, a.z - b.z);
    }

    static double distance(Point a, Point b) {
        double total = (a.x - b.x) * (a.x - b.x) + (a.y - b.y) * (a.y - b.y) + (a.z - b.z) * (a.z - b.z);
        return Math.sqrt(total);
    }

    static class Point {

        double x, y, z;

        public Point(double x, double y, double z) {
            this.x = x;
            this.y = y;
            this.z = z;
        }
    }

    static class Scanner {

        BufferedReader br;
        StringTokenizer st;

        public Scanner() {
            // System.setOut(new PrintStream(new BufferedOutputStream(System.out), true));
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        public String next() {

            while (st == null || !st.hasMoreTokens()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (Exception e) {
                    throw new RuntimeException();
                }
            }
            return st.nextToken();
        }

        public long nextLong() {
            return Long.parseLong(next());
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

        public double nextDouble() {
            return Double.parseDouble(next());
        }

        public String nextLine() {
            st = null;
            try {
                return br.readLine();
            } catch (Exception e) {
                throw new RuntimeException();
            }
        }

        public boolean endLine() {
            try {
                String next = br.readLine();
                while (next != null && next.trim().isEmpty()) {
                    next = br.readLine();
                }
                if (next == null) {
                    return true;
                }
                st = new StringTokenizer(next);
                return st.hasMoreTokens();
            } catch (Exception e) {
                throw new RuntimeException();
            }
        }
    }
}
