#include <iostream>
using namespace std;
#define ll long long
int main() {
ll n, i, j, minjumps, maxjumps, minenergy = 1000000000;
cin >> n;
ll p[n];
for (i = 0; i < n; i++) {
cin >> p[i];
}
cin >> minjumps >> maxjumps;
ll a[2][n + 1];
a[0][0] = 0;
for (i = 1; i < n; i++)a[0][i] = a[0][i - 1] + abs(p[i] - p[i - 1]);
if (minjumps == 0)minenergy = a[0][n - 1];
for (j = 1; j <= maxjumps; j++) {
a[j % 2][j * 2] = a[(j - 1) % 2][j * 2 - 2] + 3 * abs(p[j * 2] - p[j * 2 - 2]);
for (i = j * 2 + 1; i < n; i++) {
a[j % 2][i] = min(a[j % 2][i - 1] + abs(p[i - 1] - p[i]), a[(j - 1) % 2][i - 2] + 3 * abs(p[i - 2] - p[i]));
}
if ((j >= minjumps) and (minenergy > a[j % 2][n - 1])) { minenergy = a[j % 2][n - 1]; }
}
cout << minenergy << endl;
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgoKdXNpbmcgbmFtZXNwYWNlIHN0ZDsKI2RlZmluZSBsbCBsb25nIGxvbmcKCmludCBtYWluKCkgewogICAgbGwgbiwgaSwgaiwgbWluanVtcHMsIG1heGp1bXBzLCBtaW5lbmVyZ3kgPSAxMDAwMDAwMDAwOwogICAgY2luID4+IG47CiAgICBsbCBwW25dOwogICAgZm9yIChpID0gMDsgaSA8IG47IGkrKykgewogICAgICAgIGNpbiA+PiBwW2ldOwogICAgfQogICAgY2luID4+IG1pbmp1bXBzID4+IG1heGp1bXBzOwogICAgbGwgYVsyXVtuICsgMV07CiAgICBhWzBdWzBdID0gMDsKICAgIGZvciAoaSA9IDE7IGkgPCBuOyBpKyspYVswXVtpXSA9IGFbMF1baSAtIDFdICsgYWJzKHBbaV0gLSBwW2kgLSAxXSk7CiAgICBpZiAobWluanVtcHMgPT0gMCltaW5lbmVyZ3kgPSBhWzBdW24gLSAxXTsKICAgIGZvciAoaiA9IDE7IGogPD0gbWF4anVtcHM7IGorKykgewogICAgICAgIGFbaiAlIDJdW2ogKiAyXSA9IGFbKGogLSAxKSAlIDJdW2ogKiAyIC0gMl0gKyAzICogYWJzKHBbaiAqIDJdIC0gcFtqICogMiAtIDJdKTsKICAgICAgICBmb3IgKGkgPSBqICogMiArIDE7IGkgPCBuOyBpKyspIHsKICAgICAgICAgICAgYVtqICUgMl1baV0gPSBtaW4oYVtqICUgMl1baSAtIDFdICsgYWJzKHBbaSAtIDFdIC0gcFtpXSksIGFbKGogLSAxKSAlIDJdW2kgLSAyXSArIDMgKiBhYnMocFtpIC0gMl0gLSBwW2ldKSk7CiAgICAgICAgfQogICAgICAgIGlmICgoaiA+PSBtaW5qdW1wcykgYW5kIChtaW5lbmVyZ3kgPiBhW2ogJSAyXVtuIC0gMV0pKSB7IG1pbmVuZXJneSA9IGFbaiAlIDJdW24gLSAxXTsgfQogICAgfQogICAgY291dCA8PCBtaW5lbmVyZ3kgPDwgZW5kbDsKICAgIHJldHVybiAwOwp9