func_code_string: #include <bits/stdc++.h>   using namespace std;   using ll = long long;   const int inf = 0x3f3f3f3f;   const int N = 1e5 + 5;   const int M = 1e5 + 5;   const int mod = 1e9 + 7;   int T;   int n, ind, l, r;   int main() {     ios::sync_with_stdio(false);     cin.tie(0);     cin >> n >> ind >> l >> r;     if (l == 1 && r == n) {       cout << 0;     } else if (l == 1) {       cout << abs(r - ind) + 1;     } else if (r == n) {       cout << abs(ind - l) + 1;     } else {       if (ind >= l && ind <= r) {         cout << min(r - ind, ind - l) + 2 + r - l;       } else if (ind < l) {         cout << r - ind + 2;       } else {         cout << ind - l + 2;       }     }     cout << endl;     return 0;   }   