#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cctype>
#include<cmath>
#define int long long
#define double long long
using namespace std;
const int MXN=120;
struct rec{
	int a,b;
}t[MXN];
int n;
inline int read(){
	int X=0,z=0;char ch=0;
	while(!isdigit(ch)) z=ch=='-'?1:0,ch=getchar();
	while(isdigit(ch)) X=(X<<1)+(X<<3)+(ch^48),ch=getchar(); 
	return z?-X:X;
}
double c[MXN];
bool cmp(double x,double y){
	return x>y;
}
double f[56][56][56];
bool Examine(double x){
	for(register int i=1;i<=n;++i)
		c[i]=(t[i].a)-x*(t[i].b);
    	memset(f,0x3f,sizeof(f));
	f[1][0][1]=c[1];
	for(int i=1;i<=n;++i){
		for(int j=0;j<=i;++j){
			for(int k=0;k<=i;++k){
				if(t[i].a==t[i-1].a){
					if(j+1<=i-1) f[i][j][k]=min(f[i][j][k],f[i-1][j+1][k]);
					if(k-1>=0) f[i][j][k]=min(f[i-1][j][k-1]+c[i],f[i][j][k]);
				}
				if(t[i].a!=t[i+1].a)
				{
					f[i+1][j+k-1][0]=min(f[i][j][k],f[i+1][j+k-1][0]);
                	f[i+1][j+k][1]=min(f[i][j][k]+c[i+1],f[i+1][j+k][1]);
		        }
			}
	    }
	}
	for(int j=0;j<=n;j++)
	for(int k=0;k<=n;k++)
			if(f[n][j][k]<=0)return true;
	return false;
}
inline int Binary_Search(){
	double L=0,R=1e9,mid;
	while(L+1!=R){
		mid=(L+R)>>1;
		if(Examine(mid)) R=mid;
		else L=mid;
	}
	return R;
}
bool cmprec(rec x,rec y){return x.a>y.a;}
main(){
 	n=read();
 	for(int i=1;i<=n;++i) t[i].a=read(),(t[i].a)*=1000;
 	for(int i=1;i<=n;++i) t[i].b=read(),(t[i].b);
 	sort(t+1,t+1+n,cmprec);
 	int ans=Binary_Search();
 	cout<<ans;
	return 0;
}