#include<iostream>
(30316)#include<vector>
using namespace std;
int mod = 1000000007;
long long Mod(long long n) {
long long t = 2;
long long res = 1;
while (n) {
if (n % 2 == 1)
res = ((res % mod) * t) % mod;
t = (t * t) % mod;
n = n / 2;
}
return res % mod;
}
int main() {
long long n;
cin >> n;
long long sum = ((n - 1) * Mod(n + 1)) % mod;
cout << sum << endl;
return 0;
}