import math
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())

f=0
g=[a%10,b%10,c%10,d%10,e%10]
saisyo=10

f+=math.ceil(a/10)*10
f+=math.ceil(b/10)*10
f+=math.ceil(c/10)*10
f+=math.ceil(d/10)*10
f+=math.ceil(e/10)*10

for i in g:
    if 0<i<saisyo:
        saisyo=i

if saisyo==10:
    saisyo=0
        

print(f-10+saisyo)
