#include using namespace std; long b,c,d,M=1e9+7; long pow(long a,long b){return b?pow(a%M*a%M,b/2)*(b%2?a%M:1)%M:1;} main() { cin>>b>>c>>d; long B=b%M,C=c%M,D=d%M; if(c>1)cout<