P30004 [洛谷] "MXOI Round 1" Treasure Chest
普及-
题目描述

Problem Description

Xiao C enjoys collecting treasure chests in a game called "Profound Abyss."

Currently, Xiao C is on a number line at the origin.

There are also two treasure chests on this number line, with coordinates \(a\) and \(b\) respectively.

Whenever Xiao C moves to the position of a treasure chest, it is considered that he has collected that treasure chest. Specifically, if Xiao C is initially at the position of a treasure chest, he can collect it directly; if both treasure chests are at the same position, he can collect both simultaneously.

Xiao C can move one unit length along the positive or negative direction of the number line. Xiao C wants to know the minimum number of moves required to collect both treasure chests.

Input Format

Two integers \(a, b\).

Output Format

An integer representing the minimum number of moves required for Xiao C to collect both treasure chests.

Sample Input and Output

Sample Input #1

1 -1

Sample Output #1

3

Sample Input #2

-5 0

Sample Output #2

5

Sample Input #3

51 -154

Sample Output #3

256

Notes

Sample Explanation #1

Xiao C can first move 1 unit in the negative direction, then 2 units in the positive direction.

It can be proven that Xiao C needs at least 3 moves.

Sample Explanation #2

Xiao C can directly move 5 units in the negative direction.

It can be proven that Xiao C needs at least 5 moves.

Data Range

For 100% of the data, \(\vert a \vert, \vert b \vert \le 200\).

Test Point Number Special Property
\(1\sim3\) Guaranteed \(\vert a \vert, \vert b \vert \le 1\)
\(4\sim6\) Guaranteed \(ab = 0\)
\(7\sim10\) None
输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
1 -1
样例输出
3