#P10869. [HBCPC2024] LCMs

[HBCPC2024] LCMs

题目描述

Walk Alone has a number axis with only positive integers on it. The cost of walking from point on integer aa to point on integer bb is lcm(a,b){\rm lcm}(a, b), where lcm(a,b){\rm lcm}(a, b) means the least common multiple of integers aa and bb. Due to the hatred of the integer 11, Walk Alone forbids anyone from moving to points on integers smaller than or equal to\textbf{smaller than or equal to} 11.

Given two integers aa and bb, you need to calculate the minimal cost of walking from point on integer aa to bb.

输入格式

There are TT (1T10001 \le T \le 1000) test cases.

In each test case, there is only one line containing two integers aa and bb (2ab1072 \le a \le b \le 10^7), denoting the start and end point.

输出格式

For each test case, output a single integer denoting the minimal cost.

3
3 4
10 15
2 4
10
25
4

提示

In the first test case, you can walk such a path: 3243 \to 2 \to 4, where the total cost is lcm(3,2)+lcm(2,4)=6+4=10{\rm lcm}(3, 2) + {\rm lcm}(2, 4) = 6 + 4 = 10, which can be proved to be the minimum.