m=10**9+7 p,k=map(int,input().split()) a=(pow(10,p-1,m)-1)*pow(p,m-2,m)+(k<1) print(a%m)