#include using namespace std; int main() { int n, m; long long w; cin >> n >> m >> w; vector a(n), b(m), c(m); for (int i = 0; i < n; i++) { cin >> a[i]; } for (int i = 0; i < m; i++) { cin >> b[i]; } for (int i = 0; i < m; i++) { cin >> c[i]; } sort(a.rbegin(), a.rend()); vector sum = {0LL}; long long cur = 0LL; for (int i = 0; i < n; i++) { cur += a[i]; sum.push_back(cur); } long long ans = 0LL; for (int bit = 0; bit < (1 << m); bit++) { long long wgt = 0LL, val = 0LL; for (int i = 0; i < m; i++) { if (bit & (1 << i)) { wgt += b[i]; val += c[i]; } } if (wgt > w) { continue; } long long res = min(w - wgt, (long long)n); ans = max(ans, val + sum[res]); } cout << ans << endl; }