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

ans = 0
if int(l[0][-1]) <= int(l[1][-1]):
  min_val = l[0]
  ans += (-(-int(l[1])//10))*10
else:
  min_val = l[1]
  ans += (-(-int(l[0])//10))*10
  
for i in range(2, 5):
  if min_val[-1] <= int(l[i][-1]):
    ans += (-(-int(l[i])//10))*10
  else:
    ans += (-(-min_val//10))*10
    min_val = l[i]
    
ans += (-(-min_val//10))*10
print(ans)