Codeforces Round 195 (Div. 2)
B
Vasily the Bear and Fly
Codeforces
1900
原题
← AC →
翻译中…

One beautiful day Vasily the bear painted $2*m*$ circles of the same radius $*R*$ on a coordinate plane. Circles with numbers from $1$ to $*m*$ had centers at points $(2*R* - *R*, 0)$, $(4*R* - *R*, 0)$, $...$, $(2*Rm* - *R*, 0)$, respectively. Circles with numbers from $*m* + 1$ to $2*m*$ had centers at points $(2*R* - *R*, 2*R*)$, $(4*R* - *R*, 2*R*)$, $...$, $(2*Rm* - *R*, 2*R*)$, respectively.

翻译中…

Naturally, the bear painted the circles for a simple experiment with a fly. The experiment continued for $*m*^{2}$ days. Each day of the experiment got its own unique number from $0$ to $*m*^{2} - 1$, inclusive.

翻译中…

On the day number $*i*$ the following things happened:

翻译中…
  1. The fly arrived at the coordinate plane at the center of the circle with number image (image is the result of dividing number $*x*$ by number $*y*$, rounded down to an integer).
  2. The fly went along the coordinate plane to the center of the circle number image (image is the remainder after dividing number $*x*$ by number $*y*$). The bear noticed that the fly went from the center of circle $*v*$ to the center of circle $*u*$ along the shortest path with all points lying on the border or inside at least one of the $2*m*$ circles. After the fly reached the center of circle $*u*$, it flew away in an unknown direction.
翻译中…

Help Vasily, count the average distance the fly went along the coordinate plane during each of these $*m*^{2}$ days.

翻译中…

Input

翻译中…

The first line contains two integers $*m*, *R*$ ($1 ≤ *m* ≤ 10^{5}$, $1 ≤ *R* ≤ 10$).

翻译中…

Output

翻译中…

In a single line print a single real number — the answer to the problem. The answer will be considered correct if its absolute or relative error doesn't exceed $10^{ - 6}$.

翻译中…

Note

翻译中…

image

翻译中…

Figure to the second sample

翻译中…

样例

Input #1
1 1
Output #1
2.0000000000
InputCopy OutputCopy
Input #2
2 2
Output #2
5.4142135624
InputCopy OutputCopy
题目信息
题号
336B
时间限制
1 s
内存限制
256 MB
标签
数学

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。