import math

A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())
num_lst = [A, B, C, D, E]

mods = [n % 10 for n in num_lst]
mod = min(m for m in mods if m != 0)
mod_i = mods.index(mod)

times = sum(math.ceil(v/10)*10 for i, v in enumerate(num_lst) if i != mod_i)
print(times + num_lst[mod_i])