x = int(input()) str1 = input() if "B" in str1 and "C" not in str1: x *= 0.8 elif "C" in str1 and "B" not in str1: x *= 0.7 elif "B" in str1 and "C" in str1: x *= 0.6 print("%d"%x)