import math

input_mins = []
input_nums = 5
total_mins = 0

for i in range(input_nums):
  input_min = input()
  input_mins.append(input_min[::-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_mins += input_mins[i]
  else:
    total_mins += input_mins[i]+(10-amari)

total_mins += input_mins[-1]
print(total_mins)
