#CCBOTPBA0000054. Mốc đầu tiên chia hết cả a và b (First Common Multiple at or Above L)

Mốc đầu tiên chia hết cả a và b (First Common Multiple at or Above L)

First Common Multiple at or Above L

Source: Phước Hưng OJ

Version: Phuoc Hung OJ Extended

Problem Statement

Given three positive integers aa, bb, and LL, find the smallest positive integer xx such that x≥Lx\ge L and xx is divisible by both aa and bb. If LL is already divisible by both, the answer is LL.

Input

One line contains three positive integers aa, bb, and LL, in that order.

Output

Print one integer: the smallest x≥Lx\ge L divisible by both aa and bb.

Subtasks

  • Subtask 1 (20%): 1lea,ble10,1leLle1001\\le a,b\\le10,\\ 1\\le L\\le100.
  • Subtask 2 (30%): 1lea,ble50,1leLle10001\\le a,b\\le50,\\ 1\\le L\\le1000.
  • Subtask 3 (50%): 1lea,ble100,1leLle100001\\le a,b\\le100,\\ 1\\le L\\le10000.

Examples

Example 1

Input:

4 6 13

Output:

24

Explanation: The first multiples of 4 at or above 13 are 16, 20 and 24. Only 24 among them is also divisible by 6; no smaller valid number exists.

Example 2

Input:

5 5 10

Output:

10

Explanation: Here a=b=5a=b=5 and 1010 is divisible by both, so the starting bound is the answer.

Example 3

Input:

7 9 1

Output:

63

Explanation: The least positive common multiple of 7 and 9 is 63; none of 1 through 62 works.