using System.Numerics; using System; public class Hello { public static int MOD = 1000000007; static void Main() { var n = long.Parse(Console.ReadLine().Trim()); getAns(n); } static void getAns (long n) { var ans = BigInteger.ModPow(3, n - 1, MOD); if (n % 2 == 0) ans++; else ans--; ans *= 3; ans %= MOD; var inv4 = ModInverse(4, MOD); ans *= inv4; ans %= MOD; Console.WriteLine(ans); } public static BigInteger ModInverse(BigInteger a, BigInteger m) { return BigInteger.ModPow(a, m - 2, m); } }