【C++】已通过

#include<iostream>
#include<string>
using namespace std;
//返回2的i次方
long long int f(int i) {
	long long int result = 1;
	while (i != 0) {
		result *= 2;
		i--;
	}
	return result;
}
void test() {
	cout << f(0) << endl;
	cout << f(1) << endl;

}
int main() {
	//test();
	string s;
	long long int skew = 0;
	while (cin >> s) {
		skew = 0;
		for (int i = 0; i < s.size(); i++) {
			int k = s.size() - i;
			skew += (s[i] - '0')*(f(k) - 1);
		}
		cout << skew << endl;
	}
}