import math
n = [int(input()) for i in range(5)]
m = [n[i]%10 for i in range(5)]
l = [math.ceil(n[i]/10)*10 for i in range(5)]
if min(m) != 0:
  print(sum(l) -10 + min(m))
else:
  print(sum(l) + min(m))