import java.util.*;
class Main {
    public static void main(String...args) {
        Scanner scan = new Scanner(System.in);
        int x = scan.nextInt();
        int y = scan.nextInt();
        int divisor = 0;

        while((divisor = x % y) != 0) {
                x = y;
                y = divisor;
        }
        System.out.println(y);
    }
}
 import java.util.*; util.* java class Main {
    public static void main(String...args) {
        Scanner scan = new Scanner(System.in);
        int x = scan.nextInt();
        int y = scan.nextInt();
        int divisor = 0;

        while((divisor = x % y) != 0) {
                x = y;
                y = divisor;
        }
        System.out.println(y);
    }
} Main public static void main(String...args) {
        Scanner scan = new Scanner(System.in);
        int x = scan.nextInt();
        int y = scan.nextInt();
        int divisor = 0;

        while((divisor = x % y) != 0) {
                x = y;
                y = divisor;
        }
        System.out.println(y);
    } main {
        Scanner scan = new Scanner(System.in);
        int x = scan.nextInt();
        int y = scan.nextInt();
        int divisor = 0;

        while((divisor = x % y) != 0) {
                x = y;
                y = divisor;
        }
        System.out.println(y);
    } 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 int divisor = 0; divisor 0 while((divisor = x % y) != 0) {
                x = y;
                y = divisor;
        } (divisor = x % y) != 0 (divisor = x % y) divisor x % y x y 0 {
                x = y;
                y = divisor;
        } x = y x y y = divisor y divisor System.out.println(y) System.out.println System.out System System.out y String...args args
import java.util.*;
class Main {
    public static void main(String...args) {
        Scanner scan = new Scanner(System.in);
        int x = scan.nextInt();
        int y = scan.nextInt();
        int divisor = 0;

        while((divisor = x % y) != 0) {
                x = y;
                y = divisor;
        }
        System.out.println(y);
    }
}

