n=int(input()) S=input() A=list(map(int,input().split())) q=int(input()) K=list(map(int,input().split())) vsum=[0]*n vsum[0]=A[0] cnt=[0]*n for i in range(n): if S[i]=="E": cnt[i]=1 if i!=0: vsum[i]=vsum[i-1]+A[i] cnt[i]+=cnt[i-1] import bisect for i in range(q): temp=bisect.bisect_right(vsum,K[i])-1 if temp==-1: print(0) else: print(cnt[temp])