import Control.Monad
import Control.Applicative
import Data.List

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



solve :: Int -> Int -> Int -> Int
solve a b k =  foldl f [] [1..100] !! (k-1)
    where
      f ::  [Int] -> Int -> [Int]
      f lst n
          | a `mod` n == 0 && b `mod` n == 0 = n:lst
          | otherwise                        = lst
