#ABC120B. [ABC120B] K-th Common Divisor

[ABC120B] K-th Common Divisor

提示:该题测试数据补录中,暂不支持评测提交。

No testdata at current.

No submission language available for this problem.

Score : 200200 points

Problem Statement

You are given positive integers AA and BB.

Find the KK-th largest positive integer that divides both AA and BB.

The input guarantees that there exists such a number.

Constraints

  • All values in input are integers.
  • 1≤A,B≤1001 \leq A, B \leq 100
  • The KK-th largest positive integer that divides both AA and BB exists.
  • K≥1K \geq 1

Input

Input is given from Standard Input in the following format:

AA BB KK

Output

Print the KK-th largest positive integer that divides both AA and BB.

8 12 2
2

Three positive integers divides both 88 and 1212: 1,21, 2 and 44. Among them, the second largest is 22.

100 50 4
5
1 1 1
1