#include<bits/stdc++.h>
using namespace std;
const int p=1000000007;
int main(){
	freopen("barrack.in","r",stdin);
	freopen("barrack.out","w",stdout);
	int n;
	cin>>n;
	int ans=n;
	for(int i=1;i<=n-1;i++)ans=(2ll*ans)%p;
	int ans1=1ll*n*(n-1)/2%p;
	for(int i=1;i<=n-2;i++)ans1=(2ll*ans1)%p;
	cout<<(ans+ans1)%p;
}