F - S = 1 Editorial /

Time Limit: 2 sec / Memory Limit: 1024 MB

配点 : 525

問題文

整数 X, Y が与えられます。X, YX \neq 0Y \neq 0 の少なくとも一方を満たします。
次の条件を全て満たす整数の組 (A, B) を発見してください。そのような整数の組が存在しない場合はそれを報告してください。

  • -10^{18} \leq A, B \leq 10^{18}
  • xy 平面上の点 (0, 0), (X, Y), (A, B) を頂点とする三角形の面積は 1

制約

  • -10^{17} \leq X, Y \leq 10^{17}
  • (X, Y) \neq (0, 0)
  • X, Y は整数

入力

入力は以下の形式で標準入力から与えられる。

X Y

出力

条件を満たす整数の組 (A, B) が存在する場合は以下の形式で出力せよ。

A B

条件を満たす整数の組 (A, B) が存在しない場合は -1 を出力せよ。


入力例 1

3 5

出力例 1

1 1

(0, 0), (3, 5), (1, 1) を頂点とする三角形の面積は 1 です。よって (A, B) = (1, 1) は条件を満たします。


入力例 2

-2 0

出力例 2

0 1

入力例 3

8752654402832944 -6857065241301125

出力例 3

-1

Score: 525 points

Problem Statement

You are given integers X and Y, which satisfy at least one of X \neq 0 and Y \neq 0.
Find a pair of integers (A, B) that satisfies all of the following conditions. If no such pair exists, report so.

  • -10^{18} \leq A, B \leq 10^{18}
  • The area of the triangle with vertices at points (0, 0), (X, Y), (A, B) on the xy-plane is 1.

Constraints

  • -10^{17} \leq X, Y \leq 10^{17}
  • (X, Y) \neq (0, 0)
  • X and Y are integers.

Input

The input is given from Standard Input in the following format:

X Y

Output

If there is a pair of integers (A, B) that satisfies the conditions, print it in the following format:

A B

Otherwise, print -1.


Sample Input 1

3 5

Sample Output 1

1 1

The area of the triangle with vertices at points (0, 0), (3, 5), (1, 1) is 1. Thus, (A, B) = (1, 1) satisfies the conditions.


Sample Input 2

-2 0

Sample Output 2

0 1

Sample Input 3

8752654402832944 -6857065241301125

Sample Output 3

-1