### constant

SEGS = [
  0b0111111, 0b0000110, 0b1011011, 0b1001111, 0b1100110,
  0b1101101, 0b1111101, 0b0100111, 0b1111111, 0b1101111,
]

### main

while true
  n = gets.strip.to_i
  break if n < 0

  disp = 0

  n.times do
    d = gets.strip.to_i

    cmd = disp ^ SEGS[d]
    printf("%07b\n", cmd)

    disp = SEGS[d]
  end
end