#include #define FOREACH(it,c) for( __typeof((c).begin()) it=(c).begin();it!=(c).end();it++) #define FOR(a,b,c) for(int a=(b);a<=(c);++a) #define ROF(a,b,c) for(int a=(b);a>=(c);--a) #define dbg(x) cout<<#x<<" = "<<(x)<<"\n"; #define pii pair #define pll pair< ll, ll > #define pull pair< ull, ull > #define mp make_pair #define pb push_back #define fi first #define se second #define ll long long #define ull unsigned long long #define tata NULL using namespace std; const int NMAX = 1000004; long long a, b; int MAX = 20000000; int MAX2 = 2000; int main() { #ifndef ONLINE_JUDGE freopen("data.in","r",stdin); #endif // ONLINE_JUDGE cin.sync_with_stdio(false); cin.tie(tata); cin >> a >> b; long long sol = -1; int step = 0; for(long long i=a;i <= b && ++step <= MAX; ++i) { int step2 = 0; long long j = b; while(j >= a && ++step2<=MAX2) { if(__gcd(i,j)==1) { sol = max(j-i+1,sol); break; } --j; } } swap(MAX,MAX2); for(long long i=a;i <= b && ++step <= MAX; ++i) { int step2 = 0; long long j = b; while(j >= a && ++step2<=MAX2) { if(__gcd(i,j)==1) { sol = max(j-i+1,sol); break; } --j; } } cout<