include <bits/stdc++.h>
define F first
define S second
define ll long long
define pb push_back
define pii pair<int,int>
define elif else if
define endl '\n'
define for0 for(int i = 0; i < n; ++i)
define for1 for(int i = 1; i <= n; ++i)
using namespace std;
/*void dfs(int v){ was[v] = 1; for(int i = 1; i <= n; ++i){ if(!was[i] && g[v][i] == 1){ dfs(i); }elif(was[i] == 1 && g[v][i] == 1){ cout << 1; exit(0); } }
was[v] = 2; }*/
struct gangsta{ int t, p, s;
};
bool nigga(gangsta A,gangsta B){ return (A.t < B.t); }
int main(){ ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0); int n, k, t; cin >> n >> k >> t; gangsta g[n + 1]; for1{ cin >> g[i].t; } for1{ cin >> g[i].p; } for1{ cin >> g[i].s; } sort(g + 1, g + n + 1, &nigga); vector dp(n + 1, 0); vector ok(n + 1, false); ok[0] = true; dp[0] = 0;
g[0] = {0, 0, 0}; int ans = 0; for1{ for(int j = 0; j < i; ++j){ if(ok[j] && abs(g[i].s - g[j].s) <= g[i].t - g[j].t && dp[i] < dp[j] + g[i].p){ ok[i] = true; dp[i] = dp[j] + g[i].p; } } ans = max(ans, dp[i]); } cout << ans; return 0;
}