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.BufferedWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStreamWriter;


import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map.Entry;
import java.util.PriorityQueue;
import java.util.TreeSet;


public final class CF_113_E{
	static boolean verb=true;
	static void log(Object X){if (verb) System.err.println(X);}
	static void log(Object[] X){if (verb) {for (Object U:X) System.err.print(U+" ");System.err.println("");}}
	static void log(int[] X){if (verb) {for (int U:X) System.err.print(U+" ");System.err.println("");}}
	static void log(long[] X){if (verb) {for (long U:X) System.err.print(U+" ");System.err.println("");}}
	static void logWln(Object X){if (verb) System.err.print(X);}
	static void info(Object o){	System.out.println(o);}
	static void output(Object o){outputWln(""+o+"\n");	}
	static void outputWln(Object o){try {out.write(""+ o);} catch (Exception e) {}}


	static int MX=Integer.MAX_VALUE;

	static class Composite implements Comparable<Composite>{
		int c;
		int s;

		public int compareTo(Composite X){
			return s-X.s;
		}

		public Composite(int c, int s) {
			this.c = c;
			this.s = s;
		}


	}


	static class Choice {


		long v;
		int a;
		int b;
		boolean trans;

		Choice prev;

		public Choice(long v){
			a=-1;
			b=-1;
			prev=null;
			this.v=v;
			trans=false;
		}

	}


	static BufferedWriter out;
	static InputReader reader;


	static long mod=1000000007;

	static void process() throws Exception {



		out = new BufferedWriter(new OutputStreamWriter(System.out));
		reader=new InputReader(System.in);

		int n=reader.readInt();
		long[] num=new long[2];
		num[0]=1;
		if (n==1){
			output("0");
		} else {
			for (int i=0;i<n;i++){
				long[] nxt=new long[2];
				for (int e=0;e<2;e++){
					if (e==0)
						nxt[1-e]+=3*num[e];
					else {
						nxt[1-e]+=num[e];
						nxt[e]+=2*num[e];
					}
					nxt[1-e]%=mod;
					nxt[e]%=mod;
				}
				num=nxt;
			}
			output(num[0]);

		}




			try {
				out.close();
			}
			catch (Exception e){}


		}


		public static void main(String[] args) throws Exception {
			process();

		}

		static final class InputReader {
			private final InputStream stream;
			private final byte[] buf = new byte[1024];
			private int curChar;
			private int numChars;

			public InputReader(InputStream stream) {
				this.stream = stream;
			}

			private int read() throws IOException {
				if (curChar >= numChars) {
					curChar = 0;
					numChars = stream.read(buf);
					if (numChars <= 0) {
						return -1;
					}
				}
				return buf[curChar++];
			}


			public final String readString() throws IOException {
				int c = read();
				while (isSpaceChar(c)) {
					c = read();
				}
				StringBuilder res=new StringBuilder();
				do {
					res.append((char)c);
					c = read();
				} while (!isSpaceChar(c));
				return res.toString();
			}

			public final int readInt() throws IOException {
				int c = read();
				boolean neg=false;
				while (isSpaceChar(c)) {
					c = read();
				}
				char d=(char)c;
				//log("d:"+d);
				if (d=='-') {
					neg=true;
					c = read();
				}
				int res = 0;
				do {
					res *= 10;
					res += c - '0';
					c = read();
				} while (!isSpaceChar(c));
				//log("res:"+res);
				if (neg)
					return -res;
				return res;

			}

			public final long readLong() throws IOException {
				int c = read();
				boolean neg=false;
				while (isSpaceChar(c)) {
					c = read();
				}
				char d=(char)c;
				//log("d:"+d);
				if (d=='-') {
					neg=true;
					c = read();
				}
				long res = 0;
				do {
					res *= 10;
					res += c - '0';
					c = read();
				} while (!isSpaceChar(c));
				//log("res:"+res);
				if (neg)
					return -res;
				return res;

			}




			private boolean isSpaceChar(int c) {
				return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
			}
		}


	}