a = []

for x in range(5):
    l = int(input())
    a.append(l)
    
b = []
b0 = []
for i in a:
    if i % 10 == 0:
        b0.append(i)
    else:
        b.append(i)

c = []
c0 = []
for n in b:
    div ,mod = divmod(n,10)
    c.append(mod)
    c0.append(div)

mm  = min(c)
cc = sum(c0) + (len(c) -1)
dd = sum(b0)

print(cc*10 + dd + mm)