#include<iostream>
#include<algorithm>
#include<vector>
#include<functional>
#include<string>
#include<cmath>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<cstdio>
#include<numeric>
using namespace std;
using ll = long long;
int main(){
  int d1, d2;
  cin >> d1 >> d2;
  if(d1 > d2){
    cout << 0 << '\n';
  }else if(d1 == d2){
    cout << 4 << '\n';
  }else if(d1 < d2 && (double)d1 * 2 > d2){
    cout << 8 << '\n';
  }else if((double)d1 * 2 == d2){
    cout << 4 << '\n';
  }else{
    cout << 0 << '\n';
  }
  return 0;
}