{"trustable":true,"sections":[{"title":"","value":{"format":"HTML","content":"\u003cdiv\u003e\u003cp\u003eKing Arthur is an narcissist who intends to spare no coins to celebrate his coming \u003ci\u003eK\u003c/i\u003e-th birthday. The luxurious celebration will start on his birthday and King Arthur decides to let fate tell when to stop it. Every day he will toss a coin which has probability \u003ci\u003ep\u003c/i\u003e that it comes up heads and 1-\u003ci\u003ep\u003c/i\u003e up tails. The celebration will be on going until the coin has come up heads for \u003ci\u003eK\u003c/i\u003e times. Moreover, the king also decides to spend 1 thousand coins on the first day\u0027s celebration, 3 thousand coins on the second day\u0027s, 5 thousand coins on the third day\u0027s ... The cost of next day will always be 2 thousand coins more than the previous one\u0027s. Can you tell the minister how many days the celebration is expected to last and how many coins the celebration is expected to cost?\u003c/p\u003e\u003c/div\u003e"}},{"title":"Input","value":{"format":"HTML","content":"\u003cp\u003eThe input consists of several test cases. \u003cbr\u003eFor every case, there is a line with an integer \u003ci\u003eK\u003c/i\u003e ( 0 \u0026lt; \u003ci\u003eK\u003c/i\u003e ≤ 1000 ) and a real number \u003ci\u003ep\u003c/i\u003e (0.1 ≤ p ≤ 1). \u003cbr\u003eInput ends with a single zero.\u003c/p\u003e"}},{"title":"Output","value":{"format":"HTML","content":"\u003cp\u003eFor each case, print two number -- the expected number of days and the expected number of coins (in thousand), with the fraction rounded to 3 decimal places.\u003c/p\u003e"}},{"title":"Sample","value":{"format":"HTML","content":"\u003ctable class\u003d\u0027vjudge_sample\u0027\u003e\n\u003cthead\u003e\n \u003ctr\u003e\n \u003cth\u003eInput\u003c/th\u003e\n \u003cth\u003eOutput\u003c/th\u003e\n \u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd\u003e\u003cpre\u003e1 1\r\n1 0.5\r\n0\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e1.000 1.000\r\n2.000 6.000\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}}]}