#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);
vl B(n);
rep(i,n) cin >> D[i];
rep(i,n) cin >> A[i];
rep(i,n) cin >> B[i];
ll ans = 0;
ll p,k;
cin >> p >> k;
rep(mask,(1 << n))
{
ll a = p;
ll b = k;
rep(i,n)
{
if(mask & (1 << i))
{
a += D[i];
b += D[i];
b = min(b,B[i]);
}
else
{
a += D[i];
b += D[i];
a = min(a,A[i]);
}
}
ans = max(ans,a+b);
}
cout << ans << "\n";
}
int main()
{
ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
//random();
int t = 1;
//cin >> t;
while(t--) solve();
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+Ci8vI2luY2x1ZGUgPGV4dC9wYl9kcy9hc3NvY19jb250YWluZXIuaHBwPgovLyNpbmNsdWRlIDxleHQvcGJfZHMvdHJlZV9wb2xpY3kuaHBwPgojZGVmaW5lIGxsIGxvbmcgbG9uZwojZGVmaW5lI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mFuZChsbCBhLCBsbCBiKSB7cmV0dXJuIGEgKyAobXQoKSAlIChiLWErMSkpO30KY29uc3QgaW50IElORiA9IDFlOSs1MDsKY29uc3QgbGwgSU5GX0wgPSAxZTE4KzQwOwpjb25zdCBsbCBNT0QgPSAxZTkrNzsKCgp2b2lkIHNvbHZlKCkKewogICAgaW50IG47CiAgICBjaW4gPj4gbjsKICAgIHZsIEQobik7CiAgICB2bCBBKG4pOwogICAgdmwgQihuKTsKICAgIHJlcChpLG4pIGNpbiA+PiBEW2ldOwogICAgcmVwKGksbikgY2luID4+IEFbaV07CiAgICByZXAoaSxuKSBjaW4gPj4gQltpXTsKICAgIGxsIGFucyA9IDA7CiAgICBsbCBwLGs7CiAgICBjaW4gPj4gcCA+PiBrOwogICAgcmVwKG1hc2ssKDEgPDwgbikpCiAgICB7CiAgICAgICAgbGwgYSA9IHA7CiAgICAgICAgbGwgYiA9IGs7CiAgICAgICAgcmVwKGksbikKICAgICAgICB7CiAgICAgICAgICAgIGlmKG1hc2sgJiAoMSA8PCBpKSkKICAgICAgICAgICAgewogICAgICAgICAgICAgICAgYSArPSBEW2ldOyAKICAgICAgICAgICAgICAgIGIgKz0gRFtpXTsKICAgICAgICAgICAgICAgIGIgPSBtaW4oYixCW2ldKTsKICAgICAgICAgICAgfQogICAgICAgICAgICBlbHNlCiAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgIGEgKz0gRFtpXTsgCiAgICAgICAgICAgICAgICBiICs9IERbaV07CiAgICAgICAgICAgICAgICBhID0gbWluKGEsQVtpXSk7ICAgIAogICAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIGFucyA9IG1heChhbnMsYStiKTsKICAgIH0KICAgIGNvdXQgPDwgYW5zIDw8ICJcbiI7Cn0KCmludCBtYWluKCkKewogICAgaW9zX2Jhc2U6OnN5bmNfd2l0aF9zdGRpbygwKTtjaW4udGllKDApO2NvdXQudGllKDApOwogICAgLy9yYW5kb20oKTsKICAgIGludCB0ID0gMTsKICAgIC8vY2luID4+IHQ7CiAgICB3aGlsZSh0LS0pIHNvbHZlKCk7Cn0=