func_code_string: #include <bits/stdc++.h>   using namespace std;   const int sz = 5005;   long long int x[sz];   long long int a[sz];   long long int b[sz];   long long int c[sz];   long long int d[sz];   int n, s, e;   const long long int Max = 1e16;   long long int dp[sz][sz];   long long int jumpl(int i) { return x[i] + c[i]; }   long long int jumpr(int i) { return -x[i] + d[i]; }   long long int landfr(int i) { return -x[i] + b[i]; }   long long int landfl(int i) { return x[i] + a[i]; }   long long int calc(int ch, int pl, int pr) {     if (pl < 0 || pr < 0) {       return Max;     }     if (dp[ch][pl] != 0) {       return dp[ch][pl];     }     if (ch == 0) {       if (s == 0) {         return calc(ch + 1, pl, pr + 1) + jumpr(ch);       } else if (e == 0) {         return calc(ch + 1, pl + 1, pr) + landfr(ch);       }       return calc(ch + 1, pl + 1, pr + 1) + landfr(ch) + jumpr(ch);     }     if (ch == n - 1) {       if (s == n - 1 && (pl == 1 && pr == 0)) {         return jumpl(ch);       } else if (e == n - 1 && (pl == 0 && pr == 1)) {         return landfl(ch);       } else if (pl == pr && pl == 1) {         return landfl(ch) + jumpl(ch);       } else {         return Max;       }     } else if (pl == 0 && pr == 0) {       return Max;     }     long long int m;     if (ch == s) {       m = min(calc(ch + 1, pl - 1, pr) + jumpl(ch),               calc(ch + 1, pl, pr + 1) + jumpr(ch));       dp[ch][pl] = m;       return m;     }     if (ch == e) {       m = min(calc(ch + 1, pl, pr - 1) + landfl(ch),               calc(ch + 1, pl + 1, pr) + landfr(ch));       dp[ch][pl] = m;       return m;     }     m = calc(ch + 1, pl + 1, pr + 1) + jumpr(ch) + landfr(ch);     m = min(m, calc(ch + 1, pl - 1, pr - 1) + jumpl(ch) + landfl(ch));     if (pr > 0) {       m = min(m, calc(ch + 1, pl, pr) + jumpr(ch) + landfl(ch));     }     if (pl > 0) {       m = min(m, calc(ch + 1, pl, pr) + jumpl(ch) + landfr(ch));     }     dp[ch][pl] = m;     return m;   }   int main() {     ios::sync_with_stdio(false);     cin >> n >> s >> e;     --s, --e;     for (int i = 0; i < n; ++i) {       cin >> x[i];     }     for (int i = 0; i < n; ++i) {       cin >> a[i];     }     for (int i = 0; i < n; ++i) {       cin >> b[i];     }     for (int i = 0; i < n; ++i) {       cin >> c[i];     }     for (int i = 0; i < n; ++i) {       cin >> d[i];     }     cout << calc(0, 0, 0) << endl;   }   