def tenth(a):
  temp = a
  while True:
    if temp % 10 == 0:
      return temp
    else:
      temp += 1

li = list()
ans = 0

for i in range(5):
  li[i] = int(input())
  ans += tenth(li[i])
  li[i] = tenth(li[i]) - li[i]
  
ans -= min(li)

print(ans)

