A=int(input())
B=int(input())
C=int(input())
D=int(input())
E=int(input())

mono = [A,B,C,D,E]
amari = [A%10,B%10,C%10,D%10,E%10]
minamari = min(amari)
jun = []

for i in range(5):
    if amari[i] == 0:
        jun.insert(0,mono[i])
    elif (amari[i] > 0)and(amari[i]==minamari):
        jun.insert(-1,mono[i]//10+10)
    elif (amari[i] > 0)and(amari[i]!=minamari):
        jun.insert(-2,mono[i]//10+10)
        
output = sum(jun)
print(int(output))