typedef long long ll;

#define REP(i,n) for(int i=0; i<(int)(n); i++)

#include <queue>
#include <iostream>
#include <cstdio>
inline int getInt(){ int s; scanf("%d", &s); return s; }

#include <set>
using namespace std;

ll dp[100001][10];
int dbl[10] = {
  0, 2, 4, 6, 8, 1, 3, 5, 7, 9
};

int main(){
  const int n = getInt();
  string s;
  cin >> s;

  const int m = getInt();
  vector<int> a(10);
  REP(i,m) a[getInt()] = 1;

  dp[0][0] = 1;
  REP(i,n) REP(j,10){
    REP(k,10) if((s[i] == '*' && a[k]) || s[i] == '0' + k){
      int next = j;
      if((n - i) % 2 == 0){
	next += dbl[k];
      }else{
	next += k;
      }
      dp[i + 1][next % 10] += dp[i][j];
    }
  }

  cout << dp[n][0] << endl;

  return 0;
}