    #include<bits/stdc++.h>
    using namespace std;
    #define MAXN 400005
    #define MOD 998244353
    #define LL long long int
    LL ans,res,C[MAXN],fac[MAXN],revfac[MAXN];
    int n,m,k;
    LL qpow(LL a,int b)
    {
        LL tmp=1;
        while(b)
        {
            if(b&1)
            tmp=tmp*a%MOD;
            a=a*a%MOD;
            b>>=1;
        }
        return tmp;
    }
    void facrev()
    {
        C[0]=1;
        C[1]=(n-1);
        fac[1]=1;
        for(int i=2;i<=n;i++)
        {
            fac[i]=fac[i-1]*i%MOD;
            C[i]=C[i-1]*(n-i)%MOD;
        }
        revfac[n]=qpow(fac[n],MOD-2);
        for(int i=n-1;i>=1;i--)
        revfac[i]=revfac[i+1]*(i+1)%MOD,C[i]=C[i]*revfac[i]%MOD;
    }
    int main()
    {
        scanf("%d%d%d",&n,&m,&k);
        facrev();
        int p=n-k;
        res=m;
        for(int i=1;i<=p-1;i++)
        {
            res=res*(m-1)%MOD;
        }
        ans=res*C[p-1]%MOD;
        for(int j=p+1;j<=n;j++)
        {
            res=res*(m-1)%MOD;
            ans=(ans+res*C[j-1]%MOD)%MOD;
        }
        printf("%lld\n",ans);
        return 0;
    }
#include<bits/stdc++.h>
#define ll long long
#define re register
#define ull unsigned ll
using namespace std;
inline int read(){
	int s=0,t=1;
	char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')t=-1;ch=getchar();}
	while(ch>='0'&&ch<='9')s=(s<<3)+(s<<1)+(ch^48),ch=getchar();
	return s*t;
}
const int N=3e5+5;
const int P=1e9+7;
char s[N];
int n,Ans,f[N][3][3];
int Mod(int x){return x>=P?x-P:x;}
void Mod(int &x,int y){(x+=y)>=P?x-=P:0;}
int main(){
//	freopen(".in","r",stdin);
//	freopen(".out","w",stdout);
	scanf("%s",s+1),n=strlen(s+1);
	f[0][0][0]=1;
	for(int i=1,tp=0;i<=n;i++){
		for(int x=0;x<=2;x++)
		for(int y=0;y<=2;y++)
		if((tp=f[i-1][x][y])){
			if(s[i]!='0'){//1
				if(y==0)Mod(f[i][min(2,x+1)][0],tp);
				else Mod(f[i][x][y-1],tp);
			}
			if(s[i]!='1'){//0
				if(y==2)Mod(f[i][x][1],tp);
				else Mod(f[i][x][y+1],tp);
			}
		}
	}
	for(int x=0;x<=2;x++)
	for(int y=0;y<=2;y++)if(x>=y)Mod(Ans,f[n][x][y]);
	printf("%d",Ans);
	return 0;
}
