#!/usr/bin/env python3
# Name: Joseph Olivier
class EvaluateProbability:
	def __init__(self,n,sequence,probabilities):
		#Takes in n,the sequence, and an array of probability values
		self.n = int(n)
		self.sequence = sequence
		self.probabilities = probabilities
		self.listofSubstringProbabilities = list()

	def classController(self):
		#For each GCContent in the array of probability values, calculate the probability of
		#Generating the specific sequence
		for GCContent in self.probabilities:
			self.calculateProbability(float(GCContent))
		#For each probability, generated by the previous function, calculate the number of
		#Occurences that are expected to occur in a sequence of a given length.
		for precurosryProbability in self.listofSubstringProbabilities:
			self.calculateActualandPrint(precurosryProbability)
		print("\n")
	
	def calculateProbability(self,GCContent):
		#Probability of getting a GorC in 1/2 the GCContent
		#Probability of getting an AorT calculated in the same way
		probabilityofGorC = float(GCContent/2)
		probabilityofAorT = float((1-GCContent)/2)
		currentProbability = 1

		#Calculate the probability of the substring given the GC content.
		for i in range(0,len(self.sequence)):
			if self.sequence[i] in "AT":
				currentProbability*=probabilityofAorT
			else:
				currentProbability*=probabilityofGorC
		#Append substringProbability to the listofSubstringProbabilities
		self.listofSubstringProbabilities.append(currentProbability)
	
	def calculateActualandPrint(self,probability):
		#The probability == the probability of the subsequence * 
		#(total amount of times that sequence can occur given the length)
		probability*=(self.n-len(self.sequence)+1)
		#Print tab-separated answers
		print(probability,end="\t")

class FileReader:
	#Simple filereader to fit this input.
	#First line is n value, second line is the actual sequence,
	#And the last line is the probabilities
	#Returns two strings and a list.
	def __init__(self,file):
		self.file = file

	def reader(self):
		n = self.file.readline().rstrip()
		sequence = self.file.readline().rstrip().upper()
		probabilities = self.file.readline().rstrip().split()
		return n,sequence,probabilities
def main():
	import sys
	n,sequence,probabilities = FileReader(sys.stdin).reader()
	EvaluateProbability(n,sequence,probabilities).classController()
main()

