A,B,C,D,E = [int(input()) for _ in range(5)]
a = A % 10
b = B % 10
c = C % 10
d = D % 10
e = E % 10
if a == b == c == d == e == 0:
  print(A+B+C+D+E)
else:
  print(A-a+B-b+C-c+D-d+E-e-max(10-a,10-b,10-c,10-d,10-e))