a = []
for i in range(5):
  a.append(int(input()))

b = [[i, i%10] for i in a]

b.sort(key=lambda x:x[1])
s=b[0][0]
for i in range(1,5):
  s += b[i][0] if b[i][1] == 0 else (b[i][0]+10)//10*10
print(s)