Jaehong's Ladder

Given a rectangle's width, height, and a number of vertical strips, sum the lengths of the N-1 rungs where the strips cross the rectangle's diagonals.

Medium4MathGeometryImplementationPrefix sumInterviewNo attempts yetTime limit2sMemory limit512 MB

Problem

Jaehong loves going up to the roof of his house. Last night's storm broke every ladder that led up there. He will use the two long logs he already owns as the side rails, buy wood only for the rungs, and build two ladders, the one he installs and a spare.

His design is this. He crosses the two logs of equal length at their midpoints so that the four endpoints form a rectangle of width WW and height HH. The two logs are then the diagonals of that rectangle. He cuts the rectangle into NN equal parts with vertical lines, and on each line the segment joining the two points where the line meets the logs becomes one rung. If the two points are at the same position, that rung has length 0. The rungs at the two ends rest on the ground, so he does not buy them, and only the N1N-1 inner lines count. Compute the total length of wood Jaehong has to buy for the rungs.

Input

The first line contains the width WW (1W100001 \le W \le 10000), the height HH (1H100001 \le H \le 10000), and the number of parts NN (2N100000002 \le N \le 10000000), in this order. All three values are natural numbers.

Output

Print the total length of wood needed for the rungs on one line, rounded to six digits after the decimal point. Ignore the girth and thickness of the logs and of the wood. No piece of wood is rotten or cut away, so every piece is whole.

Hint

The crossed logs with the rungs A_1 through A_{n-1}

The sum of all the lengths is S=A1+A2+A3++An1S = A_1 + A_2 + A_3 + \dots + A_{n-1}.