### main

n = gets.to_i
id = gets.strip

m = gets.to_i
as = gets.split.map(&:to_i)
a2s = as.map{|a| (a * 2) / 10 + (a * 2) % 10}

sum = 0
asts = []
for i in (0...n)
  if id[n - 1 - i] != '*'
    d = id[n - 1 - i].to_i
    sum += (i & 1) == 0 ? d : (d * 2) / 10 + (d * 2) % 10
  else
    asts << i
  end
end

nasts = asts.length

dp = Array.new(nasts + 1){Array.new(10){0}}
dp[0][sum % 10] = 1

for i in (0...nasts)
  i0 = asts[i]
  for j in (0...m)
    ai0 = (i0 & 1) == 0 ? as[j] : (as[j] * 2) / 10 + (as[j] * 2) % 10
    for k in (0...10)
      dp[i + 1][(k + ai0) % 10] += dp[i][k]
    end
  end
end

puts dp[nasts][0]