#include #include #include using namespace std; long long int decode(string n) { long long int result = 0; for (long long int i = n.length() - 1, j = 0; i >= 0; i--, j++) { int number = (n[i] == '0') ? 0 : 1; result += number * pow(-2, j); } return result; } /* string getbinary(long long int n) { if (n == 0) return "0"; string res; while (n > 0) { if (n % 2) { res.insert(0, 1, '1'); } else { res.insert(0, 1, '0'); } n /= 2; } return res; } */ string encode(long long int n) { string res; #if 0 long long int maxp = 0, max, cur, an = llabs(n); while (pow(2, maxp) < an) maxp++; //cur = max = pow(2, maxp); max = pow(2, maxp); res += "1"; //while (cur != 0) { while (n != 0) { long long int delta = llabs(an - max); if (delta < max / 4) { res += "1"; n += max / 2 * (maxp % 2 ? -1 : 1); maxp--; max /= 2; } else { } ////////////////////// if (n < max / 2) { res += "1"; n += max / 2 * (maxp % 2 ? -1 : 1); maxp--; max /= 2; } else { // n >= max / 2 } } #endif // zatim kladna // j = rad, i = index /* for (long long int i = n.length() - 1, j = 0; i >= 0; i--, j++) { if (n } */ return res; } int main(void) { string line; while (cin.good()) { cin >> line; if (cin.eof()) break; //long long int orig = decode(line); //cout << orig << endl; //cout << line << endl; //////////////// //string res; // zatim kladna // j = rad, i = index bool overflow = true; line.insert(0, 2, '0'); for (long long int i = line.length() - 1, j = 1; overflow && i >= 0; i--, j++) { if (line[i] == '0' && j % 2) { // + //cout << "A"; line[i] = '1'; overflow = false; //break; } else if (line[i] == '1' && j % 2 == 0) { // - //cout << "B"; line[i] = '0'; overflow = false; //break; } else if (line[i] == '1' && j % 2) { // + //cout << "C"; line[i] = '0'; //overflow = true; //break; } else if (line[i] == '0' && j % 2 == 0) { // - //cout << "D"; line[i] = '1'; //overflow = true; //break; //} else { //cout << "E"; } } while (line[0] == '0' && line.size() > 1) { line.erase(0, 1); } cout << line << endl; //cout << "---" << endl; //////////////// //cout << encode(orig) << endl; /* if (orig > 0) { string binary = getbinary(orig); } else if (orig < 0) { } else cout << "0" << endl; */ //cout << getbinary(orig) << endl; //cout << encode(orig + 1) << endl; } return 0; }