QOJ.ac

QOJ

Time Limit: 1 s Memory Limit: 512 MB Total points: 100

#16481. Left and Right

Statistics

Yuki has two integers $l$ and $r$. She wants you to solve a massive Diophantine equation, but it is simply too massive! Therefore, Yuki decides to test you instead: how many positive integers $x$ cannot be represented as a sum of one or more positive integers in the range $[l, r]$? Specifically, if there are infinitely many such integers, output infty.

Input

The input contains multiple test cases.

The first line contains an integer $t$ ($1 \leq t \leq 10^5$), representing the number of test cases. For each test case:

  • A single line containing two integers $l, r$ ($1 \leq l \leq r \leq 10^9$).

Output

For each test case: if the answer is finite, output a single integer on a line; otherwise, output the string infty.

Examples

Input 1

3
3 4
1 5
7 7

Output 1

3
0
infty

Note

For the first test case, only $x = 1, 2, 5$ cannot be represented.

For the third test case, it is clear that any $x$ such that $7 \nmid x$ cannot be represented.

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.