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

n=10
decision = 0
amari = [A%10,B%10,C%10,D%10,E%10]
for i in range(5):
    if (n>amari[i])and(amari[i]>0):
        n=amari[i]
        decision=i


output = 10*int((A-0.5)//10)+10*int((B-0.5)//10)+10*int((C-0.5)//10)+10*int((D-0.5)//10)+10*int((E-0.5)//10) + 40 + amari[decision]

print(int(output))