#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;

typedef long long LL;
const int MOD = 1000000007;

void mul(int a[2][2], int b[2][2], int u[2][2]){
    for(int i=0;i<2;i++) for(int j=0;j<2;j++){
        LL tmp=0;
        for(int k=0;k<2;k++) tmp+=LL(a[i][k])*b[k][j];
        u[i][j]=tmp%MOD;
    }
}

void pow(int a[2][2], int n){
    if(n==1) return;
    int u[2][2],r[2][2];
    memcpy(u,a,sizeof(u));
    pow(u,n/2);
    if(n%2){
        mul(u,a,r);
        mul(u,r,a);
    }else{
        mul(u,u,a);
    }
}

int main(){
    int n,m,k;
    while(scanf("%d%d%d",&n,&m,&k)==3){
        int a[2][2]={
            {k-1,k},
            {m-k,m-k}
        };
        pow(a,n);
        int ans=(a[0][1]+a[1][1])%MOD;
        printf("%d\n",ans);
    }
}
