#include using namespace std; const int MaxN = (int)5e5 + 10; const int INF = (int)1e9; const int MOD = (int)1e9 + 7; int mPow(int a, int n) { int r = 1; while (n > 0) { if (n & 1) { r = 1LL * r * a % MOD; } a = 1LL * a * a % MOD; n >>= 1; } return r; } int main() { // freopen("input.txt", "r", stdin); int n; scanf("%d", &n); printf("%d\n", n == 2 ? 0 : (1 - 1LL * n * mPow((MOD + 1) / 2, n - 1) % MOD + MOD) % MOD); return 0; }