#include<iostream> #include<cstdio> #include<string> #include<vector> using namespace std; string Divide(string str,int x){ int remainder=0; int temp; for(int i=0;i<str.size();++i){ temp=remainder*10+str[i]-'0'; str[i]=temp/x+'0'; remainder=temp%x; } int pos=0; while(str[pos]=='0'){ ++pos; } return str.substr(pos); } string Multiply(string str,int x){ int advance=0; for(int i=str.size()-1;i>=0;--i){ advance=(str[i]-'0')*x+advance; str[i]=advance%10+'0'; advance/=10; } if (advance != 0) { str.insert(0, "1"); } return str; } string Add(string str,int x){ int advance=x; for(int i=str.size()-1;i>=0;--i){ advance=str[i]-'0'+advance; str[i]=advance%10+'0'; advance/=10; } if(advance!=0){ str.insert(0, "1"); } return str; } int main(){ string number; cin>>number; string binary; while(number.size()){ binary.push_back((number[number.size()-1]-'0')%2+'0'); number=Divide(number, 2); } string resultant="0"; for(int i=0;i<binary.size();++i){ resultant=Multiply(resultant, 2); resultant=Add(resultant,binary[i]-'0'); } cout<<resultant<<endl; return 0; }