#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using ld = long double;
using ull = unsigned long long;
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
// https://codeforces.com/blog/entry/79148
class Timer: chrono::high_resolution_clock {
const time_point start_time;
public:
Timer(): start_time(now()) {}
rep elapsed_time() const {
return chrono::duration_cast<chrono::milliseconds>(now() - start_time).count();
}
} timer;
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
int n, m;
ll k;
cin >> n >> m >> k;
vector<ll> a(n + 1), dp(n + 1, 1e18);
dp[0] = 0;
for (int i = 1; i <= n; i++) {
cin >> a[i];
}
for (ll i = 1; i <= n; i++) {
ll x, mi = 1e18, ma = -1e18;
cin >> x;
for (ll j = i - 1; j >= max(i - m, 0ll); j--) {
mi = min(mi, a[j + 1]);
ma = max(ma, a[j + 1]);
dp[i] = min(dp[i], dp[j] + (i - j) * (ma - mi) + k);
}
}
cout << dp[n];
return 0;
}