a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
li = [a, b, c, d, e]
li_2 = []
d = 10
count = 0
adr = 0
for i in li:
    li_2.append(i % 10)
for i in li_2:
    if i < d and i != 0:
        d = i
        ans = adr
    adr += 1
if d == 10:
    d = 0
for i in range(5):
    if i != ans and li_2[i] != 0:
        count += (li[i] - li_2[i] + 10)
    elif i != ans and li_2[i] == 0:
        count += li[i]
count += li[ans]
print(count)
