I=input N,M=map(int,I().split()) S=I() a=c=w=b=0 for i in range((N+M)*2): if S[i]<"C":a+=1 elif S[i]>"C": w+=1 b+=M+w