/*
    school: High School for Gifted Students, University of Science;
    author: Khoi
 */
#include<bits/stdc++.h>
using namespace std;

template <class T>bool maximize(T &a, const T &b) {if (a < b) {a = b;return true;}return false;}
template <class T>bool minimize(T &a, const T &b) {if (a > b) {a = b;return true;}return false;}
template <class T> istream& operator>> (istream& in, vector <T>& a){ for (auto &x: a){ in >> x; } return in; }

#define FOR(i, a, b) for (int i = (a), _b = (b); i <= _b; i++)
#define FORD(i, b, a) for (int i = (b), _a = (a); i >= _a; i--)
#define REP(i, n) for (int i = 0, _n = (n); i < _n; i++)
#define db(...) cerr << "[" << #__VA_ARGS__ << ": ", debug(__VA_ARGS__), cerr << "\n";
#define ll long long
#define fi first
#define se second

/* Author: Khoi Pham Phuc Minh */

/** END OF TEMPLATE. DRINK A CUP OF TIGERSUGAR BEFORE READING MY CODE. **/

const int MAXN = 2e5 + 5;
const int m = 1e9 + 7;

void algovate();

int main(void) {
#ifdef ONLINE_JUDGE
//    freopen("tenbai.inp", "r", stdin);
//    freopen("tenbai.out", "w", stdout);
#endif
    cin.tie(0), cout.tie(0) -> sync_with_stdio(0);
    int ntest = 1;
    //cin >> ntest;
    REP(gspmk, ntest) {
        // cout << "Case #" << gspmk << ": ";
        algovate();
    }
#ifdef gspmk_algovate_local
    auto end = chrono::steady_clock::now();
    cout << endl;
    cout << "Excution time : " << chrono::duration_cast<chrono::milliseconds> (end - start).count() << "[ms]" << endl;
#endif
    return (0^0);
}

ll n;

ll mu(ll a, ll b) {
    ll ans = 1;a %= m;
    while (b > 0) { if (b & 1) ans = (ans * a) % m; a = (a * a) % m; b >>= 1; }
    return ans;
}

void algovate(void) {
    cin >> n;
    ll k = (mu((n + 1) / 2, (n + 1) / 2) * mu(n / 2, n / 2)) % m, d = (mu(n / 2, (n + 1) / 2) * mu((n + 1) / 2, n / 2)) % m;
    cout << (k + d) % m <<"\n";
}

/*** BUBBLE TEA IS GREAT. MY CODE IS AMAZING :D ***/
