M=10**9+7 n=input() c=1 for i in range(n): c=c*(n-i)/(i+1) x+=pow(m,n-i-1,M)*C print x%M