import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int[] a = new int[]{sc.nextInt(), sc.nextInt()};
        int big, small;
        if (a[0] == a[1]) {
            System.out.println(a[0]);
            return;
        } else if (a[0] > a[1]) {
            big = a[0];
            small = a[1];
        } else {
            big = a[1];
            small = a[0];
        }

        while (true) {
            int x = big % small;
            if (x == 0) {
                System.out.println(small);
                return;
            } else {
                big = small;
                small = x;
            }
        }
    }
} import java.util.Scanner; Scanner java.util public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int[] a = new int[]{sc.nextInt(), sc.nextInt()};
        int big, small;
        if (a[0] == a[1]) {
            System.out.println(a[0]);
            return;
        } else if (a[0] > a[1]) {
            big = a[0];
            small = a[1];
        } else {
            big = a[1];
            small = a[0];
        }

        while (true) {
            int x = big % small;
            if (x == 0) {
                System.out.println(small);
                return;
            } else {
                big = small;
                small = x;
            }
        }
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int[] a = new int[]{sc.nextInt(), sc.nextInt()};
        int big, small;
        if (a[0] == a[1]) {
            System.out.println(a[0]);
            return;
        } else if (a[0] > a[1]) {
            big = a[0];
            small = a[1];
        } else {
            big = a[1];
            small = a[0];
        }

        while (true) {
            int x = big % small;
            if (x == 0) {
                System.out.println(small);
                return;
            } else {
                big = small;
                small = x;
            }
        }
    } main {
        Scanner sc = new Scanner(System.in);
        int[] a = new int[]{sc.nextInt(), sc.nextInt()};
        int big, small;
        if (a[0] == a[1]) {
            System.out.println(a[0]);
            return;
        } else if (a[0] > a[1]) {
            big = a[0];
            small = a[1];
        } else {
            big = a[1];
            small = a[0];
        }

        while (true) {
            int x = big % small;
            if (x == 0) {
                System.out.println(small);
                return;
            } else {
                big = small;
                small = x;
            }
        }
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int[] a = new int[]{sc.nextInt(), sc.nextInt()}; a new int[]{sc.nextInt(), sc.nextInt()} int big big small; small if (a[0] == a[1]) {
            System.out.println(a[0]);
            return;
        } else if (a[0] > a[1]) {
            big = a[0];
            small = a[1];
        } else {
            big = a[1];
            small = a[0];
        } a[0] == a[1] a[0] a 0 a[1] a 1 {
            System.out.println(a[0]);
            return;
        } System.out.println(a[0]) System.out.println System.out System System.out a[0] a 0 return; if (a[0] > a[1]) {
            big = a[0];
            small = a[1];
        } else {
            big = a[1];
            small = a[0];
        } a[0] > a[1] a[0] a 0 a[1] a 1 {
            big = a[0];
            small = a[1];
        } big = a[0] big a[0] a 0 small = a[1] small a[1] a 1 {
            big = a[1];
            small = a[0];
        } big = a[1] big a[1] a 1 small = a[0] small a[0] a 0 while (true) {
            int x = big % small;
            if (x == 0) {
                System.out.println(small);
                return;
            } else {
                big = small;
                small = x;
            }
        } true {
            int x = big % small;
            if (x == 0) {
                System.out.println(small);
                return;
            } else {
                big = small;
                small = x;
            }
        } int x = big % small; x big % small big small if (x == 0) {
                System.out.println(small);
                return;
            } else {
                big = small;
                small = x;
            } x == 0 x 0 {
                System.out.println(small);
                return;
            } System.out.println(small) System.out.println System.out System System.out small return; {
                big = small;
                small = x;
            } big = small big small small = x small x String[] args args public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int[] a = new int[]{sc.nextInt(), sc.nextInt()};
        int big, small;
        if (a[0] == a[1]) {
            System.out.println(a[0]);
            return;
        } else if (a[0] > a[1]) {
            big = a[0];
            small = a[1];
        } else {
            big = a[1];
            small = a[0];
        }

        while (true) {
            int x = big % small;
            if (x == 0) {
                System.out.println(small);
                return;
            } else {
                big = small;
                small = x;
            }
        }
    }
} public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int[] a = new int[]{sc.nextInt(), sc.nextInt()};
        int big, small;
        if (a[0] == a[1]) {
            System.out.println(a[0]);
            return;
        } else if (a[0] > a[1]) {
            big = a[0];
            small = a[1];
        } else {
            big = a[1];
            small = a[0];
        }

        while (true) {
            int x = big % small;
            if (x == 0) {
                System.out.println(small);
                return;
            } else {
                big = small;
                small = x;
            }
        }
    }
} Main
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int[] a = new int[]{sc.nextInt(), sc.nextInt()};
        int big, small;
        if (a[0] == a[1]) {
            System.out.println(a[0]);
            return;
        } else if (a[0] > a[1]) {
            big = a[0];
            small = a[1];
        } else {
            big = a[1];
            small = a[0];
        }

        while (true) {
            int x = big % small;
            if (x == 0) {
                System.out.println(small);
                return;
            } else {
                big = small;
                small = x;
            }
        }
    }
}