#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <cstring>
#include <iomanip>
#include <cassert>

using namespace std;
typedef long long ll;

int main()
{
   ll A, B;
   cin >> A >> B;
   vector<int> primes = {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71};
   vector<ll> dp(1 << 20, 0);
   dp[0] = 1;
   for (int i = 0; i < B - A + 1; i++)
   {
      ll cur = A + i;
      int modmask = 0;
      for (int j = 0; j < 20; j++)
      {
         if (cur % primes[j] == 0)
         {
            modmask |= (1 << j);
         }
      }
      for (int mask = (1 << 20) - 1; mask >= 0; mask--)
      {
         if ((mask & modmask) == 0)
         {
            dp[(mask | modmask)] += dp[mask];
         }
      }
   }
   ll ans = 0;
   for (int i = 0; i < (1 << 20); i++)
   {
      ans += dp[i];
   }
   cout << ans << endl;
   return 0;
}

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn = 1e5+5;
ll b,c,ans,t1,t2,t3,t4;
int main(){
	cin>>b>>c;
	if(c==1){
		if(b==0){
			cout<<"1\n";
			return 0; 
		}else{
			cout<<"2\n";
			return 0; 	
		}
	}
	t1=b-c/2;
	t2=b+c/2-1;
	t3=-b-(c-1)/2;
	t4=-b+(c-1)/2;
	if(t2<t3||t4<t1){
		ans=t2-t1+t4-t3+2;
		cout<<ans<<'\n';
		return 0;
	}
	ans=max(t2,t4)-min(t1,t3)+1;
	cout<<ans<<'\n'; 
	return 0;
}