### constant

START = 0
GOAL = 5

NBRS = [[1, 2], [nil, 3], [1, nil], [4, 5], [5, 2], [2, 1]]

### main

while true
  line = gets.strip
  break if line == '#'

  pos = START
  for rt in line.split('').map{|s| s.to_i}
    pos = NBRS[pos][rt]
    break if pos.nil?
  end

  puts (pos == GOAL ? 'Yes' : 'No')
end