import java.util.Scanner;

public class Main {

    public static int Max;

    public static void main(String[] args)
    {
        Scanner scan =new Scanner(System.in);
	    int x=scan.nextInt();
        int y=scan.nextInt();

        Common_Divisir(x,y);

        System.out.println(Max);
    }

    public static void Common_Divisir(int a, int b)
    {
        int c=a%b;
        if(c!=0){
            a=b;
            b=c;
            Common_Divisir(a,b);
        }
        if(c==0){
            Max=b;
        }
    }
} import java.util.Scanner; Scanner java.util public class Main {

    public static int Max;

    public static void main(String[] args)
    {
        Scanner scan =new Scanner(System.in);
	    int x=scan.nextInt();
        int y=scan.nextInt();

        Common_Divisir(x,y);

        System.out.println(Max);
    }

    public static void Common_Divisir(int a, int b)
    {
        int c=a%b;
        if(c!=0){
            a=b;
            b=c;
            Common_Divisir(a,b);
        }
        if(c==0){
            Max=b;
        }
    }
} Main public static int Max; Max public static void main(String[] args)
    {
        Scanner scan =new Scanner(System.in);
	    int x=scan.nextInt();
        int y=scan.nextInt();

        Common_Divisir(x,y);

        System.out.println(Max);
    } main {
        Scanner scan =new Scanner(System.in);
	    int x=scan.nextInt();
        int y=scan.nextInt();

        Common_Divisir(x,y);

        System.out.println(Max);
    } Scanner scan =new Scanner(System.in); scan new Scanner(System.in) int x=scan.nextInt(); x scan.nextInt() scan.nextInt scan int y=scan.nextInt(); y scan.nextInt() scan.nextInt scan Common_Divisir(x,y) Common_Divisir x y System.out.println(Max) System.out.println System.out System System.out Max String[] args args public static void Common_Divisir(int a, int b)
    {
        int c=a%b;
        if(c!=0){
            a=b;
            b=c;
            Common_Divisir(a,b);
        }
        if(c==0){
            Max=b;
        }
    } Common_Divisir {
        int c=a%b;
        if(c!=0){
            a=b;
            b=c;
            Common_Divisir(a,b);
        }
        if(c==0){
            Max=b;
        }
    } int c=a%b; c a%b a b if(c!=0){
            a=b;
            b=c;
            Common_Divisir(a,b);
        } c!=0 c 0 {
            a=b;
            b=c;
            Common_Divisir(a,b);
        } a=b a b b=c b c Common_Divisir(a,b) Common_Divisir a b if(c==0){
            Max=b;
        } c==0 c 0 {
            Max=b;
        } Max=b Max b int a a int b b public class Main {

    public static int Max;

    public static void main(String[] args)
    {
        Scanner scan =new Scanner(System.in);
	    int x=scan.nextInt();
        int y=scan.nextInt();

        Common_Divisir(x,y);

        System.out.println(Max);
    }

    public static void Common_Divisir(int a, int b)
    {
        int c=a%b;
        if(c!=0){
            a=b;
            b=c;
            Common_Divisir(a,b);
        }
        if(c==0){
            Max=b;
        }
    }
} public class Main {

    public static int Max;

    public static void main(String[] args)
    {
        Scanner scan =new Scanner(System.in);
	    int x=scan.nextInt();
        int y=scan.nextInt();

        Common_Divisir(x,y);

        System.out.println(Max);
    }

    public static void Common_Divisir(int a, int b)
    {
        int c=a%b;
        if(c!=0){
            a=b;
            b=c;
            Common_Divisir(a,b);
        }
        if(c==0){
            Max=b;
        }
    }
} Main
import java.util.Scanner;

public class Main {

    public static int Max;

    public static void main(String[] args)
    {
        Scanner scan =new Scanner(System.in);
	    int x=scan.nextInt();
        int y=scan.nextInt();

        Common_Divisir(x,y);

        System.out.println(Max);
    }

    public static void Common_Divisir(int a, int b)
    {
        int c=a%b;
        if(c!=0){
            a=b;
            b=c;
            Common_Divisir(a,b);
        }
        if(c==0){
            Max=b;
        }
    }
}