p = 9
c = 0
A = []
for _ in range(5):
  A.append(int(input())) 
for a in A:
  if a % 10 == 0:
    a = 9
  p = min(p,a%10)
  if a%10 == 0:
    pass
  else:
    a = (((a // 10)+1)*10)
  c += a
print(c+p-10)