import sys
from itertools import permutations

a = [int(i) for i in sys.stdin]

b = [(list(map(int, str(k)))[-1], i) for i, k in enumerate(a)]

indexes = [i for i, (x, y)in enumerate(b) if x == 0]
d = 0
for i in sorted(indexes)[::-1]:
  d += a[i]
  b.pop(i)
b.sort()
c = b[::-1]

for i, k in c[:-1]:
  if i >= 5:
    d += round(a[k], -1)
  else:
    d += (round(a[k], -1) + 10)
d += a[c[-1][1]]
print(d)