Dwarfs have planted a very interesting plant, which is a triangle directed "upwards". This plant has an amusing feature. After one year a triangle plant directed "upwards" divides into four triangle plants: three of them will point "upwards" and one will point "downwards". After another year, each triangle plant divides into four triangle plants: three of them will be directed in the same direction as the parent plant, and one of them will be directed in the opposite direction. Then each year the process repeats. The figure below illustrates this process.

<image>

Help the dwarfs find out how many triangle plants that point "upwards" will be in n years.

Input

The first line contains a single integer n (0 ≤ n ≤ 1018) — the number of full years when the plant grew.

Please do not use the %lld specifier to read or write 64-bit integers in С++. It is preferred to use cin, cout streams or the %I64d specifier.

Output

Print a single integer — the remainder of dividing the number of plants that will point "upwards" in n years by 1000000007 (109 + 7).

Examples

Input

1


Output

3


Input

2


Output

10

Note

The first test sample corresponds to the second triangle on the figure in the statement. The second test sample corresponds to the third one.
import java.io.InputStreamReader;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.Writer;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 * @author lwc626
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        MyInputReader in = new MyInputReader(inputStream);
        MyOutputWriter out = new MyOutputWriter(outputStream);
        TaskC solver = new TaskC();
        solver.solve(1, in, out);
        out.close();
    }
}

class TaskC {
    static final long mod = 1000000007;

    static Matrix power( Matrix a , long n){
        if( n == 0 ){
            return new Matrix(1,0,0,1);
        }
        if( n == 1) return new Matrix(a);

        Matrix ret = power( a , n >> 1);
        ret = mul(ret, ret);
        if((n&1)==1) ret = mul(ret,a);
        return ret;
    }
    static Matrix mul(Matrix a,Matrix b){
        return new Matrix( (a.a*b.a+a.b*b.c) % mod,(a.a*b.b+a.b*b.d)%mod,(a.c*b.a+a.d*b.c)%mod,(a.c*b.b+a.d*b.d)%mod);
    }
    public void solve(int testNumber, MyInputReader in, MyOutputWriter out) {
         Matrix ret = power( new Matrix(3,1,1,3) , in.nextLong());
         out.printLine( ret.a );
    }
}

class Matrix{
    long a,b,c,d;
    Matrix(long _a,long _b,long _c,long _d){
        a=_a;
        b=_b;
        c=_c;
        d=_d;
    }
    Matrix(Matrix ma){
        a=ma.a;
        b=ma.b;
        c=ma.c;
        d=ma.d;
    }
}

class MyInputReader {
    private BufferedReader reader;
    private StringTokenizer tokenizer;

    public MyInputReader(InputStream stream) {
        reader = new BufferedReader(new InputStreamReader(stream));
        tokenizer = null;
    }

    public String next() {
        while (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                tokenizer = new StringTokenizer(reader.readLine());
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken();
    }

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

class MyOutputWriter {
    private final PrintWriter writer;

    public MyOutputWriter(OutputStream outputStream) {
        writer = new PrintWriter(outputStream);
    }

    public MyOutputWriter(Writer writer) {
        this.writer = new PrintWriter(writer);
    }

    public void print(Object...objects) {
        for (int i = 0; i < objects.length; i++) {
            if (i != 0)
                writer.print(' ');
            writer.print(objects[i]);
        }
    }

    public void printLine(Object...objects) {
        print(objects);
        writer.println();
    }

    public void close() {
        writer.close();
    }

}
