a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
T = [a, b, c, d, e]
A = []
max_tt = 0
for i in range(len(T)):
  t = (T[i]//10 + 1) * 10
  A.append(t)
  tt = t - T[i]
  if max_tt < tt:
    max_tt = tt
print(sum(A)-max_tt)