#C3801. Common Page Count

    ID: 47269 Type: Default 1000ms 256MiB

Common Page Count

Common Page Count

Jamie and Sam are avid readers who choose books in a peculiar manner. Jamie always picks a book with a number of pages that is a multiple of A, and Sam selects a book with a page count that is a multiple of B. They both want to read a book with the same number of pages. Your task is to help them by finding the smallest number of pages that satisfies both conditions.

This problem can be mathematically formulated as finding the least common multiple (LCM) of two numbers. Recall that the LCM of two integers \(A\) and \(B\) can be computed using the relation:

\[ \text{LCM}(A, B) = \frac{|A \times B|}{\gcd(A, B)} \]

Input will consist of multiple test queries and for each query, you need to print the resulting common page count on a new line.

inputFormat

The input is given via standard input. The first line contains an integer (T) representing the number of queries. Each of the following (T) lines contains two space-separated integers (A) and (B).

outputFormat

For each query, output a single line containing the smallest common page count (i.e. the least common multiple of (A) and (B)).## sample

5
4 6
10 15
7 5
21 6
100 75
12

30 35 42 300

</p>