yf={"A":1,"B":2,"C":3,"D":4} a,b,c,d,e=map(str,raw_input().strip().split()) s=int(yf[a])+int(yf[b])+int(yf[c])+int(yf[d])+int(yf[e]) print s