zm=map(str, raw_input().strip().split()) s=0 for i in zm : if i=="A": s=s+1 elif i=="B": s=s+2 elif i=="C": s=s+3 else: s=s+4 print s