#C5077. Optimal Intermediary Point

    ID: 48686 Type: Default 1000ms 256MiB

Optimal Intermediary Point

Optimal Intermediary Point

You are given two integers A and B, which denote the coordinates of a destination point (A, B) in a 2D grid with the origin at (0, 0). Your task is to determine an optimal intermediary point (X, Y) such that the sum of the Manhattan distances from (0, 0) to (X, Y) and from (X, Y) to (A, B) is minimized.

It can be proven that selecting

\( X = \lfloor A/2 \rfloor \quad \text{and} \quad Y = \lfloor B/2 \rfloor \)

yields an optimal solution.

inputFormat

The input is given via stdin and consists of two space-separated integers A and B, where A and B represent the coordinates of the destination point.

outputFormat

Output via stdout the two integers X and Y separated by a space, representing the optimal intermediary point.## sample

5 3
2 1