#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; string s[61]; int b1[12] = { 3,3,2,0,-2,-3,-3,-3,-2,0,2,3 }; int b2[12] = { 0,2,3,3,3,2,0,-2,-3,-3,-3,-2 }; int ans1[4] = { 1,12,65 }; long long mod = 1000000007; int main() { long long n; cin >> n; if (n < 3) { cout << ans1[n] << endl; } else { if (n % 2 == 1) { long long ans = 0; long long a = (10 + (n - 3) * 3) % mod; ans += a * (a - 1) % mod; ans += a * (a - 1) % mod; ans %= mod; long long b = ((((n + 1) / 2) * ((n + 1) / 2)) + (n / 2) * (n / 2)) / 2 % mod; ans -= b * 4, ans %= mod; cout << (ans + mod) % mod << endl; } else { long long ans = 0; long long a = 10 + (n - 3) * 3; ans += a * a % mod; ans += (a - 1) * (a - 1) % mod; ans %= mod; ans -= (n / 2) * (n / 2) % mod * 4 % mod, ans %= mod; cout << (ans + mod) % mod << endl; } } }