#include "bits/stdc++.h"
#define puba push_back
#define mapa make_pair
#define ff first
#define ss second
#define bend(_x) (_x).begin(), (_x).end()
#define szof(_x) ((int) (_x).size())

using namespace std;
typedef long long ll;
typedef double dbl;
typedef unsigned int ui;
typedef unsigned long long ull;
typedef pair <int, int> pii;
typedef pair <long long, long long> pll;

int n, k, t;
vector <int> arrt, came;

int main() {    
    freopen("delivery.in", "r", stdin);
    freopen("delivery.out", "w", stdout);

    cin >> n >> k >> t;

    for (int i = 0; i < n; ++i) {
        int num;
        cin >> num;
        arrt.puba(num);
    }

    for (int i = 0; i < n; ++i) {
        int num;
        cin >> num;
        came.puba(num);
    }

    int ans = 0;
    for (int i = 0; i < n; ++i) {
        //cerr << ans << endl;
        ans += arrt[i];
        if (ans + k >= came[i]) {
            ans = max(came[i], ans) + t;
        } else {
            ans += k;
        }
    }

    cout << ans << endl;

    return 0;
}