func_code_string: #include <bits/stdc++.h>   using namespace std;   const long long N = 5100;   long long n, s, t, x[N], a[N], b[N], c[N], d[N], w[N];   long long dp[N][N];   inline void print(long long a[]) {     for (long long i = 1; i <= n; i++) printf( %lld  , a[i]);     printf(  n );   }   inline long long read() {     long long f = 1, x = 0;     char s = getchar();     while (s <  0  || s >  9 ) {       if (s ==  - ) f = -1;       s = getchar();     }     while (s >=  0  && s <=  9 ) {       x = x * 10 + s -  0 ;       s = getchar();     }     return x * f;   }   signed main() {     n = read();     s = read();     t = read();     for (long long i = 1; i <= n; i++) x[i] = read();     for (long long i = 1; i <= n; i++) a[i] = read() + x[i];     for (long long i = 1; i <= n; i++) b[i] = read() - x[i];     for (long long i = 1; i <= n; i++) c[i] = read() + x[i];     for (long long i = 1; i <= n; i++) d[i] = read() - x[i];     long long x = 0, y = 0;     for (long long i = 0; i <= n; i++)       for (long long j = 0; j <= n; j++) dp[i][j] = 1e18;     if (s == 1)       dp[1][1] = d[1], x--;     else if (t == 1)       dp[1][1] = b[1], y--;     else       dp[1][1] = b[1] + d[1];     for (long long i = 2; i < n; i++) {       if (i == s) {         for (long long j = 1; j <= i; j++) {           if (j > 1) dp[i][j] = min(dp[i][j], dp[i - 1][j - 1] + d[i]);           dp[i][j] = min(dp[i][j], dp[i - 1][j] + c[i]);         }         x--;         continue;       }       if (i == t) {         for (long long j = 1; j <= i; j++) {           if (j > 1) dp[i][j] = min(dp[i][j], dp[i - 1][j - 1] + b[i]);           dp[i][j] = min(dp[i][j], dp[i - 1][j] + a[i]);         }         y--;         continue;       }       for (long long j = 1 + (i > s && i > t); j <= i; j++) {         long long in = j + x, out = j + y;         if (j > 1 || out) dp[i][j] = min(dp[i][j], dp[i - 1][j] + a[i] + d[i]);         if (j > 1 || in) dp[i][j] = min(dp[i][j], dp[i - 1][j] + c[i] + b[i]);         dp[i][j + 1] = min(dp[i][j + 1], dp[i - 1][j] + b[i] + d[i]);         if (j > 1) dp[i][j - 1] = min(dp[i][j - 1], dp[i - 1][j] + a[i] + c[i]);       }     }     long long ans = 1e18;     if (s == n)       ans = min(ans, dp[n - 1][1] + c[n]);     else if (t == n)       ans = min(ans, dp[n - 1][1] + a[n]);     else       ans = min(ans, dp[n - 1][2] + a[n] + c[n]);     printf( %lld n , ans);   }   