in_list = []
out = 0
modLast = 10
p1 = -1
for i in range(5):
  in_list.append(int(input()))
in_list.sort();
for i in in_list:
  if i % 10 != 0:
    out += i + 10 - i % 10
  else:
    out += i
  if p1 == i // 10 or i % 10 < modLast:
    modLast = i % 10
print(out - 10 + modLast)