Darts

Time limit1sMemory limit128 MB

Problem

Every Friday evening, Bill and his friends go to a small pub to have a few beers and play darts. They all know that their darts skill fades at the same rate as the beer left in their mugs.

They always play 501, one of the simplest darts games. Each player starts with a score of $N$ points (usually $N = 501$, which is where the name comes from) and the players take turns throwing a single dart. On each throw the player's score drops by the value of the section the dart hits, unless that would make the score negative — in that case the score is left unchanged. The first player whose score reaches exactly $0$ wins.

The dartboard. The board is divided into $20$ sections. Read clockwise, their values are

$$20,\ 1,\ 18,\ 4,\ 13,\ 6,\ 10,\ 15,\ 2,\ 17,\ 3,\ 19,\ 7,\ 16,\ 8,\ 11,\ 14,\ 9,\ 12,\ 5$$

The board is circular, so the last section (value $5$) sits next to the first (value $20$). Two sections are adjacent when they are neighbours in this clockwise order.

Two players, A and B, use different strategies:

  • Player A throws at random: the dart lands in each of the $20$ sections with equal probability $\frac{1}{20}$.
  • Player B aims at a chosen section. Because of the beer, the dart is equally likely to land in the aimed section or in either of its two adjacent sections — each of those three sections with probability $\frac{1}{3}$. Player B is fully aware of this and always aims at the section that maximizes the probability of winning.

Both players start from the same score $N$. Throwing first can be an advantage, so the winning probability depends on who starts.

Input

The input contains several lines. Each line has one integer $N$ ($1 \le N \le 501$), the starting score shared by both players. A line with $N = 0$ marks the end of the input and must not be processed.

Output

For each score $N$, print one line with two numbers separated by a single space:

  • the probability that A wins when A throws the first dart, and
  • the probability that B wins when B throws the first dart.

Print each probability rounded to exactly $6$ decimal places (for example, 0.136364). Your output is checked for an exact match, so follow this format precisely.