402662: GYM100834 K Polycarp and Lamps

Memory Limit:512 MB Time Limit:2 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

K. Polycarp and Lampstime limit per test2 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard output

Polycarp continues to play with lamps. Today he illuminates cylinder with N lamps. Center of cylinder's bottom in (xc, yc, 0), height is h, radius is r. Bottom belongs to xOy plane, top is parallel to bottom and its center is (xc, yc, h). Polycarp prepares N lamps, i-th lamp situates in (xi, yi, zi) point. The size of lamps is enough small to neglect it. Lamps enough powerfull to lighten any point in the space, if there are no obstacles. Cylinder absolutely opaque. Polycarp wants to find illuminated area of cylinder.

Input

The first line contains four integer numbers: xc, yc, h, r, where xc, yc are coordinates of bottom's center, h is height and r is radius. The second line contains one integer number: N. Next N lines contains three integers: xi, yi, zi, these are coordinates of i-th lamp.

All coordinates are greater than  - 1001 and less than 1001. 1 ≤ h, r ≤ 1000. 1 ≤ N ≤ 100. There are no lamps in the cylinder and no lamps on cylinder's sides. In one point can be only one lamp.

Output

Output the square of illuminated area of cylinder. You may assume that answers is coparated with the precision of 10 - 6.

ExamplesInput
0 0 10 10
1
0 0 100
Output
314.15926536
Input
0 0 10 10
4
-100 0 -100
0 -100 -25
100 0 25
0 100 100
Output
1256.63706144
Note

A Lamp illuminates bottom only if its z coordinate less than 0, and top if greats h. If a lamp in the plane of bottom it does not illuminate them, same situation with top.

加入题单

上一题 下一题 算法标签: