#include <bits/stdc++.h>

using namespace std;

using ll = long long;

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int d1, d2;
    cin >> d1 >> d2;
    if (d1 == d2 || d2 == 2 * d1) cout << 4 << endl;
    else if (d1 > d2 || d2 > 2 * d1) cout << 0 << endl;
    else cout << 8 << endl;
    return 0;
}