#include <stdint.h>
#include <algorithm>
#include <cmath>
#include <iostream>
#include <map>
#include <numeric>
#include <string>
#include <vector>

using namespace std;

#define FOR_N(i, n) for (int64_t i = 0; i < (int64_t)(n); i++)
#define FOR_R(i, b, e) for (int64_t i = int64_t(b); i < (int64_t)(e); i++)

int main() {
    int64_t A, B;
    cin >> A >> B;

    if (A + B >= 15 and B >= 8) {
        cout << 1 << endl;
    } else if (A + B >= 10 and B >= 3) {
        cout << 2 << endl;
    } else if (A + B >= 3) {
        cout << 3 << endl;
    } else {
        cout << 4 << endl;
    }

    return 0;
}
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0;i<(n);i++)
typedef long long ll;

int main(){
  ll b,c;cin>>b>>c;
  ll ans=0;
  bool f=true;
  if(b<0) f=false;
  b=abs(b);

  if(b==0){
    ans=c;
  }else if(c>2*b){
    if(f) ans=2*b+c-1;
    else ans=2*b+c;
  }else if(c>=3){
    ans=2*c-1;
  }else{
    ans=c+1;
  }

  cout<<ans<<endl;
}