n = gets.chomp.split('').map(&:to_i)
number = 0
for i in 1..n.length
    if n.length == i
        if i % 2 == 1
            for num in 1..i
                number += n[num - 1] * (10 ** (i - num))
            end
            for num in 1..i / 2
                i = i - 2 > 0 ? i : 2
                number -= 9 * (10 ** (i - 2 * num))
            end
            puts number
        else
            for num in 1..i / 2
                number += 9 * (10 ** (i - 2 * num))
            end
            puts number
        end
        break
    end
end