Apple Orchard

아직 제출이 없습니다시간 제한15초메모리 제한2048 MB

문제

Farmer John has many apple trees on his farm. Each apple tree has a circular area that provides shade during the hot summer. Farmer John is creating a pen for his cows and has several locations in mind. For each fenced off area he wants to know the percentage of that proposed area that is shaded.

Each proposed fenced off region is rectangular in shape, axis aligned, and specified by its lower left corner and the width and height of the region. Calculate the percentage of shaded area for each proposed fenced off rectangle.

입력

The first line of input contains two integers nn (1n3,0001 \le n \le 3\\,000) and qq (1q3,0001 \le q \le 3\\,000), where nn is the number of apple trees in Farmer John's orchard, and qq is the number of rectangular fenced regions he wishes to test.

Each of the next nn lines contains three integers xx, yy (106x,y106-10^6 \le x,y \le 10^6) and rr (1r1061 \le r \le 10^6). Each line describes the circular shaded area of a tree, where (x,y)(x,y) is its center and rr is its radius. Note that the trees can have very twisted trunks, so it is possible for two shaded areas to have the same center, or even be identical.

Each of the next qq lines contains four integers xx, yy (106x,y106-10^6 \le x,y \le 10^6), ww and hh (1w,h1061 \le w,h \le 10^6). Each line describes a rectangular region Farmer John wishes to test. The rectangle has a diagonal from (x,y)(x,y) to (x+w,y+h)(x+w,y+h).

출력

Output qq lines, each containing a single real number, which is the percentage of that rectangle which is shaded, on a scale from 00 to 100100. Output the percentages for the rectangles in the order that they appear in the input. Each value should lie within a relative or absolute error of 10510^{-5} of the judges' answer.