program The_Loathsome_Hay_Baler ;
const maxn = 2000 ;
type geartype= record x , y , r : longint ; end ;
queuetype = record d , pre : longint ; end ;
var q : array[1..maxn] of queuetype ;
gear : array[1..maxn] of geartype ;
data : array[1..maxn] of double ;
b : array[1..maxn] of boolean ;
ans : double ;
head , tail , i, n , xt , yt , num , driver : longint ;
begin
assign( input , 'baler.in' ) ; reset( input ) ;
assign( output , 'baler.out' ) ; rewrite( output ) ;
readln( n , xt , yt ) ;
fillchar( b , sizeof( b ) , 0 ) ;
for i := 1 to n do begin
readln( gear[i].x , gear[i].y , gear[i].r ) ;
if ( gear[i].x = xt ) and ( gear[i].y = yt )
then num := i ;
if ( gear[i].x = 0 ) and ( gear[i].y = 0 )
then driver := i ;
end ;
head := 0 ; tail := 1 ; ans := 0 ;
q[1].d := driver ; q[1].pre := 0 ; b[driver] := true ; data[driver] := 10000 ;
repeat
inc( head ) ;
for i := 1 to n do
if not b[i] and
( sqr( gear[q[head].d].x - gear[i].x ) + sqr( gear[q[head].d].y - gear[i].y ) = sqr( gear[q[head].d].r + gear[i].r ) )
then begin
b[i] := true ;
inc( tail ) ;
q[tail].d := i ;
q[tail].pre := head ;
data[i] := data[q[head].d] * gear[q[head].d].r / gear[i].r ;
if i = num
then break ;
end ;
until ( head >= tail ) or b[num] ;
if not b[num]
then writeln(0)
else begin
i := tail ;
while i <> 0 do begin
ans := ans + data[q[i].d] ;
i := q[i].pre ;
end ;
writeln(ans:0:0) ;
end ;
close( input ) ; close( output ) ;
end .