num = 0
l = [input() for i in range(5)]
for i, j in enumerate(l,0):
  if j[-1] == "0":
    num += int(j)
    l.pop(i)
l1 = [int(i) for i in l]
l2 = [10-int(str(i)[-1]) for i in l1]
a = l2.index(max(l2))
for i, j in enumerate(l1,0):
  if i != a:
    num += j+l2[i]
  else:
    num += j
print(num)