#include #include using namespace std; unsigned long long dif_max; unsigned long long a, b; void genereaza(unsigned long long m, unsigned long long n) { if (m > b || n > b) return; if (a <= m && m <= b && a <= n && n <= b) { dif_max = max(dif_max, m - n + 1); } genereaza(2 * m - n, m); genereaza(2 * m + n, m); genereaza(m + 2 * n, n); } int main() { dif_max = -1; cin >> a >> b; genereaza(2, 1); cout << dif_max << '\n'; return 0; }