#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; typedef long long ll; typedef uint64_t ull; typedef pair P; typedef pair Pid; typedef pair Pdi; typedef pair Pl; typedef pair Pll; typedef pair> PP; typedef pair PPi; constexpr double PI = 3.1415926535897932; // acos(-1) constexpr double EPS = 1e-9; constexpr int INF = 1001001001; constexpr int mod = 1000000007; // constexpr int mod = 998244353; #define chmax(x, y) x = max(x, y) #define chmin(x, y) x = min(x, y) #define chadd(x, y) x = (x + y) % mod bool check(vector& v){ int sz = v.size(); for(int i = 0; i < sz; ++i){ if(v[i]) return true; } return false; } int main(){ ios::sync_with_stdio(false); cin.tie(nullptr); string s, t; cin >> s >> t; reverse(s.begin(), s.end()); reverse(t.begin(), t.end()); int ns = s.length(), nt = t.length(); vector a(ns), b(nt); for(int i = 0; i < ns; ++i) a[i] = s[i] - '0'; for(int i = 0; i < nt; ++i) b[i] = t[i] - '0'; vector A; while(check(a)){ A.push_back((a[0] % 2 == 0) ? 0 : 1); if(a[0] % 2 != 0) --a[0]; a[0] /= 2; for(int i = 1; i < ns; ++i){ int foo = 10 * a[i]; foo /= 2; a[i - 1] += foo % 10; a[i] = foo / 10; } } vector B; while(check(b)){ B.push_back((b[0] % 2 == 0) ? 0 : 1); if(b[0] % 2 != 0) --b[0]; b[0] /= 2; for(int i = 1; i < nt; ++i){ int foo = 10 * b[i]; foo /= 2; b[i - 1] += foo % 10; b[i] = foo / 10; } } int na = A.size(), nb = B.size(); if(na > nb) swap(A, B), swap(na, nb); vector ans(nb); for(int i = 0; i < na; ++i) ans[i] = A[i] ^ B[i]; for(int i = na; i < nb; ++i) ans[i] = B[i]; vector ans2(10000, 0); int digit_cnt = 1, digit_cnt2 = 1; vector pow2(10000, 0); pow2[0] = 1; if(ans[0]) ans2[0] = 1; for(int i = 1; i < ans.size(); ++i){ vector hoge(10000, 0); for(int j = 0; j < digit_cnt; ++j){ int foo = pow2[j] * 2; hoge[j] += foo % 10; int bar = hoge[j]; hoge[j] = bar % 10; bar /= 10; foo /= 10; foo += bar; int add = 1; while(foo){ hoge[j + add] += foo % 10; int bar2 = hoge[j + add]; hoge[j + add] = bar2 % 10; bar2 /= 10; foo /= 10; foo += bar2; chmax(digit_cnt, j + add + 1); ++add; } } pow2 = hoge; chmax(digit_cnt2, digit_cnt); if(!ans[i]) continue; for(int j = 0; j < digit_cnt2; ++j){ ans2[j] += pow2[j]; int foo = ans2[j]; ans2[j] = foo % 10; foo /= 10; int add = 1; while(foo){ ans2[j + add] += foo % 10; int bar = ans2[j + add]; ans2[j + add] = bar % 10; bar /= 10; foo /= 10; foo += bar; chmax(digit_cnt2, j + add + 1); ++add; } } } for(int i = digit_cnt2 - 1; i >= 0; --i) cout << ans2[i]; cout << endl; // reverse(s.begin(), s.end()); // reverse(t.begin(), t.end()); // int X = atoi(s.c_str()), Y = atoi(t.c_str()); // cerr << X << " " << Y << endl; // cerr << (X ^ Y) << endl; }