num = [int(input()) for _ in range(5)]
a = []

for i in range(5):
  if num[i]%10 == 0:
    a.append(10)
  else:
    a.append(num[i]%10)
    
num_min = min(a)
index_min = a.index(num_min)

for j in range(5):
  if num[j]%10 != 0:
    num[j] = num[j]//10*10 + 10

ans = sum(num) - (num_min//10 + 10) + num_min
print(ans)