a,b,g,d,e=raw_input().split() list=[a,b,g,d,e] i=c=0 while i<5: if list[i]=='A': c=c+1 elif list[i]=='B': c=c+2 elif list[i]=='C': c=c+3 elif list[i]=='D': c=c+4 i=i+1 else: print c