#include<cstring>
#include<cstdio>
#include<iostream>
using namespace std;
//对应关系:1的个数为奇数个 odd parity 'o'
//1的个数为偶数个 even parity 'e'
int main()
{
char str[1100];
int cnt;
int i;
int k;
while(cin>>str)
{
cnt=0;
if(str[0]=='#')
break;
k=strlen(str);
for(i=0;i<=k-1;i++)
{
if(str[i]=='1')
cnt++;
}
if(str[k-1]=='e')
{
if(cnt%2==0)
str[k-1]='0';
else
str[k-1]='1';
}
if(str[k-1]=='o')
{
if(cnt%2==1)
str[k-1]='0';
else
str[k-1]='1';
}
cout<<str<<endl;
}
return 0;
}