This page is still under construction.

Parts of this page are still being built. What you see may change.

Points on a Circle

Time limit2sMemory limit512 MB

Summary
Given n random points on a unit circle and an angle p, compute -log2 of the probability that all n points fit inside some arc of central angle p.
Level

Hard8 of 10

Topics
Probability, Math, Combinatorics, Implementation
Solved
No attempts yet

Problem

You place nn points at random on the circumference of a circle of radius 1. Each point is equally likely to land anywhere on the circumference.

Let PP be the probability that all nn points lie on one arc of that same circle whose central angle is at most pp degrees. The arc may begin at any point of the circumference.

Because PP can be extremely small, print −log⁡2P-\log_2 P instead of PP.

Input

The first line contains the number of points nn and the angle pp. (1≤n≤1000001 \le n \le 100000, 1≤p<1801 \le p < 180)

Both nn and pp are positive integers.

Output

Print −log⁡2P-\log_2 P with exactly six digits after the decimal point, rounded at the seventh digit.

Examples3

  1. Example 1

    Input
    1 150
    
    Expected output
    0.000000
    
  2. Example 2

    Input
    2 179
    
    Expected output
    0.008037
    
  3. Example 3

    Input
    5 90
    
    Expected output
    5.678072