a, b, k = map(int, input().split())
ans = 0
for i in range(100):
    if a % (100-i) == 0 and b % (100-i) == 0:
        k -= 1
    if k == 0:
        ans = 100 - i
        print(ans)
        break a, b, k = map(int, input().split()) a map(int, input().split()) map int input().split() ().split () input split b k ans = 0 ans 0 for i in range(100):
    if a % (100-i) == 0 and b % (100-i) == 0:
        k -= 1
    if k == 0:
        ans = 100 - i
        print(ans)
        break i range(100) range 100 if a % (100-i) == 0 and b % (100-i) == 0:
        k -= 1
     a % (100-i) == 0 and b % (100-i) == 0 a % (100-i) == 0 a % (100-i) a 100-i 100 i 0 b % (100-i) == 0 b % (100-i) b 100-i 100 i 0 k -= 1 k 1 if k == 0:
        ans = 100 - i
        print(ans)
        break k == 0 k 0 ans = 100 - i ans 100 - i 100 i print(ans) print ans break ans = 0 0 ans a, b, k = map(int, input().split()) map(int, input().split()) a k -= 1 1 k ans = 100 - i 100 - i ans b, k = map(int, input().split()) map(int, input().split()) b k = map(int, input().split()) map(int, input().split()) k
a, b, k = map(int, input().split())
ans = 0
for i in range(100):
    if a % (100-i) == 0 and b % (100-i) == 0:
        k -= 1
    if k == 0:
        ans = 100 - i
        print(ans)
        break