← Back to Problems
The Best Constant
Easy standard Calculus & Analysis
Time limit: 2 s per test  ·  Memory: 256 MB

For a rational number a = p / q with a > 0, find the largest constant C such that

e^x >= C * x^a for all x > 0.

Input

The first line contains the integer T. Each of the next T lines contains the integers p and q describing one query.

Output

T lines, the constant C for each query in order. Answers within absolute or relative error 10^-9 are accepted.

Constraints

1 <= T <= 10^4

1 <= p, q <= 10^6

0 < p / q <= 100

Scoring

This is a standard problem: a submission scores full points if it produces the correct output for every test case, and zero otherwise.

Numeric answers are accepted if they are within an absolute tolerance of 1e-09 or a relative tolerance of 1e-09 of the expected value.

Examples

input
3
1 1
2 1
1 2
output
2.718281828459045
1.8472640247326626
2.331643981597124
input
3
100 1
4 2
271828 100000
output
2.6881171418161354e-157
1.8472640247326626
1.000001828460102
Python 3.13 i Execution environment Isolated microVM · 1 vCPU · no internet access Time and memory limits are set per problem Available packages numpy 2.5.0scipy 1.18.0pandas 3.0.0scikit-learn 1.9.0statsmodels 0.15.0cvxpy 1.9.2