#include <bits/stdc++.h>   #pragma comment(linker,  /STACK:167772160000 )   using namespace std;   long long dp[5100][5100];   long long x[5100];   int a[5100], b[5100], c[5100], d[5100];   int main() {     int leftminright = 0;     int n, s, e;     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];     x[n] = 0;     for (int i = 0; i < n + 2; i++)       for (int j = 0; j < n + 2; j++) dp[i][j] = 1E18;     dp[0][0] = 0;     for (int i = 0; i < n; i++) {       for (int j = 0; j < n; j++) {         if (i != 0) {           if (j == 0 && leftminright != 1) continue;         }         if (i == s) {           leftminright--;           long long now = dp[i][j];           now += d[i];           dp[i + 1][j + 1] =               min(dp[i + 1][j + 1],                   now + (x[i + 1] - x[i]) * ((j + 1) * 2 + leftminright));           now -= d[i];           now += c[i];           if (j + leftminright + 1 > 0)             dp[i + 1][j] = min(dp[i + 1][j],                                now + (x[i + 1] - x[i]) * (j * 2 + leftminright));           leftminright++;           continue;         }         if (i == e) {           leftminright++;           long long now = dp[i][j];           now += b[i];           dp[i + 1][j] =               min(dp[i + 1][j], now + (x[i + 1] - x[i]) * (j * 2 + leftminright));           now -= b[i];           now += a[i];           if (j == 0) {             leftminright--;             continue;           }           dp[i + 1][j - 1] =               min(dp[i + 1][j - 1],                   now + (x[i + 1] - x[i]) * (2 * (j - 1) + leftminright));           leftminright--;           continue;         }         long long now = dp[i][j];         now += b[i];         now += d[i];         dp[i + 1][j + 1] =             min(dp[i + 1][j + 1],                 now + (x[i + 1] - x[i]) * ((j + 1) * 2 + leftminright));         now -= d[i];         now += c[i];         if (j + leftminright > 0)           dp[i + 1][j] =               min(dp[i + 1][j], now + (x[i + 1] - x[i]) * (j * 2 + leftminright));         now -= b[i];         now += a[i];         now -= c[i];         now += d[i];         if (j > 0)           dp[i + 1][j] =               min(dp[i + 1][j], now + (x[i + 1] - x[i]) * (j * 2 + leftminright));         now -= d[i];         now += c[i];         if (j > 0 && j + leftminright > 0)           dp[i + 1][j - 1] =               min(dp[i + 1][j - 1],                   now + (x[i + 1] - x[i]) * ((j - 1) * 2 + leftminright));       }       if (i == s) leftminright--;       if (i == e) leftminright++;     }     cout << dp[n][0];     return 0;   }   