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

typedef pair<int,int>P;
const int S = 0;
const int G = 5;
P Gr[6];

void make(){

  Gr[0] = P(2,1);
  Gr[1] = P(2,-1);
  Gr[2] = P(-1,3);
  Gr[3] = P(4,5);
  Gr[4] = P(5,1);
  Gr[5] = P(1,2);
}

bool solve(string str){
  int now = S;
  for(int i = 0 ; i < str.size() ; i++){
   if(str[i] == '0'){
      if(Gr[now].first == -1)return false;
      now = Gr[now].first;
    }
    else {
      if(Gr[now].second == -1)return false;
      now = Gr[now].second;
    }
  }
  return now == G;
}

int main(){
  make();
  string str;
  while(cin >> str,str != "#")cout << (solve(str)?"Yes":"No") << endl;
  return 0;
}