#abc120b. [abc120_b]K-th Common Divisor
[abc120_b]K-th Common Divisor
Problem Statement
You are given positive integers and .
Find the -th largest positive integer that divides both and .
The input guarantees that there exists such a number.
Constraints
- All values in input are integers.
- The -th largest positive integer that divides both and exists.
Input
Input is given from Standard Input in the following format:
Output
Print the -th largest positive integer that divides both and .
Sample Input 1
8 12 2
Sample Output 1
2
Three positive integers divides both and : and . Among them, the second largest is .
Sample Input 2
100 50 4
Sample Output 2
5
Sample Input 3
1 1 1
Sample Output 3
1