input_mins = []
input_nums = 5
total_mins = []
total_min = 0

for i in range(input_nums):
  input_mins.append(input()[::-1])

input_mins.sort(reverse=True)

for i in range(input_nums):
  input_mins[i] = int(input_mins[i][::-1])

for i in range(input_nums-1):
    amari = input_mins[i] % 10
    if amari == 0:
      total_min += input_mins[i]
    else:
      total_min += input_mins[i]+(10-amari)

total_min += input_mins[-1]

print(total_min)