#include <iostream>

using namespace std;

int main() {
  int i,p,d[6][2]={{1,3},{0,2},{4,5},{1,0},{5,3},{3,1}};
  char c[102];
  while(cin >> c) {
	  if (c[0]=='#') break;
	  p=0;
	  for (i=0;c[i]!='\0';i++) { p=d[p][c[i]-'0']; if (p==0) break;}
	  if (p==5) cout << "Yes"; else cout << "No"; 
	  cout << endl;
  }	  
  return 0;
 } 