def newdigit( keta, add, oldsum )
	if keta % 2 == 0 
		add2 = add * 2
		if add2 >= 10
			add2 = 1 + add2 % 10
		end
	else
		add2 = add
	end
	oldsum + add2
end

def checkdigit( adigit )
	sum = 0
	adigit.reverse.each_with_index{|e,i|
		add = e 
		if i % 2 == 1
			add = e * 2
			if add >= 0
				t = add / 10 + add % 10
				add = t
			end
		end
		sum += add
	}
#	puts "sum = #{sum}"
	if sum % 10 == 0 
		true
	else
		false
	end
end

def	setnums( endlevel,level, aryAst, numCandidate, aryCandidate,keta, digit)
#print "level = #{level} digit = #{digit} "
#p aryCheckNum

	if endlevel == level 
		if digit % 10 == 0
			$count += 1
		end
	else
		numCandidate.times{ |i|
			tempdigit = newdigit( keta-aryAst[level], aryCandidate[ i ],digit)
			setnums( endlevel, level + 1, aryAst, numCandidate,aryCandidate, keta, tempdigit)
		}
	end
end

def main
	n      = $stdin.gets.chomp.to_i
	strID  = $stdin.gets.chomp
	m      = $stdin.gets.chomp.to_i
	aryCandidate = $stdin.gets.chomp.split(/ /).map{|n| n.to_i}

	aryAst = Array.new
	aryCheckNum = Array.new

	digit = 0
	strID.split(//).each_with_index{ |e,i|
		if e == '*'
			aryAst << i
			aryCheckNum << '*'
		else
			aryCheckNum << e.to_i
			digit = newdigit( n-i, e.to_i, digit)
		end
	}

#start_time = Time.now
	$count = 0 
	setnums( aryAst.size, 0, aryAst, aryCandidate.size, aryCandidate, n, digit )
	p $count
#p "#{Time.now - start_time}s"
end
main
