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

l = [A,B,C,D,E]
l = sorted(l)
# print(l)
ans = 0
tl = []
for v in l:
    temp = v % 10
    while temp > 10:
        temp = v % 10
    if temp == 0:
        temp = 100
    tl.append(temp)
# print(tl)
tt = [tl,l]

a = tl.index(min(tl))
# print(l)

for i,v in enumerate(l):
    if i != a:
        temp = v % 10
        temp = 10 - temp + v
        ans = ans + temp
    else:
        ans = ans + v

print(ans)