#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=1e5+10,mod=1e9+7;
int n,m;
ll ans;
ll ksm(ll a,ll b)
{
	ll res=1;
	while(b>=1)
	{
		if(b%2==1) res=res*a%mod;
		a=a*a%mod;
		b/=2;
	}
	return res;
}
int main()
{
	freopen("barrack.in","r",stdin);
	freopen("barrack.out","w",stdout);
	scanf("%d%d",&n,&m);
	for(int i=1;i<=n;i++)
	{
		ans=(ans+ksm(2,i-1)*i%mod)%mod;
	}
	printf("%lld",ans);
	return 0;
}