#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<set>
#include<algorithm>
#include<map>
#include<vector>
#include<queue>
#include<iostream>
#include<string>
#include<cmath>
#define N 200010
#define FOR(i,a,b) for(i=(a);i<=(b);i++)
#define ROF(i,a,b) for(i=(a);i>=(b);i--)
typedef long long LL;
using namespace std;
struct mat
{
int a[21][21];
void init()
{
memset(a,0,sizeof(a));
}
}m0,m1;
int n,m,K,P[N],B[N];
mat operator *(mat A,mat B)
{
mat c;c.init();int i,j,k;
FOR(i,0,m-1)
FOR(j,0,m-1)
FOR(k,0,m-1)
c.a[i][j]=(c.a[i][j]+A.a[i][k]*B.a[k][j]%K)%K;
return c;
}
void init()
{
int i,j,old_i;
P[1]=0,j=0;
FOR(i,2,m)
{
while ((j>0)&&(B[j+1]!=B[i])) j=P[j];
if (B[j+1]==B[i]) j++;
P[i]=j;
}
}
mat powmod(int n)
{
if (n==0) return m0;
if (n==1) return m1;
mat tmp=powmod(n/2);
if (n&1) return tmp*tmp*m1;
return tmp*tmp;
}
int main()
{
scanf("%d%d%d\n",&n,&m,&K);
int i,j;
FOR(i,1,m)
{
int c=getchar();
B[i]=c-'0';
}
init();m1.init();
FOR(i,0,m-1) FOR(j,0,9)
{
int tmp=i;
while (tmp&&B[tmp+1]!=j) tmp=P[tmp];
if (B[tmp+1]==j) m1.a[i][tmp+1]=1;
else m1.a[i][0]++;
}
m0.init();m0.a[0][0]=1;
mat res=m0*powmod(n);
LL ans=0;
FOR(i,0,m-1) ans+=res.a[0][i],ans%=K;
printf("%lld\n",ans);
}