a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
T=[a,b,c,d,e]
A=list(map(lambda x:x%10,T))
S=list(map(lambda y:y//10,T))
count=0
B=[]
for j in range(5):
    if A[j]!=0:
        count+=1
        B.append(A[j])
if len(B)==0:
    print(10*(sum(S)+count-1))
else:
    print(10*(sum(S)+count-1)+min(B)) 