Limits 1s, 512 MB

You are given a pyramid with a polygonal base. Can you calculate the volume and surface area of the slanted surface (inclined surface or total surface excluding the surface of the base) of the pyramid? Formally speaking, let's consider the apex of the pyramid at points (0, 0, H) in 3D space. The base of the pyramid is a simple polygon with N vertices located on the XY plane of 3D space.

Input

The first line of the input contains an integer T (0 < T < 101) representing the number of test cases. Each test case starts with two integers N and H which denote the number of vertices on the base and the height of the pyramid respectively (3 ≤ N, H ≤ 100). Next N lines, each contains two integers x, y (-100 ≤ x, y ≤ 100). Vertices of the base will be given in counter-clockwise order.

Output

For each case print the volume and surface area of the slanted surface of the pyramid separated by space. Errors less than 10-6 will be ignored.

Sample

InputOutput
2
4 5
0 0
1 0
1 1
0 1
3 3
-2 -2
2 -2
0 3

1.666666667 10.099019514
10.000000000 24.444790491

Submit

Login to submit.

Statistics

91% Solution Ratio
NirjhorEarliest, Jul '18
mumith_fahim99Fastest, 0.0s
NirjhorLightest, 131 kB
nmunimShortest, 889B
Toph uses cookies. By continuing you agree to our Cookie Policy.