The best approximation of pi
The number "(pi)" represents the ratio of a circle's circumference to its diameter, a concept known to humans since ancient times. Over the centuries, people have sought to determine the numerical value of (pi). One method involved expressing (pi) as a common fraction. For instance, in Ancient Greece, the approximation (355/113) was used.
Your task is to find the best approximation of (pi) in the form of a common fraction.
For this problem, use the value (pi ≈ 3.1415926535897932385).
Input
The input consists of two integers (N) and (M) ((1 ≤ N, M ≤ 1000)), provided in a single line separated by a space.
Output
The output should be two integers (P) and (R), separated by a space, such that (1 ≤ P ≤ N), (1 ≤ R ≤ M), and the irreducible fraction (P/R) is the best approximation of (pi).