import itertools

def f(x):
    if x[1] == 0:
        return x[1]
    else:
        return 10 -x[1] 

a = []
a.append(int(input()))
a.append(int(input()))
a.append(int(input()))
a.append(int(input()))
a.append(int(input()))


b = []

for i in a:
    c = i - (int(i / 10) * 10) 
    b.append((i, c))

b.sort(key=f)

x = 0

for i in b:
    x += i[0]
    if i[1] != 0:
        x += 10 - i[1]
    l = 10 - i[1]
x -= l

print(x)
    
