li = []
lis = []
time = 0
for i in range(5):
    li.append(int(input()))
    lis.append(li[i] % 10)
last = lis.index(min(lis))
for i in range(5):
    if i == last:
        continue
    elif lis[i] == 0:
        time += li[i]
    elif 1 <= li[i] <= 9:
        time += 10
    else:
        time += int(li[i] / 10) * 10 + 10
print(time + li[last])