def calc(k, pos)
  if pos == 1
    return k
  else
    return k < 5 ? k * 2 : k * 2 % 10 + 1
  end
end

Odd = (0..9).map{ |i| calc(i, 1) }
Even = (0..9).map{ |i| calc(i, 0) }

n = gets.to_i
s = gets.chomp.reverse
m = gets.to_i
num = gets.split.map(&:to_i)
sum = 0
o, e = 0, 0
n.times do |i|
  if s[i] != '*'
    sum += i.odd? ? Odd[s[i].to_i] : Even[s[i].to_i]
  else
    i.odd? ? o += 1 : e += 1
  end
end

count = 2.times.map{ [0] * 10 }
if o >= 1
  m.times{ |i| count[0][Odd[num[i]]]+= 1 }
  o -= 1
else
  m.times{ |i| count[0][Even[num[i]]] += 1 }
  e -= 1
end

o.times do |i|
  10.times do |j|
    m.times do |k|
      count[1][(j + Odd[num[k]]) % 10] += count[0][j]
    end
  end
  count[0] = count[1].dup
  count[1].fill(0)
end
e.times do |i|
  10.times do |j|
    m.times do |k|
      count[1][(j + Even[num[k]]) % 10] += count[0][j]
    end
  end
  count[0] = count[1].dup
  count[1].fill(0)
end

p count[0][(10 - (sum % 10)) % 10]