#K53217. Minimum Steps to Target

    ID: 29483 Type: Default 1000ms 256MiB

Minimum Steps to Target

Minimum Steps to Target

A robot is initially located at the origin (0, 0) on a 2D grid. It can move one unit at a time in any of the four cardinal directions (up, down, left, right). Given a target point \((X, Y)\), determine the minimum number of steps required to reach that target from the origin. The minimum steps required is given by the Manhattan distance, which is expressed as \(|X| + |Y|\).

Note: The robot's movement is restricted to integer grid points. The input values for \(X\) and \(Y\) can be positive, negative, or zero.

inputFormat

The input consists of a single line containing two space-separated integers \(X\) and \(Y\) which represent the coordinates of the target point.

Constraints:

  • \(|X|, |Y| \leq 10^9\)

outputFormat

Output a single integer representing the minimum number of steps needed for the robot to reach the target point \((X, Y)\) from \((0, 0)\).

## sample
3 4
7