a = [[0,0],[0,0],[0,0],[0,0],[0,0]]
for i in range(5):
    a[i][0] = int(input())


time = 0

for j in range(5):
    a[j][1] = 10-(a[j][0]%10)

for k in range(5):
    a.sort(key=lambda x:x[0])
    a.sort(key=lambda x:x[1])


for l in range(4):
  if a[l][1] == 10:
    time += a[l][0]
  else:
    time += (a[l][0]+(10-(a[l][0]%10)))
time += a[4][0]
print(time)