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

m = 123
sum = 0

for i in range (0,5):
  sum += (a[i]//10)*10
  if a[i]%10 != 0:
    sum += 10
    m = min(m,a[i]%10)
if min != 123:
  print(sum+m-10)
else:
  print(sum)