import sys
input = lambda: sys.stdin.readline().rstrip()

order = [int(input()) for _ in range(5)]

extra_list = []

tmp = 11
for i in range(5):
    extra = order[i] % 10
    if extra != 0:
        if extra < tmp:
            tmp = extra
            extra_list.append(i)

ans = 0
for i in range(5):
    if i == extra_list[-1]:
        continue
    if order[i] % 10 == 0:
        ans += order[i]
    else:
        ans += 10 * (order[i] // 10 + 1)

print(ans + order[extra_list[-1]])