Edward is a worker for Aluminum Cyclic Machinery. His work is operating mechanical arms to cut out designed models. Here is a brief introduction of his work.
Assume the operating plane as a two-dimensional coordinate system. At first, there is a disc with center coordinates $(0, 0)$ and radius $R$. Then, $m$ mechanical arms will cut and erase everything within its area of influence simultaneously, the $i$-th area of which is a circle with center coordinates $(x_i, y_i)$ and radius $r_i$ $(i = 1, 2, \cdots, m)$. In order to obtain considerable models, it is guaranteed that every two cutting areas have no intersection and no cutting area contains the whole disc.
Your task is to determine the perimeter of the remaining area of the disc excluding internal perimeter.
Here is an illustration of the sample, in which the red curve is counted but the green curve is not.