Square Lottery

Time Limit: 2 Seconds
Memory Limit: 65536 KB

The government of the United Republic of Little Tower is developing a new kind
of lottery. The main purpose of the lottery is to raise money to build Little
Tower's Olympic Stadium, for an attendance of 400,000 people. The stadium is
strategic for Little Tower's proposal to host the World Cup Finals in 2078.

The lottery will run weekly. Each week, tickets in the form of square cards
will be sold. Each ticket will have squares with printed numbers within, in
a sequence of N rows and N columns, as shown in Figure 1.

In each ticket no number appears twice, and therefore all numbers from 1 to
N^2 are present (in random positions). No two tickets sold in the same week
will be equal. Nevertheless, all possible different tickets will be sold, since
Little Tower's citizens love lotteries. Tickets will be sold for T$1.00 (one
Torreal, Little Tower's monetary unit).

To choose the winner(s), four numbers (between 1 and N^2) will be picked randomly,
and the ticket(s) whose chosen numbers positions are corners of a square will
be awarded the prize money. For example, the ticket shown in Figure 1 is a winning
ticket if the numbers picked are (6, 3, 2, 9), (1, 4, 2, 5) or (7, 8, 9, 6),
but it is not a winning ticket if the numbers picked are (1, 7, 2, 9). If more
than one ticket is a winner, customers who bought those tickets will share the
week's lottery prize.

The government of Little Tower asks your help to determine the prize value to
be payed for each winning ticket, for a given N, and a given percentage, over
the total amount received for the tickets, that the government wants to pay
as prizes.

**Input**

Input will contain several test cases. Each test case is described in a line
containing two integers N and P, representing respectively the number of rows
(and columns) of tickets, and the percentage of the money received that will
be payed as prize (2 <= N <= 100 and 0 <= P <= 100). The end of
input is indicated by N = P = 0.

**Output**

For each test case in the input your program should produce one line of output,
containing a real value representing the prize to be payed to each winning ticket.
The prize value must be printed with twodigit precision, and the last decimal
digit must be rounded. The input will not contain test cases where differences
in rounding are significant.

**Sample Input**

2 100

2 80

3 50

0 0

**Sample Output**

1.00

0.80

10.50

Source:

**South America 2002, Practice**
Submit
Status