#include <cstdio>
#include <cstring>
#include <climits>
#include <algorithm>
const int MAX_N = 1e9;
const int MAX_M = 20;
struct Matrix {
int a[MAX_M + 5][MAX_M + 5];
int n, m;
Matrix(int n, int m, bool unit = false) {
this->n = n;
this->m = m;
memset(a, 0, sizeof(a));
if (unit) {
for (int i = 0; i <= n; i++) a[i][i] = 1;
}
}
};
int n, m, mod;
char s[MAX_M + 1];
int next[MAX_M + 1];
Matrix operator*(const Matrix &a, const Matrix &b) {
Matrix res(a.n, b.m, false);
for (int i = 0; i < a.n; i++) {
for (int j = 0; j < b.m; j++) {
for (int k = 0; k < a.m; k++) {
(res.a[i][j] += a.a[i][k] * b.a[k][j]) %= mod;
}
}
}
return res;
}
Matrix pow(Matrix a, int n) {
Matrix res(a.n, a.n, true);
for (; n; n >>= 1, a = a * a) if (n & 1) res = res * a;
return res;
}
inline void getNext() {
int j = 0;
for (int i = 2; i <= m; i++) {
while (j > 0 && s[j + 1] != s[i]) j = next[j];
if (s[j + 1] == s[i]) j++;
next[i] = j;
}
}
int main() {
scanf("%d %d %d", &n, &m, &mod);
scanf("%s", s + 1);
getNext();
Matrix shift(m, m, false);
Matrix origin(m, 1, false);
for (int i = 0; i < m; i++) {
for (int j = 0; j <= 9; j++) {
int k = i;
while (k > 0 && s[k + 1] - '0' != j) k = next[k];
if (s[k + 1] - '0' == j) k++;
(shift.a[k][i] += 1) %= mod;
}
}
origin.a[0][0] = 1;
Matrix res = pow(shift, n) * origin;
int ans = 0;
for (int i = 0; i < m; i++) (ans += res.a[i][0]) %= mod;
printf("%d\n", ans);
return 0;
}