import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        String strX = scan.next();
        String strY = scan.next();

        int x = Integer.parseInt(strX);
        int y = Integer.parseInt(strY);

        int answer = divisor(x, y);

        System.out.println(answer);
        scan.close();
    }

    static int divisor(int x, int y) {
        if (y > x) {
            return divisor(y, x);
        }
        while (y != 0) {
            int remainder = x % y;
            x = y;
            y = remainder;
        }
        return x;
    }
} import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        String strX = scan.next();
        String strY = scan.next();

        int x = Integer.parseInt(strX);
        int y = Integer.parseInt(strY);

        int answer = divisor(x, y);

        System.out.println(answer);
        scan.close();
    }

    static int divisor(int x, int y) {
        if (y > x) {
            return divisor(y, x);
        }
        while (y != 0) {
            int remainder = x % y;
            x = y;
            y = remainder;
        }
        return x;
    }
} Main public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        String strX = scan.next();
        String strY = scan.next();

        int x = Integer.parseInt(strX);
        int y = Integer.parseInt(strY);

        int answer = divisor(x, y);

        System.out.println(answer);
        scan.close();
    } main {
        Scanner scan = new Scanner(System.in);
        String strX = scan.next();
        String strY = scan.next();

        int x = Integer.parseInt(strX);
        int y = Integer.parseInt(strY);

        int answer = divisor(x, y);

        System.out.println(answer);
        scan.close();
    } Scanner scan = new Scanner(System.in); scan new Scanner(System.in) String strX = scan.next(); strX scan.next() scan.next scan String strY = scan.next(); strY scan.next() scan.next scan int x = Integer.parseInt(strX); x Integer.parseInt(strX) Integer.parseInt Integer strX int y = Integer.parseInt(strY); y Integer.parseInt(strY) Integer.parseInt Integer strY int answer = divisor(x, y); answer divisor(x, y) divisor x y System.out.println(answer) System.out.println System.out System System.out answer scan.close() scan.close scan String[] args args static int divisor(int x, int y) {
        if (y > x) {
            return divisor(y, x);
        }
        while (y != 0) {
            int remainder = x % y;
            x = y;
            y = remainder;
        }
        return x;
    } divisor {
        if (y > x) {
            return divisor(y, x);
        }
        while (y != 0) {
            int remainder = x % y;
            x = y;
            y = remainder;
        }
        return x;
    } if (y > x) {
            return divisor(y, x);
        } y > x y x {
            return divisor(y, x);
        } return divisor(y, x); divisor(y, x) divisor y x while (y != 0) {
            int remainder = x % y;
            x = y;
            y = remainder;
        } y != 0 y 0 {
            int remainder = x % y;
            x = y;
            y = remainder;
        } int remainder = x % y; remainder x % y x y x = y x y y = remainder y remainder return x; x int x x int y y public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        String strX = scan.next();
        String strY = scan.next();

        int x = Integer.parseInt(strX);
        int y = Integer.parseInt(strY);

        int answer = divisor(x, y);

        System.out.println(answer);
        scan.close();
    }

    static int divisor(int x, int y) {
        if (y > x) {
            return divisor(y, x);
        }
        while (y != 0) {
            int remainder = x % y;
            x = y;
            y = remainder;
        }
        return x;
    }
} public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        String strX = scan.next();
        String strY = scan.next();

        int x = Integer.parseInt(strX);
        int y = Integer.parseInt(strY);

        int answer = divisor(x, y);

        System.out.println(answer);
        scan.close();
    }

    static int divisor(int x, int y) {
        if (y > x) {
            return divisor(y, x);
        }
        while (y != 0) {
            int remainder = x % y;
            x = y;
            y = remainder;
        }
        return x;
    }
} Main
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        String strX = scan.next();
        String strY = scan.next();

        int x = Integer.parseInt(strX);
        int y = Integer.parseInt(strY);

        int answer = divisor(x, y);

        System.out.println(answer);
        scan.close();
    }

    static int divisor(int x, int y) {
        if (y > x) {
            return divisor(y, x);
        }
        while (y != 0) {
            int remainder = x % y;
            x = y;
            y = remainder;
        }
        return x;
    }
}
