#include #define rep(i,n) for(int i = 0; i < (int)(n); i++) #define rrep(ri,n) for(int ri = (int)(n-1); ri >= 0; ri--) #define rep2(i,x,n) for(int i = (int)(x); i < (int)(n); i++) #define rrep2(ri,x,n) for(int ri = (int)(n-1); ri >= (int)(x); ri--) #define repit(itr,x) for(auto itr = x.begin(); itr != x.end(); itr++) #define rrepit(ritr,x) for(auto ritr = x.rbegin(); ritr != x.rend(); ritr++) #define ALL(x) x.begin(), x.end() using ll = long long; using namespace std; #include using namespace atcoder; using mint = modint1000000007; int main() { int n; cin >> n; if(n == 0) { cout << 1 << endl; return 0; } if(n == 1) { cout << 12 << endl; return 0; } if(n == 2) { cout << 65 << endl; return 0; } if(n % 2 == 0) { mint ans = 1 + 3LL*n; ans *= ans; ans = (ans+1)/2; mint p = n/2; ans -= p*(p+1) - p; ans -= mint(3)*n/2 + 1; ans *= 4; ans++; cout << ans.val() << endl; } else { mint ans = 1 + 3LL*n; ans *= ans; ans /= 2; mint p = n/2; ans -= p*(p+1); ans -= (mint(3)*n+1)/2; ans *= 4; cout << ans.val() << endl; } return 0; }