var n,i,j,maxpokriva,pokr:longint;
    x,y,r:array[1..100] of real;
    rt,maxx,maxy,veliki_ruzni_izraz,a,b,c,x1,y1,x2,y2:real;
    f:text;
    nnnn:string;
function koliko_pokriva(x1,y1:real):longint;
var k, res:longint;
begin
 res:=0;
 for k:=1 to n do
   if sqr(rt-r[k])-sqr(x1-x[k])-sqr(y1-y[k])>=-0.000001 then
     begin
     inc(res);
     end;
    koliko_pokriva:= res;
end;
procedure proveri_pokrivanje;
begin
 pokr:=koliko_pokriva(x1,y1);
 if pokr>maxpokriva then begin
                          maxpokriva:=pokr;
                          maxx:=x1;
                          maxy:=y1;
                         end;
 pokr:=koliko_pokriva(x2,y2);
 if pokr>maxpokriva then begin
                          maxpokriva:=pokr;
                          maxx:=x2;
                          maxy:=y2;
                         end;
end;
begin
 assign(f,'tabla.in');
 reset(f);
 readln(f,n);
 for i:=1 to n do
   readln(f,x[i],y[i],r[i]);
 readln(f,rt);
 close(f);
 i:=1;
 while (i<=n) do
    if r[i]>rt then begin
                     x[i]:=x[n];
                     y[i]:=y[n];
                     r[i]:=r[n];
                     dec(n);
                    end
               else inc(i);
 maxpokriva:=0;
 for i:=1 to n do
   begin
    pokr:=koliko_pokriva(x[i],y[i]);
    if pokr>maxpokriva then begin
                             maxpokriva:=pokr;
                             maxx:=x[i];
                             maxy:=y[i];
                            end;
   end;
 for i:=1 to n-1 do
   for j:=i+1 to n do
     begin
      veliki_ruzni_izraz:=sqr(rt-r[j])-sqr(rt-r[i])+sqr(x[i])+sqr(y[i])-sqr(x[j])-sqr(y[j]);
      if y[i]<>y[j] then begin
                          a:=1+sqr((x[i]-x[j])/(y[i]-y[j]));
                          b:=-2*x[i]-2*(x[i]-x[j])/(y[i]-y[j])*(veliki_ruzni_izraz/(2*(y[i]-y[j]))-y[i]);
                          c:=sqr(x[i])+sqr(y[i])+sqr(veliki_ruzni_izraz/(2*(y[i]-y[j])))-veliki_ruzni_izraz/(y[i]-y[j])*y[i]-sqr(rt-r[i]);
                          if sqr(b)-4*a*c>=0 then begin
                                                   x1:=(-b+sqrt(sqr(b)-4*a*c))/(2*a);
                                                   x2:=(-b-sqrt(sqr(b)-4*a*c))/(2*a);
                                                   y1:=veliki_ruzni_izraz/(2*(y[i]-y[j]))-x1*(x[i]-x[j])/(y[i]-y[j]);
                                                   y2:=veliki_ruzni_izraz/(2*(y[i]-y[j]))-x2*(x[i]-x[j])/(y[i]-y[j]);
                                                   proveri_pokrivanje;
                                                  end
                         end
                    else if x[i]<>x[j] then begin
                                             x1:=veliki_ruzni_izraz/(2*(x[i]-x[j]));
                                             x2:=x1;
                                             if sqr(rt-r[i])-sqr(x1-x[i])>=0 then begin
                                                                                   y1:=sqrt(sqr(rt-r[i])-sqr(x1-x[i]))+y[i];
                                                                                   y2:=-sqrt(sqr(rt-r[i])-sqr(x1-x[i]))+y[i];
                                                                                   proveri_pokrivanje;
                                                                                  end
                                            end
     end;
 assign(f,'tabla.out');
 rewrite(f);
 writeln(f,maxpokriva:0);
 close(f);
end.