#include <iostream>
#include <string>
using namespace std;

int main(){
	int next[7][2] = {{1,3},{6,2},{4,5},{1,6},{5,3},{3,1},{6,6}};
	string s;
	while(cin >> s){
		if(s == "#") break;
		int pos = 0;
		for(int i = 0;i < s.length();i++){
			pos = next[pos][s[i] - '0'];
		}
		if(pos == 5) cout << "Yes" << endl;
		else cout << "No" << endl;
	}
	return 0;
}