Birthday Paradox

View as PDF

Submit solution


Points: 1
Time limit: 1.0s
Memory limit: 256M

Problem types

The Birthday Paradox concerns the probability that, in a set of n randomly chosen people, some pair of them will have the same birthday. For groups of at least 23 people, the probability is more than 50% which may sound odd at first sight. METU CClub is curious about a more general form of the birthday paradox. If all of the final contest participants are randomly chosen, what is the probability that some \(M\) of them have the same birthday? Your task is to find the minimal number of participants such that this probability is at least \(P\) percent.

In this problem we ignore a leap year, i.e. there are 365 days in a year. For each particular participant, the probability of being born on a particular day is \(1/365\).

Input

Two integers \(M\) and \(P\) separated with a single space.

Output

The minimal number of participants.

Constraints
  • \(1 ≤ M ≤ 10\)
  • \(0 ≤ P ≤ 100\)
Examples

Input (stdin)

2 50
4 100

Output(stdout)

23
1096
Notes

In the second sample according to the Dirichlet's principle among \(1096\) (3 x 365 + 1) participants at least 4 have the same birthday.