# i(0<=i)桁目の数字s_iの場合に増えるゼロの個数
# s_i * i + s_i * (i-1桁目が9の場合に増えるゼロの個数)
# = s_i * (i + k_i-1)
# = s_i * (i + (10 * (i - 1 + k_i-2 ))
# 
# j桁目が9の時に増えるゼロの個数k_j
# j k_j
# 0 0
# 1 10
# 2 10 * (2 + k_1) = 10 * 12
# 3 10 * (3 + k_2) = 10 * (3 + 10 * 12)
# j 10 * (j + k_j-1)
def k(j)
  return 0 if j == 0
  10 * (j + k(j-1))
end

def c(i, s_i)
  return 0 if i == 0
  x = s_i < 5 ? s_i : s_i + 1
  x * (i + k(i-1))
end

n = gets.chop.to_i

step = 0
count = 0
loop do
  count += c(step, n % 10)
  n = n / 10
  step += 1
  break if n == 0
end

puts count
