import java.util.Scanner; public class Main { public static void main(String[] args) throws Exception { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); sc.close(); int[] a = {1, 12, 65}; if (n < 3) { System.out.println(a[n]); } else { int mod = 1000000007; long x = 6L * n + 1; long x1 = x / 2; long x2 = x1 + 1; x1 %= mod; x2 %= mod; long v1 = x1 * x2 * 2 % mod; long r1 = n / 2; long r2 = r1 * (r1 + 1); if (n % 2 == 0) { r2 -= r1; } r2 *= 4; r2 %= mod; long ans = v1 - r2 + mod; ans %= mod; System.out.println(ans); } } }