#include <iostream>
#include <cmath>
using namespace std;
int main()
{
int n, a, i;
while(cin >> i){
n = 0;
a = 0;
while(i != 0){
n = n + (i % 10) * pow(-2, a);
a++;
i = i / 10;
}
cout << n << "\n";
}
return 0;
}
int n, a, i;
輸入最多有16個字,int放不下