a=str(input())
b=str(input())
c=str(input())
d=str(input())
e=str(input())

#menu=[int(a[-1]),int(b[-1]),int(c[-1]),int(d[-1]),int(e[-1])]
menu=[a[-1],b[-1],c[-1],d[-1],e[-1]]
menu.sort()
while menu[0]=="0":
    menu.remove("0")
iti=int(menu[0])

marume=10 * (len(menu)-1)


time=0
kuso=[a,b,c,d,e]

for temp in kuso:
    if len(temp)==2:
        time+=int(temp[-2])*10
    elif len(temp)==3:
        time+=100 + 10*int(temp[-2])
    else:
        time+=0
        
print(iti + marume +time)