#define _CRT_SECURE_NO_WARNINGS #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; #define REP(i,n) for(int (i) = 0;(i) < (n) ; ++(i)) #define REPS(a,i,n) for(int (i) = (a) ; (i) < (n) ; ++(i)) #if defined(_MSC_VER)||__cplusplus > 199711L #define AUTO(r,v) auto r = (v) #else #define AUTO(r,v) typeof(v) r = (v) #endif #define ALL(c) (c).begin() , (c).end() #define EACH(it,c) for(AUTO(it,(c).begin());it != (c).end();) #define LL long long #define lint LL #define inf ((int)1 << 54) #define mod 1000000007 #define QUICK_CIN ios::sync_with_stdio(false); cin.tie(0); #define lowb lower_bound #define upb upper_bound #define ZERO(c,n) memset(&c[0],0,sizeof(int)*n) #define ZERO2(c,n) memset(&c[0][0],0,sizeof(int)*n) #define debug_input fstream cin("input.txt");ofstream cout("output.txt"); #define pb(a) push_back(a) templatevoid scan(vector& a, int n, istream& cin) { T c; REP(i, n) { cin >> c; a.push_back(c); } } using vs = vector; using vi = vector; using pii = pair; using psi = pair; using vvi = vector; templatebool valid(T x, T w) { return 0 <= x&&x < w; } int dx[4] = { 1, -1, 0, 0 }; int dy[4] = { 0, 0, 1, -1 }; //----------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------- signed main() { QUICK_CIN; debug_input; int a, b; int mm = 2000000000; int mn = 1; cin >> a >> b; int ans = 0; if (a < b) { ans += b - a - 1; ans += a - mn; } else { ans += b - mn; ans += mm - a - 1; } cout << ans << endl; }