A = [int(input()) for i in range(5)]
j = []
for i in A:
  c = 0
  while i >= c:
    c += 10
  j.append(c-i)
ind = [j.index(i) for i in sorted(j)]
time = A[ind[-1]]
d = 0
for i in sorted(j):
  if d==4: break
  c = 0
  while A[j.index(i)] >= 10:
    c += 10
  time += c
  d += 1
print(time)