P28238 [洛谷] 【XR-4】Problem
提高
题目描述

Background

Reminder during the contest: $0$ is a natural number, and natural numbers are non-negative integers.

Problem Description

Little X encountered a problem:

Given natural numbers $a$ and $b$, find the number of natural number pairs $(x, y)$ that satisfy the following condition:

$$y^2 - x^2 = ax + b$$

He doesn't know how to solve it, so he turns to you, who is proficient in mathematics, for help.

If there are infinitely many natural number pairs that satisfy the condition, you only need to output inf.

Input Format

One line containing two integers $a$ and $b$.

Output Format

If the number of pairs is finite, output one integer on one line, representing the count.

If the number of pairs is infinite, output one string inf on one line.

Sample Input and Output

Sample Input #1

5 15

Sample Output #1

1

Sample Input #2

4 4

Sample Output #2

inf

Sample Input #3

12 6

Sample Output #3

0

Sample Input #4

96 96

Sample Output #4

7

Sample Input #5

10000 9999997

Sample Output #5

6

Notes

Sample #1 Explanation

$$(x, y) = (6, 9)$$


Data Range

This problem uses batched testing.

  • Subtask 1 (3 points): $a = b = 0$.
  • Subtask 2 (6 points): $0 \le a, b \le 2$, there are no infinite solutions.
  • Subtask 3 (9 points): $0 \le a, b \le 100$, there are no infinite solutions.
  • Subtask 4 (13 points): $0 \le a, b \le 10^3$, there are no infinite solutions.
  • Subtask 5 (14 points): $0 \le a \le 10^4$, $0 \le b \le 10^7$.
  • Subtask 6 (14 points): $a = 0$.
  • Subtask 7 (14 points): $b = 0$.
  • Subtask 8 (27 points): No special restrictions.

For $100\%$ of the data, $0 \le a \le 10^8$, $0 \le b \le 10^{15}$.

输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
5 15
样例输出
1