Codeforces Round 468 (Div. 2, based on Technocup 2018 Final Round)
A
Friends Meeting
Codeforces
800
原题
←B →
翻译中…

Two friends are on the coordinate axis $*Ox*$ in points with integer coordinates. One of them is in the point $*x*_{1} = *a*$, another one is in the point $*x*_{2} = *b*$.

翻译中…

Each of the friends can move by one along the line in any direction unlimited number of times. When a friend moves, the tiredness of a friend changes according to the following rules: the first move increases the tiredness by $1$, the second move increases the tiredness by $2$, the third — by $3$ and so on. For example, if a friend moves first to the left, then to the right (returning to the same point), and then again to the left his tiredness becomes equal to $1 + 2 + 3 = 6$.

翻译中…

The friends want to meet in a integer point. Determine the minimum total tiredness they should gain, if they meet in the same point.

翻译中…

Input

翻译中…

The first line contains a single integer $*a*$ ($1 ≤ *a* ≤ 1000$) — the initial position of the first friend.

翻译中…

The second line contains a single integer $*b*$ ($1 ≤ *b* ≤ 1000$) — the initial position of the second friend.

翻译中…

It is guaranteed that $*a* ≠ *b*$.

翻译中…

Output

翻译中…

Print the minimum possible total tiredness if the friends meet in the same point.

翻译中…

Note

翻译中…

In the first example the first friend should move by one to the right (then the meeting happens at point $4$), or the second friend should move by one to the left (then the meeting happens at point $3$). In both cases, the total tiredness becomes $1$.

翻译中…

In the second example the first friend should move by one to the left, and the second friend should move by one to the right. Then they meet in the point $100$, and the total tiredness becomes $1 + 1 = 2$.

翻译中…

In the third example one of the optimal ways is the following. The first friend should move three times to the right, and the second friend — two times to the left. Thus the friends meet in the point $8$, and the total tiredness becomes $1 + 2 + 3 + 1 + 2 = 9$.

翻译中…

样例

Input #1
3
4
Output #1
1
InputCopy OutputCopy
Input #2
101
99
Output #2
2
InputCopy OutputCopy
Input #3
5
10
Output #3
9
InputCopy OutputCopy
题目信息
题号
931A
时间限制
1 s
内存限制
256 MB
标签
暴力
贪心
模拟
数学

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。