import math
n = [int(input()) for i in range(5)]
temp = 9
answer = 0
for i in n:
  last_dig = i % 10
  if last_dig <= temp:
    temp = last_dig
  answer += math.ceil(i/10)*10
print(answer - 10 + temp)
