#include #define REP(i,n)for(int i=0;i>p;cin>>N;REP(i,N){cin>>A[i];p.push(make_pair(-A[i],0));}REP(i,N)cin>>B[i];REP(i,N){auto q=p;REP(j,N)q.push(make_pair(q.top().first-B[(i+j)%N]/2,q.top().second-1)),q.pop();int w=0;while(q.size())w=max(w,-q.top().second),q.pop();v=min(v,w);}cout<