#include #include #include #include #include #include #include #include #include #include #include #include #include #define INF 10000000 #define rep(i,n) for (int i=0;i<(n);i++) #define rev(i,n) for (int i=(n)-1;i>=0;i--) using namespace std; typedef long long ll; typedef pair p; typedef queue qi; typedef queue< pair > qp; typedef vector vi; typedef vector vii; typedef vector vs; typedef vector< pair > vp; int dx[4] = { 0, 1, 0, -1 }; int dy[4] = { 1, 0, -1, 0 }; int main(){ cin.tie(0); ios::sync_with_stdio(false); ll a,b; cin >> a >> b; if(a > b) cout << 2000000000 - a << endl; else cout << b- a << endl; return 0; }