lis = [str(input()) for i in range(5)]

m = 10
ss = 0
for i in range(5):
      if 0 != int(lis[i][-1]) < m:
            idx = i
            m =  int(lis[i][-1])
            ss = lis[i]

for i in range(5):
      if int(lis[i][-1]) != 0:
            lis[i] = (int(lis[i])//10)*10 + 10
      else:
            lis[i] = int(lis[i])

lis[idx] = int(ss)

print(sum(lis))
