data = []

for _ in range(5):
  data.append(int(input()))

# 10の倍数から1番離れてる数がどれか
min = 99
margin = []
for d in data:
  tmp = d % 10
  if tmp != 0:
    margin.append(10 - tmp)
  if tmp != 0 and min > tmp:
    min = tmp

# print(data)
# print(margin)
# print(min)
print(sum(data) + sum(margin) - (10-min))
