program ex;
type
ss=array[1..1000]of longint;
var
a,b:ss;
n,x:longint;
procedure init;
var
i:integer;
begin
assign(input,'mix.in');
assign(output,'mix.out');
reset(input);
rewrite(output);
readln(n);
for i:=1 to n do read(a[i]); readln;
for i:=1 to n do read(b[i]); readln;
readln(x);
close(input);
end;
procedure main;
var
i:longint;
m1,m2:longint;
v1,v2:longint;
ans:real;
temp1,temp2:real;
k:real;
begin
ans:=0;
m1:=0;m2:=0;
v1:=0;v2:=0;
for i:=1 to n do
begin
if a[i]>x then
begin
m1:=m1+a[i]*b[i];
v1:=v1+b[i];
end;
if a[i]=x then ans:=ans+b[i];
if a[i]<x then
begin
m2:=m2+a[i]*b[i];
v2:=v2+b[i];
end;
end;
if v1<>0 then temp1:=m1/v1;
if v2<>0 then temp2:=m2/v2;
k:=abs(temp2-x)/abs(temp1-x);
if v1<v2*k then ans:=ans+v1+v1/k
else ans:=ans+v2+v2*k;
writeln(ans:0:5);
close(output);
end;
begin
init;
main;
end.