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

#GL0000077. Tìm số bổ sung để đạt BCNN cho trước (Finding LCM)

HỌC THEO LỘ TRÌNH

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

1 lộ trình

Tìm số bổ sung để đạt BCNN cho trước (Finding LCM)

Finding LCM

Source: LightOJ

Version: Phuoc Hung OJ Extended

Problem Statement

You are given positive integers aa, bb, and LL. Find the smallest positive integer cc such that lcm⁡(a,b,c)=L\operatorname{lcm}(a,b,c)=L. If no such positive integer exists, print the lowercase word impossible.

Input

A line containing three integers aa, bb, LL.

Output

Print the minimum value cc, or impossible if there is no solution.

Subtasks

  • Subtask 1 (20 points): 1≤a,b≤301\le a,b\le30, 1≤L≤1031\le L\le10^3.

  • Subtask 2 (30 points): 1≤a,b≤1031\le a,b\le10^3, 1≤L≤1081\le L\le10^8.

  • Subtask 3 (50 points): 1≤a,b≤1061\le a,b\le10^6, 1≤L≤10121\le L\le10^{12}.

Examples

Input

3 5 30

Output

2

Explanation

lcm⁡(3,5,2)=30\operatorname{lcm}(3,5,2)=30. With c=1c=1 the LCM would only be 1515, so 22 is the smallest possible value.