PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN

#GL0000279. Nỗi buồn của Taro khi tính trung bình (The Melancholy of Taro Heikinchi)

HỌC THEO LỘ TRÌNH

Bài tập thuộc lộ trình

1 lộ trình

Nỗi buồn của Taro khi tính trung bình (The Melancholy of Taro Heikinchi)

The Melancholy of Taro Heikinchi

Source: AtCoder

Version: Phuoc Hung OJ Extended

Problem Statement

Taro calculated the average of the integers 11 through NN by dividing their sum by NN, but accidentally omitted exactly one integer MM, where 1≤M≤N1\le M\le N. The erroneous average is X/YX/Y. Find all possible pairs (N,M)(N,M) sorted by increasing NN. The input fraction need not be reduced.

Input

One line contains X/Y: integer XX, a slash /, then integer YY.

Output

Print each pair N M on its own line in increasing NN; if none exists, print exactly Impossible.

Subtasks

  • Subtask 1 (20 points): 1≤X≤10181\le X\le 10^{18}; 1≤Y≤1091\le Y\le 10^9; 0<X/Y≤1000<X/Y\le 100.
  • Subtask 2 (30 points): 1≤X≤10181\le X\le 10^{18}; 1≤Y≤1091\le Y\le 10^9; 0<X/Y≤10000000<X/Y\le 1000000.
  • Subtask 3 (50 points): 1≤X≤10181\le X\le 10^{18}; 1≤Y≤1091\le Y\le 10^9; 0<X/Y≤10000000000<X/Y\le 1000000000.

Examples

Example 1

Input

4/3

Output

3 2

Explanation

For X/Y=4/3, the stated pair gives an omitted sum equal to N times this fraction; other candidate N values fail divisibility or 1<=M<=N.

Example 2

Input

4/6

Output

Impossible

Explanation

For X/Y=4/6, no positive integers N,M satisfy both the average equation and 1<=M<=N.

Example 3

Input

49995/10

Output

10000 10000

Explanation

For X/Y=49995/10, the stated pair gives an omitted sum equal to N times this fraction; other candidate N values fail divisibility or 1<=M<=N.

Example 4

Input

1/400

Output

Impossible

Explanation

For X/Y=1/400, no positive integers N,M satisfy both the average equation and 1<=M<=N.