func_code_string: #include <bits/stdc++.h>   using namespace std;   const long long INF = 1e18;   long long n, s, e, x[5001], a[5001], b[5001], c[5001], d[5001];   long long dp[5001][5001], ans = INF;   void init() {     for (int i = 0; i < 5001; i++)       for (int j = 0; j < 5001; j++) dp[i][j] = INF;     cin >> n >> s >> e;     for (int i = 1; i < n + 1; i++) cin >> x[i];     for (int i = 1; i < n + 1; i++) cin >> a[i];     for (int i = 1; i < n + 1; i++) cin >> b[i];     for (int i = 1; i < n + 1; i++) cin >> c[i];     for (int i = 1; i < n + 1; i++) cin >> d[i];   }   long long solve() {     for (int i = 0; i < 5001; i++)       for (int j = 0; j < 5001; j++) dp[i][j] = INF;     dp[0][0] = 0;     for (int i = 1; i < n + 1; i++)       for (int j = 0; j < 5001; j++) {         if (i != n && j == 0) continue;         if (i == s) {           dp[i][j] = min(dp[i][j], dp[i - 1][j + 1] + x[i] + c[i]);           dp[i][j] = min(dp[i][j], dp[i - 1][j - 1] - x[i] + d[i]);         } else if (i == e) {           dp[i][j] = min(dp[i][j], dp[i - 1][j - 1] + b[i] - x[i]);           dp[i][j] = min(dp[i][j], dp[i - 1][j + 1] + a[i] + x[i]);         } else {           if (j >= 2)             dp[i][j] = min(dp[i][j], dp[i - 1][j - 2] + b[i] + d[i] - 2 * x[i]);           if (j > 1 || s < e)             dp[i][j] = min(dp[i][j], dp[i - 1][j] + a[i] + d[i]);           if (j > 1 || s > e)             dp[i][j] = min(dp[i][j], dp[i - 1][j] + c[i] + b[i]);           if (j + 2 <= 5000)             dp[i][j] = min(dp[i][j], dp[i - 1][j + 2] + a[i] + c[i] + 2 * x[i]);         }       }     return dp[n][0];   }   int main() {     init();     ans = min(ans, solve());     cout << ans;   }   