#include <iostream>
#include <string>
using namespace std;
int main(){
ios::sync_with_stdio(0);
int n;
while(1){
string s;
getline(cin,s);
int ans=0,tmp=1,j=1;
for(int i=s.size()-1;i>=0;i--){
ans+=tmp*(s[i]-'0');
tmp=(1<<++j)-1;
}
if(!ans)
return 0;
cout<<ans<<endl;
}
}
#include <string>
using namespace std;
int main(){
ios::sync_with_stdio(0);
int n;
while(1){
string s;
getline(cin,s);
int ans=0,tmp=1,j=1;
for(int i=s.size()-1;i>=0;i--){
ans+=tmp*(s[i]-'0');
tmp=(1<<++j)-1;
}
if(!ans)
return 0;
cout<<ans<<endl;
}
}
Comments
Post a Comment