using System; using static System.Console; using System.Linq; using System.Collections.Generic; class Program { static int NN => int.Parse(ReadLine()); static long[] NList => ReadLine().Split().Select(long.Parse).ToArray(); public static void Main() { Solve(); } static void Solve() { var n = NN; var mod = 1_000_000_007; if (n < 3) WriteLine(new int[] { 1, 12, 63 }[n]); else WriteLine((172 + 125L * (n - 3) % mod + 17L * (n - 3) % mod * (n - 4) % mod) % mod); } }