Problems
Queen
Queen
Compute how many squares on average does a queen attack on a generalized chess board n × n.
The queen attacks a square if it is on the same row, column or diagonal. For example, the queen denoted by the letter Q in the image bellow attacks 17 squares marked with dots:
Input
The first line contains positive integer n (1 ≤ n ≤ 106
), the number of lines and columns of a board.
Output
The output consists of one real number rounded to exactly three decimal places, the average number of fields attacked by a queen.
Input example #1
3
Output example #1
6.222