func_code_string: #include <bits/stdc++.h>   using LL = long long;   const LL Inf = (LL)1e18;   const int N = 5000 + 5;   int s, e, n;   LL x[N], a[N], b[N], c[N], d[N];   LL dp[2][N];   inline LL lo(int p) { return d[p] - x[p]; }   inline LL ro(int p) { return x[p] + c[p]; }   inline LL li(int p) { return b[p] - x[p]; }   inline LL ri(int p) { return x[p] + a[p]; }   inline void _min(LL &a, LL b) {     if (a > b) a = b;   }   LL work() {     if (s > e) {       for (int i = 1; i <= n; ++i) {         x[i] = -x[i];         std::swap(a[i], b[i]);         std::swap(c[i], d[i]);       }       for (int i = 1; i < n + 1 - i; ++i) {         std::swap(x[i], x[n + 1 - i]);         std::swap(a[i], a[n + 1 - i]);         std::swap(b[i], b[n + 1 - i]);         std::swap(c[i], c[n + 1 - i]);         std::swap(d[i], d[n + 1 - i]);       }       s = n + 1 - s;       e = n + 1 - e;     }     for (int i = 0; i < 2; ++i) {       for (int j = 0; j < N; ++j) {         dp[i][j] = Inf;       }     }     int cur = 0, nex = 1;     dp[cur][1] = li(1) + lo(1);     for (int i = 2; i <= n; ++i) {       for (int left = 1; left <= i - 1; ++left) {         if (dp[cur][left] == Inf) continue;         for (int q = 0; q < 2; ++q) {           for (int w = 0; w < 2; ++w) {             if (i == s && w == 0) continue;             if (i == e && q == 1) continue;             if (s < i && i < e) {               if (left == 1 && q == 0) continue;             }             LL cost = 0;             cost += q == 0 ? ro(i) : lo(i);             cost += w == 0 ? ri(i) : li(i);             int n_left = left;             if (q == w) {               if (q == 0)                 n_left--;               else                 n_left++;             }             _min(dp[nex][n_left], dp[cur][left] + cost);           }         }       }       std::swap(cur, nex);       std::fill(dp[nex], dp[nex] + N, Inf);     }     LL ret = dp[cur][0];     if (s < e) {       ret -= li(s) + ro(e);     } else {       ret -= ri(s) + lo(e);     }     return ret;   }   int main() {     std::ios::sync_with_stdio(false);     std::cin >> n >> s >> e;     for (int i = 1; i <= n; ++i) std::cin >> x[i];     for (int i = 1; i <= n; ++i) std::cin >> a[i];     for (int i = 1; i <= n; ++i) std::cin >> b[i];     for (int i = 1; i <= n; ++i) std::cin >> c[i];     for (int i = 1; i <= n; ++i) std::cin >> d[i];     std::cout << work() << std::endl;   }   