#include #include using namespace std; vector bin{"0", "1", "10", "11", "100"}; int main() { string s, t; cin >> s >> t; bool x = true, y = true; if (s[0] == '-')x = false, s = s.substr(1, s.size() - 1); if (t[0] == '-')x = false, t = t.substr(1, t.size() - 1); int a = -1, b = -1; for (int i = 0; i < bin.size(); i++) { if (s == bin[i])a = i; if (t == bin[i])b = i; } int ret = (x ? a : -a) + (y ? b : -b); cout << ret << endl; /*if (ret < 0)cout << "-"; cout << bin[abs(ret)] << endl;*/ return 0; }