a=[]
for _ in range(5):
    a.append(int(input()))

#a = [ 29 ,20 ,7 ,35 ,120 ]
#a = [ 101 ,86 ,119 ,108 ,57 ]

def ofooo(n):
    return int(round(n+5.1, -1))

m=0
res = 0
for n in a:
    aa = ofooo(n)
    res += aa
    if m < aa-n:
        m = aa-n
print(res - m)
