#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main(void) {
	int ma[10] = {0},mb[10] = {0},li[10] = {0},pm = 0,i,sl,tl,uko = 0,uke = 0,j,k,a,l;
	char s[131072];
	scanf("%d",&sl);
	scanf("%s",s);
	scanf("%d",&tl);
	for(i = 1;i <= tl;i++){
	    scanf("%d",&a);
	    li[a]++;
	}
	for(i = 0;i < sl;i++){
		if(s[i] == '*'){
			if(i % 2 != 0){
				uke++;
			}
			else{
				uko++;
			}
		}
		else{
			if(i % 2 != 0){
				a = (s[i] - 48) * 2;
				pm+=(a / 10 + a % 10);
			}
			else{
				pm+=(s[i] - 48);
			}
		}
	}
	pm = pm % 10;
	ma[pm]++;
	for(i = 1;i <= uke;i++){
		for(j = 0;j <= 9;j++){
			mb[j] = 0;
		}
		for(j = 0;j <= 9;j++){
			if(li[j] != 0){
				for(k = 0;k <= 9;k++){
				    l = j * 2;
					mb[ (l / 10 + l % 10 + k) % 10]+=ma[k];
				}
			}
		}
		for(j = 0;j <= 9;j++){
			ma[j] = mb[j];
		}
	}
	for(i = 1;i <= uko;i++){
		for(j = 0;j <= 9;j++){
			mb[j] = 0;
		}
		for(j = 0;j <= 9;j++){
			if(li[j] != 0){
				for(k = 0;k <= 9;k++){
					mb[ (j + k) % 10]+=ma[k];
				}
			}
		}
		for(j = 0;j <= 9;j++){
			ma[j] = mb[j];
		}
	}
	printf("%d\n",ma[0]);
	return 0;
}