#include<bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(0); string a, b; cin >> a >> b; long long ans = 0, two = 1; reverse(a.begin(), a.end()); reverse(b.begin(), b.end()); for (int i = 0; i < 50; i++) { if (i >= a.size() && i >= b.size()) break; else if (i >= a.size()) { if (b[i] == '1') ans += two; } else if (i >= b.size()) { if (a[i] == '1') ans += two; } else { if (!(a[i] == b[i])) ans += two; } two *= 2; } cout << ans << endl; return 0; }