#include<iostream>
#include<cmath>
#include<string>
#include<vector>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<algorithm>
#include<utility>
#include<bitset>
#include<climits>
#include<cstdio>
#include<cassert>
using namespace std;


vector<pair<int,int> > edge;
enum hogehoge{
  A=0,B=1,W=2,X=3,Y=4,Z=5
};
void make_map(){
  pair<int,int> tmp;
  tmp.first=X;//a
  tmp.second=Y;
  edge.push_back(tmp);
  tmp.first=Y;//b
  tmp.second=X;
  edge.push_back(tmp);
  tmp.first=B;//w
  tmp.second=Y;
  edge.push_back(tmp);
  tmp.first=-1;//x
  tmp.second=Z;
  edge.push_back(tmp);
  tmp.first=X;//y
  tmp.second=-1;
  edge.push_back(tmp);
  tmp.first=W;//z
  tmp.second=B;
  edge.push_back(tmp);
}



string p;
void init(){
  p="";
  edge.clear();
}

bool input(){
  cin>>p;
  if(p=="#"){
    return false;
  }else{
    return true;
  }
}

int go(int now,char in){
  if(in=='1'){
    return edge[now].second;
  }else if(in=='0'){
    return edge[now].first;
  }else{
    return -1;
  }
}


string solve(){
  int pos=A;
  for(int i=0;i<p.size();i++){
    pos=go(pos,p[i]);
    if(pos==-1)return "No";
  }
  if(pos==B){
    return "Yes";
  }else{
    return "No";
  }
}

int main(){
  make_map();
  while(init(),input()){
    cout<<solve()<<endl;
  }
}