beecrowd | 1352

Square Lottery

ACM/ICPC South America Contest, Warm-Up Brazil

Timelimit: 1

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.

Fig. 1: A sample lottery ticket, for N = 3.

In each ticket no number appears twice, and therefore all numbers from 1 to N2 are present (in random positions). There won't be two equal tickets sold in the same week. 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 N2) 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 will contain several test cases. Each test case is described in a line containing an integer N and a floating-point 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.0). The end of input is indicated by N = P = 0.


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 two digits precision, and the last decimal digit must be rounded. The input will not contain test cases where differences in rounding are significant.

Sample Input Sample Output

2 100.0
2 80.0
3 50.0
0 0.0