program mix(input,output);
var
a:array[1..50]of integer;
b:array[1..50]of real;
i,j,non,n:longint;
k,ans:real;
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(non);
for i:=1 to n do
if a[i]=non then begin ans:=ans+b[i]; b[i]:=0; end
else
for j:=1 to n do
if (a[i]<non)and(a[j]>non)or(a[i]>non)and(a[j]<non) then begin
k:=(abs(a[j]-non))/(abs(a[i]-non));
if b[i]>b[j]*k then begin
ans:=ans+b[j]+b[j]*k;
b[i]:=b[i]-b[j]*k;
b[j]:=0;
end;
if b[i]=b[j]*k then begin
ans:=ans+b[i]+b[j];
b[i]:=0;
b[j]:=0;
end;
if b[i]<b[j]*k then begin
ans:=ans+b[i]/k+b[i];
b[j]:=b[j]-b[i]/k;
b[i]:=0;
end;
end;
writeln(ans:0:5);
close(input);close(output);
end.