bin = {
    0 => 0b0111111,
    1 => 0b0000110,
    2 => 0b1011011,
    3 => 0b1001111,
    4 => 0b1100110,
    5 => 0b1101101,
    6 => 0b1111101,
    7 => 0b0100111,
    8 => 0b1111111,
    9 => 0b1101111,
}

loop do
    n = gets.to_i
    break if n == -1
    x = 0 
    n.times do
        n = gets.to_i
        printf("%07b\n", x ^ bin[n])
        x = bin[n]
    end
end 