PROGRAM ATCODER

implicit none
integer :: a,b,k,i,c

read(*,*) a,b,k    !ここが入力欄

c = 0
do i = 100, 1, -1
	if(mod(a,i) == 0 .and. mod(b,i) == 0)then
		c = c + 1
	end if
    if(c == k)then
    	write(*,'(I0)') i
        stop
    end if
end do


END PROGRAM ATCODER