s=list(input().split()) i=0 S=0 while i<len(s): if s[i]=="A": S=S+1 elif s[i]=="B": S=S+2 elif s[i]=="C": S=S+3 else: S=S+4 i=i+1 print(S)