main :: IO ()
main = do
    [a, b, k] <- fmap (map read . words) getLine :: IO [Int]
    print $ solve a b k

solve :: Int -> Int -> Int -> Int
solve a b k =
    [ i | i <- [100, 99 .. 1], a `mod` i == 0, b `mod` i == 0 ] !! (k - 1)
