P25422 [AtCoder] Step Cut
普及+
题目描述

Problem Description

We decided to divide a wafer with radius $ R $ into $ N $ equally spaced sections. In this problem, a wafer is a thin circular disk used to make certain components.

96ec67e2d61b3fb02bf2567537bb1b7a.png

There are $ N-1 $ cut lines to divide the wafer into $ N $ sections, referred to as cut lines $1, 2, 3, \ldots, N-1$ from top to bottom. For convenience, cut lines $-M, \ldots, -1, 0$ and $N, N+1, \ldots, N+M-1$ also exist.

98d411f606a1e41e5652d4036bd37ebe.png

To divide the wafer into $ N $ sections, each of the cut lines $1, 2, 3, \ldots, N-1$ needs to be cut twice using a machine.

The machine performs cuts by specifying a number from $ 1 $ to $ N+M-1 $. When activated, it uses two blades to cut in parallel.

When the machine is activated with number $i (1 \leq i \leq N+M-1)$, the first blade cuts the $ i $th cut line, and the second blade cuts the $ i-M $th cut line. The cut length is represented by the length of the longer cut line. Here, the lengths of cut lines other than $1 \leq i \leq N-1$ (such as $ 0 $ or $ N $) can be considered as $ 0 $.

An example of the machine's operation is shown. For $ N=6, M=3 $, when the machine is activated with $ i=5 $, the cut lines $ 2 $ and $ 5 $ are cut as shown in the figure below. The cut length in this case is the length of the $ 2 $nd cut line because it is longer than the $ 5 $th cut line.

a9b41bd1c98af310f66e29ab6e333fbc.png

By sequentially activating the machine with numbers $1, 2, 3, \ldots, N+M-1$, each of the cut lines $1, 2, 3, \ldots, N-1$ can be cut twice. Output the total cut length when the wafer is divided into $ N $ sections using this procedure.

Input Format

The input is given from the standard input in the following format:

$ R $ $ N $ $ M $

Output Format

Output the answer in one line. Absolute or relative errors within $ 10^{-6} $ are acceptable.

Sample Input and Output

Sample Input #1

1 4 1

Sample Output #1

7.4641016151377546

Sample Input #2

40 37 5

Sample Output #2

2712.5411572217257024

Sample Input #3

100000 100000 1000

Sample Output #3

15907959408.6441142940893769

Notes/Hints

Constraints

  • $1 \leq R \leq 10^{5}$
  • $2 \leq N \leq 10^{5}$
  • $1 \leq M \leq N - 1$
  • $ R $ is an integer

Sample Explanation 1

When the first blade cuts the cut lines $ 1, 2, 3, 4 $ in order, the cut lengths are $\sqrt{3}, 2, 2, \sqrt{3}$, respectively. Note that the lengths of the $ 0 $th and $ 4 $th cut lines can be treated as $ 0 $.

输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
1 4 1
样例输出
7.4641016151377546