#include <bits/stdc++.h>
using namespace std;

#define for_(i,a,b) for(int i=a;i<b;++i)

int n, m, a[10];
string id;

int dp[2][10];

void solve() {	
	memset(dp, 0, sizeof(dp));
	dp[0][0] = 1;
	
	for_(i,0,n) {
		int ii = n - i - 1, nw = i % 2, nx = (i + 1) % 2;
		
		for_(j,0,10) dp[nx][j] = 0;
		
		for_(j,0,10) {
			if (id[ii] == '*') {
				for_(k,0,m) {
					int v = a[k] * (i % 2 + 1);
					int jj = ( j + (v % 10) + (v / 10) ) % 10;
					dp[nx][jj] += dp[nw][j];
				}
			} else {
				int v = (id[ii] - '0') * (i % 2 + 1);
				int jj = ( j + (v % 10) + (v / 10) ) % 10;
				dp[nx][jj] += dp[nw][j];
			}
		}
	}
	
	cout << dp[n % 2][0] << endl;
}

int main() {
	cin >> n >> id >> m;
	for_(i,0,m) cin >> a[i];
	solve();
	return 0;
}