#include<iostream>
#include<queue>
#include<algorithm>

using namespace std;

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

int calc(int from, int add, int t) {
  add *= t % 2 + 1;
  if (add > 9) add = add / 10 + add % 10;
  return (from + add) % 10;
}

int main() {
  int n, m;
  string str;
  cin >> n >> str >> m;
  vector<int> a(m);
  rep (i, m) cin >> a[i];
  int dp[10] ={};
  dp[0] = 1;
  reverse(str.begin(), str.end());
  rep (i, n) {
    int next[10] = {};
    rep (j, 10) {
      if (str[i] == '*') rep (k, m) next[calc(j, a[k], i)] += dp[j];
      else next[calc(j, str[i] - '0', i)] += dp[j];
    }
    rep (j, 10) dp[j] = next[j];
  }
  cout << dp[0] << endl;
  return 0;
}