a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())

last = 9
if a % 10 != 0:
  last = a
elif (b % 10 != 0 and last % 10 > b % 10):
  last = b
elif (c % 10 != 0 and last % 10 > c % 10):
  last = c
elif (d % 10 != 0 and last % 10 > d % 10):
  last = d
elif (e % 10 != 0 and last % 10 > e % 10):
  last = e
else:
  last = a
  
print(-(-a // 10) * 10 - (-b // 10) * 10 -(-c // 10) * 10 - (-d // 10) * 10 -(-e // 10) * 10 + last + (-last // 10) * 10)