#abc369a. A - 369

A - 369

Score : 100100 points

问题陈述

给定两个整数 AABB

有多少个整数 xx 满足以下条件?

  • 条件:可以以某种顺序排列这三个整数 AABBxx 以形成一个等差数列。

如果三个整数 ppqqrr 按照这个顺序排列,那么它们构成一个等差数列,当且仅当 qpq-p 等于 rqr-q

以上为大语言模型 kimi 翻译,仅供参考。

Problem Statement

You are given two integers AA and BB.

How many integers xx satisfy the following condition?

  • Condition: It is possible to arrange the three integers AA, BB, and xx in some order to form an arithmetic sequence.

A sequence of three integers pp, qq, and rr in this order is an arithmetic sequence if and only if qpq-p is equal to rqr-q.

Constraints

  • 1A,B1001 \leq A,B \leq 100
  • All input values are integers.

Input

The input is given from Standard Input in the following format:

AA BB

Output

Print the number of integers xx that satisfy the condition in the problem statement. It can be proved that the answer is finite.

Sample Input 1

5 7

Sample Output 1

3

The integers x=3,6,9x=3,6,9 all satisfy the condition as follows:

  • When x=3x=3, for example, arranging x,A,Bx,A,B forms the arithmetic sequence 3,5,73,5,7.
  • When x=6x=6, for example, arranging B,x,AB,x,A forms the arithmetic sequence 7,6,57,6,5.
  • When x=9x=9, for example, arranging A,B,xA,B,x forms the arithmetic sequence 5,7,95,7,9.

Conversely, there are no other values of xx that satisfy the condition. Therefore, the answer is 33.

Sample Input 2

6 1

Sample Output 2

2

Only x=4x=-4 and 1111 satisfy the condition.

Sample Input 3

3 3

Sample Output 3

1

Only x=3x=3 satisfies the condition.