l = [int(input()) for i in range(5)]
l_d = []
for i in l:
  if i % 10 == 0:
    l_d.append(0)
  else:
    n = (i//10+1)*10 - i
    l_d.append(n)
c = []
for i, j in zip(l_d, l):
  c.append([i, j])
  
from operator import itemgetter
c.sort(key=itemgetter(0))
a, b = zip(*c)
d = list(b)
for n, i in enumerate(list(d[:-1])):
  if i % 10 == 0:
    continue
  else:
    d[n] = (i//10+1)*10    
sum(d)