import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        
        int a = Integer.parseInt(sc.next());
        int b = Integer.parseInt(sc.next());
        //String s = sc.next();
        
        int tmp=0;
        if(a<b){
            tmp = b;
            b=a;
            a=tmp;
        }
        //a>bになった
        while(a%b>0){
            tmp=a%b;
            a=b;
            b=tmp;
        }
        
        int k = Integer.parseInt(sc.next());
        tmp=0;
        int i=b+1;
        while(tmp<k){
            i--;
            if(b%i==0) tmp++;
        }
        
        System.out.println(i);
    }
} import java.util.*; util.* java public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        
        int a = Integer.parseInt(sc.next());
        int b = Integer.parseInt(sc.next());
        //String s = sc.next();
        
        int tmp=0;
        if(a<b){
            tmp = b;
            b=a;
            a=tmp;
        }
        //a>bになった
        while(a%b>0){
            tmp=a%b;
            a=b;
            b=tmp;
        }
        
        int k = Integer.parseInt(sc.next());
        tmp=0;
        int i=b+1;
        while(tmp<k){
            i--;
            if(b%i==0) tmp++;
        }
        
        System.out.println(i);
    }
} Main public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        
        int a = Integer.parseInt(sc.next());
        int b = Integer.parseInt(sc.next());
        //String s = sc.next();
        
        int tmp=0;
        if(a<b){
            tmp = b;
            b=a;
            a=tmp;
        }
        //a>bになった
        while(a%b>0){
            tmp=a%b;
            a=b;
            b=tmp;
        }
        
        int k = Integer.parseInt(sc.next());
        tmp=0;
        int i=b+1;
        while(tmp<k){
            i--;
            if(b%i==0) tmp++;
        }
        
        System.out.println(i);
    } main {
        Scanner sc = new Scanner(System.in);
        
        int a = Integer.parseInt(sc.next());
        int b = Integer.parseInt(sc.next());
        //String s = sc.next();
        
        int tmp=0;
        if(a<b){
            tmp = b;
            b=a;
            a=tmp;
        }
        //a>bになった
        while(a%b>0){
            tmp=a%b;
            a=b;
            b=tmp;
        }
        
        int k = Integer.parseInt(sc.next());
        tmp=0;
        int i=b+1;
        while(tmp<k){
            i--;
            if(b%i==0) tmp++;
        }
        
        System.out.println(i);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int a = Integer.parseInt(sc.next()); a Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc int b = Integer.parseInt(sc.next()); b Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc int tmp=0; tmp 0 if(a<b){
            tmp = b;
            b=a;
            a=tmp;
        } a<b a b {
            tmp = b;
            b=a;
            a=tmp;
        } tmp = b tmp b b=a b a a=tmp a tmp while(a%b>0){
            tmp=a%b;
            a=b;
            b=tmp;
        } a%b>0 a%b a b 0 {
            tmp=a%b;
            a=b;
            b=tmp;
        } tmp=a%b tmp a%b a b a=b a b b=tmp b tmp int k = Integer.parseInt(sc.next()); k Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc tmp=0 tmp 0 int i=b+1; i b+1 b 1 while(tmp<k){
            i--;
            if(b%i==0) tmp++;
        } tmp<k tmp k {
            i--;
            if(b%i==0) tmp++;
        } i-- i if(b%i==0) tmp++; b%i==0 b%i b i 0 tmp++ tmp System.out.println(i) System.out.println System.out System System.out i String[] args args public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        
        int a = Integer.parseInt(sc.next());
        int b = Integer.parseInt(sc.next());
        //String s = sc.next();
        
        int tmp=0;
        if(a<b){
            tmp = b;
            b=a;
            a=tmp;
        }
        //a>bになった
        while(a%b>0){
            tmp=a%b;
            a=b;
            b=tmp;
        }
        
        int k = Integer.parseInt(sc.next());
        tmp=0;
        int i=b+1;
        while(tmp<k){
            i--;
            if(b%i==0) tmp++;
        }
        
        System.out.println(i);
    }
} public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        
        int a = Integer.parseInt(sc.next());
        int b = Integer.parseInt(sc.next());
        //String s = sc.next();
        
        int tmp=0;
        if(a<b){
            tmp = b;
            b=a;
            a=tmp;
        }
        //a>bになった
        while(a%b>0){
            tmp=a%b;
            a=b;
            b=tmp;
        }
        
        int k = Integer.parseInt(sc.next());
        tmp=0;
        int i=b+1;
        while(tmp<k){
            i--;
            if(b%i==0) tmp++;
        }
        
        System.out.println(i);
    }
} Main
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        
        int a = Integer.parseInt(sc.next());
        int b = Integer.parseInt(sc.next());
        //String s = sc.next();
        
        int tmp=0;
        if(a<b){
            tmp = b;
            b=a;
            a=tmp;
        }
        //a>bになった
        while(a%b>0){
            tmp=a%b;
            a=b;
            b=tmp;
        }
        
        int k = Integer.parseInt(sc.next());
        tmp=0;
        int i=b+1;
        while(tmp<k){
            i--;
            if(b%i==0) tmp++;
        }
        
        System.out.println(i);
    }
}