#include <string>
#include <iostream>
using namespace std;
string s;
int main() {
	while(cin >> s, s != "#") {
		int p = 0, f = 0;
		for(int i = 0; i < s.size(); i++) {
			switch(p) {
				case 0: if(s[i] == 48) p = 1; else p = 2; break;
				case 1: if(s[i] == 48) f = 1; else p = 3; break;
				case 2: if(s[i] == 48) p = 1; else f = 1; break;
				case 3: if(s[i] == 48) p = 4; else p = 5; break;
				case 4: if(s[i] == 48) p = 5; else p = 2; break;
				case 5: if(s[i] == 48) p = 2; else p = 1; break;
			}
		}
		puts(p == 5 && f == 0 ? "Yes" : "No");
	}
}