#include using namespace std; const int MAX = 3010; int dp[MAX][MAX]; int solve[MAX][MAX]; int ans[MAX][MAX]; int main() { int n; cin >> n; int a[n + 1]; for(int i = 0; i <= n; ++i) cin >> a[i]; int b[n + 1]; for(int i = 0; i <= n; ++i) cin >> b[i]; int d[n]; for(int i = 0; i < n; ++i) cin >> d[i]; sort(d, d + n); reverse(d, d + n); dp[0][0] = a[0] + b[0]; solve[0][0] = -1; ans[0][0] = 0; for(int i = 0; i <= n; ++i) { for(int j = 0; j <= n; ++j) { if(i == 0 and j == 0) continue; if(i - 1 >= 0) { dp[i][j] = dp[i - 1][j] - a[i - 1] + a[i]; int ng = solve[i - 1][j], ok = n; while(abs(ok - ng) > 1) { int mid = (ok + ng) / 2; if(d[mid] <= dp[i][j]) { ok = mid; } else { ng = mid; } } solve[i][j] = ok; if(solve[i][j] != n) { ans[i][j] = ans[i - 1][j] + 1; } } if(j - 1 >= 0) { dp[i][j] = dp[i][j - 1] - b[j - 1] + b[j]; int ng = solve[i][j - 1], ok = n; while(abs(ok - ng) > 1) { int mid = (ok + ng) / 2; if(d[mid] <= dp[i][j]) { ok = mid; } else { ng = mid; } } solve[i][j] = ok; if(solve[i][j] != n) { ans[i][j] = ans[i][j - 1] + 1; } } } } int anss = 0; for(int i = 0; i <= n; ++i) { for(int j = 0; j <= n; ++j) { anss = max(anss, ans[i][j]); } } cout << anss << '\n'; return 0; }