a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())

num_list = [a, b, c, d, e]
last_digit = []
for i in num_list:
    d = str(i)
    digit = d[-1]
    digit = int(digit)
    last_digit.append(digit)

min = 10000
for j in last_digit:
    if j < min and j != 0:
        min = j
last_digit[last_digit.index(min)] = 0

for k in range(len(num_list)):
    if last_digit[k] != 0:
        num_list[k] += 10-last_digit[k]

ans = 0
for l in num_list:
    ans += l

print(ans)