import math

i = []
for l in range(5):
    i.append(int(input()))
m = -1
l = 0
for x in range(5):
    if m < (10 - i[x] % 10) and 10 - i[x] % 10 != 10:
        if x != 0:
            l += math.ceil(i[mx] / 10) * 10
        m = 10 - i[x] % 10
        mx = x
    else:
        l += math.ceil(i[x] / 10) * 10
l += i[mx]
print(l)
