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