{"trustable":false,"sections":[{"title":"Description","value":{"format":"MD","content":"每天你都会在某OJ上交若干次题。每次交题AC的概率都为p。你有百折不挠的精神,会一直交到这天AC率大于p时才结束。由于评测姬也要休息,你一天最多只能交n次,如果AC率一直不超过p,你会从此再也不在该OJ上交题。求平均在该OJ上会交多少天题。可认为每次交题相互独立。"}},{"title":"Input","value":{"format":"MD","content":"输入包含若干行。\n第一行一个整数N,表示组数。\n接着N行每行包含p和n,p用分数的形式表示。\n\n1 ≤ N ≤ 3000, 0 ≤ p \u003c 1,\np的分母不超过1000,\n1 ≤ n ≤ 100."}},{"title":"Output","value":{"format":"MD","content":"每组数据输出一行形式如下,答案向下取整。"}},{"title":"Sample Input","value":{"format":"MD","content":"4\n1/2 1\n1/2 2\n0/1 10\n1/2 3\n"}},{"title":"Sample Output","value":{"format":"MD","content":"Case #1: 2\nCase #2: 2\nCase #3: 1\nCase #4: 2\n"}}]}