#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <string>
#include <cstdio>
#include <cmath>
using namespace std;
#define F(i,n) for(int i=0; i<(int)(n); i++)
#define BW(x,a,b) ( a <= x && x < b )
#define SV(v,w) { F(i,v.size()) cout << setw(w) << v[i]; cout << endl;}
int dx[] = {1,-1,0,0}, dy[] = {0,0,-1,1};
int debug_counter = 0;
#define debug_print printf("debug_print: %d\n", ++debug_counter)
 
int main(){
  string line;
  char dir, now;
  while( cin >> line && line != "#" ){
    now = 'A';
    F( i, line.size() ){
      dir = line.at(i);
      if( now == 'A' ){
	if( dir == '0' ){ now = 'X'; }
	if( dir == '1' ){ now = 'Y'; }
      } else if( now == 'X' ){
	if( dir == '0' ){ now = 'O'; }
	if( dir == '1' ){ now = 'Z'; }
      } else if( now == 'Y' ){
	if( dir == '0' ){ now = 'X'; }
	if( dir == '1' ){ now = 'O'; }
      } else if( now == 'Z' ){
	if( dir == '0' ){ now = 'W'; }
	if( dir == '1' ){ now = 'B'; }
      } else if( now == 'W' ){
	if( dir == '0' ){ now = 'B'; }
	if( dir == '1' ){ now = 'Y'; }
      } else if( now == 'B' ){
	if( dir == '0' ){ now = 'Y'; }
	if( dir == '1' ){ now = 'X'; }
      } else if( now == 'O' ){
	if( dir == '0' ){ now = 'O'; }
	if( dir == '1' ){ now = 'O'; }
      }
    }
    if( now == 'B' ){ cout << "Yes" << endl; }
    else{ cout << "No" << endl; }
  }
}