#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
#define ll long long
#define ld long double
#define ff first
#define ss second
#define pii pair<int,int>
#define pll pair<long long, long long>
#define vi vector<int>
#define vl vector<long long>
#define pb push_back
#define rep(i, b) for(int i = 0; i < (b); ++i)
#define rep2(i,a,b) for(int i = a; i <= (b); ++i)
#define rep3(i,a,b,c) for(int i = a; i <= (b); i+=c)
#define count_bits(x) __builtin_popcountll((x))
#define all(x) (x).begin(),(x).end()
#define siz(x) (int)(x).size()
#define forall(it,x) for(auto& it:(x))
//using namespace __gnu_pbds;
using namespace std;
//typedef tree<int, null_type, less<int>, rb_tree_tag,tree_order_statistics_node_update> ordered_set;
//mt19937 mt;void random_start(){mt.seed(chrono::time_point_cast<chrono::milliseconds>(chrono::high_resolution_clock::now()).time_since_epoch().count());}
//ll rand(ll a, ll b) {return a + (mt() % (b-a+1));}
const int INF = 1e9+50;
const ll INF_L = 1e18+40;
const ll MOD = 1e9+7;
void solve()
{
int n;
cin >> n;
vl D(n);
vl A(n+2,1e18);
vl B(n);
rep(i,n) cin >> D[i];
rep(i,n) cin >> A[i];
rep(i,n) cin >> B[i];
ll p,k;
cin >> p >> k;
ll cur_sum = 0;
rep(i,n)
{
cur_sum += D[i];
A[i] -= cur_sum;
B[i] -= cur_sum;
}
set<pll> minA;
set<pll> minB;
rep(i,n)
{
// cout << A[i] << " " << B[i] << " AB\n";
//minA.insert({A[i],i});
minB.insert({B[i],i});
}
ll ans = -1e18;
minB.insert({k,n});
minB.insert({-cur_sum,n+1});
forall(it,minB)
{
if(it.ff > k) break;
int ind = it.ss;
//cout << it.ff << " " << min(k,it.ff) + min(p,(*minA.begin()).ff) << " ans\n";
ans = max(ans,min(k,it.ff) + min(p,(*minA.begin()).ff));
minA.insert({A[ind],ind});
}
cout << ans + cur_sum*2 << "\n";
}
int main()
{
ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
//random();
int t = 1;
//cin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pOwogICAgZm9yYWxsKGl0LG1pbkIpCiAgICB7CiAgICAgICAgaWYoaXQuZmYgPiBrKSBicmVhazsKICAgICAgICBpbnQgaW5kID0gaXQuc3M7CiAgICAgICAgLy9jb3V0IDw8IGl0LmZmIDw8ICIgIiA8PCBtaW4oayxpdC5mZikgKyBtaW4ocCwoKm1pbkEuYmVnaW4oKSkuZmYpIDw8ICIgYW5zXG4iOwogICAgICAgIGFucyA9IG1heChhbnMsbWluKGssaXQuZmYpICsgbWluKHAsKCptaW5BLmJlZ2luKCkpLmZmKSk7CiAgICAgICAgbWluQS5pbnNlcnQoe0FbaW5kXSxpbmR9KTsKICAgICAgICAKICAgIH0KICAgIGNvdXQgPDwgYW5zICsgY3VyX3N1bSoyIDw8ICJcbiI7Cn0KCmludCBtYWluKCkKewogICAgaW9zX2Jhc2U6OnN5bmNfd2l0aF9zdGRpbygwKTtjaW4udGllKDApO2NvdXQudGllKDApOwogICAgLy9yYW5kb20oKTsKICAgIGludCB0ID0gMTsKICAgIC8vY2luID4+IHQ7CiAgICB3aGlsZSh0LS0pIHNvbHZlKCk7Cn0=