#include <cstdio>
using namespace std;

long long mod = 1000000007ll;
long long power[500001];

int main() {
	freopen("barrack.in", "r", stdin);
	freopen("barrack.out", "w", stdout);
	power[0] = 1;
	for (long long i = 1; i <= 500000; i++)
		power[i] = power[i - 1] * 2 % mod;
	long long n;
	scanf("%lld", &n);
	long long ans = 0;
	for (int i = 1; i <= n - 1; i++)
		ans = (ans + n - i) % mod;
	ans = ans * power[n - 2] % mod;
	ans = ans + n * power[n - 1] % mod;
	printf("%lld\n", ans);
	fclose(stdin);
	fclose(stdout);
	return 0;
}