dish = [int(input()) for d in range(5)]
diff = 0
ans = []
for index,d in enumerate(dish):
  if d % 10 == 0:
    ans.append(d)
  else:
    d10 = ((d //10) +1) * 10
    ans.append(d10)
    tmp = d10-d
    if diff < tmp:
      diff = tmp
      last= index
    
del ans[last]
print(sum(ans)+dish[last])

