#include<iostream>
#include<string>
using namespace std;
int main(){
long n,i,a[7][2]={{1,2},{6,3},{1,6},{4,5},{5,2},{2,1},{6,6}},b;
string s;
while(cin>>s){
if(s=="#")break;
n=s.size();
for(b=i=0;i<n;i++)b=a[b][s[i]-48];
if(b==5)cout<<"Yes"<<endl;
else cout<<"No"<<endl;
}
return 0;
}