import java.io.FileNotFoundException; import java.util.Arrays; import java.util.Scanner; public class Main { public static void main(String[] args) throws FileNotFoundException { new Main().run(); } final long MODULO = 1_000_000_000 + 7; void run() { Scanner sc = new Scanner(System.in); long n = sc.nextLong(); // (1,4) // (2,3) // (2,4) // (3,4) // (1,2) // (1,3) // (1,2),(3,4) // (1,4),(2,3) // s // t long[][] mt = { { 1, 1, 1, 1, 1, 1, 1, 0, 1, 0 }, { 1, 1, 1, 0, 0, 1, 0, 0, 1, 0 }, { 1, 1, 1, 1, 0, 1, 0, 0, 1, 0 }, { 1, 0, 1, 1, 0, 0, 0, 1, 1, 0 }, { 1, 0, 0, 0, 1, 1, 0, 1, 1, 0 }, { 1, 1, 1, 0, 1, 1, 0, 0, 1, 0 }, { 0, 0, 0, 1, 1, 0, 1, 0, 1, 0 }, { 1, 0, 0, 0, 0, 0, 0, 1, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0, 1, 0 }, { 1, 1, 1, 1, 1, 1, 0, 1, 0, 1 } }; mt = pow(mt, n + 1); long[][] v = { { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 1 }, { 0 } }; v = mul(mt, v); System.out.println(v[9][0]); } long[][] pow(long[][] a, long n) { long[][] ret = new long[a.length][a.length]; for (int i = 0; i < ret.length; ++i) ret[i][i] = 1; for (; n > 0; n >>= 1, a = mul(a, a)) { if (n % 2 == 1) { ret = mul(ret, a); } } return ret; } long[][] mul(long[][] a, long[][] b) { long[][] ret = new long[a.length][b[0].length]; int m = a[0].length; assert a[0].length == b.length; for (int i = 0; i < a.length; ++i) { for (int j = 0; j < b[i].length; ++j) { for (int k = 0; k < m; ++k) { ret[i][j] = (ret[i][j] + a[i][k] * b[k][j] % MODULO) % MODULO; } } } return ret; } void tr(Object... objects) { System.out.println(Arrays.deepToString(objects)); } }