#include "bits/stdc++.h" using namespace std; typedef long long Int; #define REP(i,n) for(int (i)=0;(i)<(int)(n);++(i)) int A[1500]; int B[1500]; int main() { int N; cin >> N; REP(i, N) cin >> A[i]; REP(i, N) cin >> B[i]; int ans = 999999999; REP(i, N) { priority_queue> pq; REP(j, N) { pq.push(make_pair(-A[j], 0)); } for (int j = 0; j < N; j++) { pair top = pq.top(); pq.pop(); top.first -= B[(i + j) % N] / 2; top.second--; pq.push(top); } int maxButtle = 0; while (!pq.empty()) { int buttle = -pq.top().second; pq.pop(); maxButtle = max(maxButtle, buttle); } ans = min(ans, maxButtle); } cout << ans << endl; }