P26737 [AtCoder] Calculation
普及
题目描述

Problem Description

Given two integers $ A $ and $ B $. Output the maximum and minimum values among $ A+B $ and $ A-B $ in that order.

Input Format

The input is given from the standard input in the following format:

$ A $ $ B $

Output Format

The output consists of two lines.

On the first line, output the maximum value among $ A+B $ and $ A-B $.

On the second line, output the minimum value among $ A+B $ and $ A-B $.

Sample Input and Output

Sample Input #1

-2 1

Sample Output #1

-1
-3

Sample Input #2

-3 -4

Sample Output #2

1
-7

Sample Input #3

5 0

Sample Output #3

5
5

Notes/Hints

Constraints

  • $-100 \leq A \leq 100$.
  • $-100 \leq B \leq 100$.

Sample Explanation 1

- $ (-2)+1=-1 $ - $ (-2)-1=-3 $ Therefore, output the maximum value $ -1 $ and the minimum value $ -3 $ separated by a newline.

Sample Explanation 2

- $ (-3)+(-4)=-7 $ - $ (-3)-(-4)=1 $ Therefore, output $ 1 $ on the first line and $ -7 $ on the second line.

输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

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