#include<cstdio>
#include<iostream>
#include<queue>
#include<string>
#include<vector>

using namespace std;
typedef pair<int,int> P;
struct edge{
	int t,c;
	edge(int c,int t):c(c),t(t){}

};
string str;
vector<edge> G[6];

bool dijk(){
	queue<P> que;
	que.push(P(0,0));
	while(que.size()){
		P p=que.front();
		que.pop();
		int v=p.second,c=p.first;
		if(c==str.size() && v==5)return true;
		if(c>str.size())continue;
		for(int i=0;i<G[v].size();i++){
			edge e=G[v][i];
			if(e.c==str[c]-'0')que.push(P(c+1,e.t));
		}
	}
	return false;
}

int main(void){
	G[0].push_back(edge(0,1));
	G[0].push_back(edge(1,2));
	G[1].push_back(edge(1,3));
	G[2].push_back(edge(0,1));
	G[3].push_back(edge(0,4));
	G[3].push_back(edge(1,5));
	G[4].push_back(edge(1,2));
	G[4].push_back(edge(0,5));
	G[5].push_back(edge(0,2));
	G[5].push_back(edge(1,1));
	while(1){
		cin >> str;
		if(str=="#")break;
		if(dijk())printf("Yes\n");
		else printf("No\n");
	}
	
	return 0;
}