QOJ.ac

QOJ

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

#16567. Treasure Chest

Statistics

Little C likes to collect treasure chests in a game called Abyss.

Little C is currently on a number line at the origin.

There are two treasure chests on this number line at coordinates $a$ and $b$, respectively.

As soon as Little C moves to the position of a treasure chest, he is considered to have collected it. Specifically, if Little C is at the position of a treasure chest initially, he collects it immediately; if both treasure chests are at the same position, he can collect both at the same time.

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

Input

Two integers $a$ and $b$.

Output

A single integer representing the minimum number of moves required for Little C to collect both treasure chests.

Examples

Input 1

1 -1

Output 1

3

Note 1

Little C can move in the negative direction $1$ time, then move in the positive direction $2$ times.

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

Input 2

-5 0

Output 2

5

Note 2

Little C can move directly in the negative direction $5$ times.

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

Input 3

51 -154

Output 3

256

Constraints

For $100\%$ of the data, $|a|, |b| \le 200$.

Test Case ID Special Properties
$1\sim3$ Guaranteed $ a , b \le 1$
$4\sim6$ Guaranteed $ab=0$
$7\sim10$ None

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.