func_code_string: #include <bits/stdc++.h>   using namespace std;   int main() {     int n, pos, lo, hi;     while (cin >> n >> pos >> lo >> hi) {       int cnt = 0;       if (lo == 1 && hi == n) {         cout <<  0  << endl;         continue;       }       int xlo = abs(pos - lo);       int xhi = abs(pos - hi);       if (lo - 1 >= 1 && hi + 1 <= n) {         cnt += 2;         if (xlo < xhi) {           cnt += xlo;         } else           cnt += xhi;         cnt += hi - lo;       } else if (lo - 1 >= 1) {         cnt += xlo;         cnt++;       } else {         cnt += xhi;         cnt++;       }       cout << cnt << endl;     }     return 0;   }   