N = gets.chomp.to_i

if N % 2 == 1
  puts 0 
  exit
end

arr = [1]
18.times do |i|
  arr << arr[-1] * 9 + i + 2
end

length = 0
count = 0
tmp = N
N.times do
  tmp = tmp / 10
  n = tmp % 10
  count += n * arr[length]
  break if tmp == 0
  length += 1
end

puts count