#key => [route0, route1]
hash = {"A"=>["X", "Y"],
		"W"=>["B", "Y"],
		"X"=>["", "Z"],
		"Y"=>["X", ""],
		"Z"=>["W", "B"],
		"B"=>["Y", "X"]
}

while (input = $stdin.gets.chomp) != "#" do
	pos = "A"
	input.split("").map(&:to_i).each do |i|
		if hash[pos][i] != ""
			pos = hash[pos][i]
		else
			break
		end
	end
	
	if pos == "B"
		puts "Yes"
	else
		puts "No"
	end
end