#Lutece1487. 卿学姐把妹

卿学姐把妹

Migrated from Lutece 1487 卿学姐把妹

All parts of this problem, including description, images, samples, data and checker, might be broken. If you find bugs in this problem, please contact the admins.

Description

卿学姐要去把妹了!!

卿学姐要把NN个妹子

每个妹子被勾搭成功的概率是PP

卿学姐想先定个小目标KK

使得恰好有KK个妹子被勾搭的概率最大!!

卿学姐想知道KK是多少?

如果有多个KK,输出最大的那个

Input

第一行一个整数TT,表示有多少个测试点

第二行三个整数N,A,BN,A,BNN表示妹子的数量,把妹成功的概率是P=A/BP=A/B

1N10161\le N \le 10^{16}

1A1091\le A \le 10^9

AB109A\le B \le 10^9

1T10001\le T \le 1000

Output

一个整数KK

Samples

2
2 1 2
3 1 1
1
3

Resources

每周一题 div2