
import java.util.Scanner;

public class Main {
    static Scanner sc = new Scanner(System.in);
    public static void main(String[] args) {
        int x = sc.nextInt();
        int y = sc.nextInt();
        int result = 0;
        if(x > y){
            result = gcd(x, y);
        } else {
            result = gcd(y, x);
        }
        System.out.println(result);
    }

    static int gcd(int x, int y){
        if(y == 0){
            return x;
        } else {
            return gcd(y, x % y);
        }   
    }
}
 import java.util.Scanner; Scanner java.util public class Main {
    static Scanner sc = new Scanner(System.in);
    public static void main(String[] args) {
        int x = sc.nextInt();
        int y = sc.nextInt();
        int result = 0;
        if(x > y){
            result = gcd(x, y);
        } else {
            result = gcd(y, x);
        }
        System.out.println(result);
    }

    static int gcd(int x, int y){
        if(y == 0){
            return x;
        } else {
            return gcd(y, x % y);
        }   
    }
} Main static Scanner sc = new Scanner(System.in); sc new Scanner(System.in) public static void main(String[] args) {
        int x = sc.nextInt();
        int y = sc.nextInt();
        int result = 0;
        if(x > y){
            result = gcd(x, y);
        } else {
            result = gcd(y, x);
        }
        System.out.println(result);
    } main {
        int x = sc.nextInt();
        int y = sc.nextInt();
        int result = 0;
        if(x > y){
            result = gcd(x, y);
        } else {
            result = gcd(y, x);
        }
        System.out.println(result);
    } int x = sc.nextInt(); x sc.nextInt() sc.nextInt sc int y = sc.nextInt(); y sc.nextInt() sc.nextInt sc int result = 0; result 0 if(x > y){
            result = gcd(x, y);
        } else {
            result = gcd(y, x);
        } x > y x y {
            result = gcd(x, y);
        } result = gcd(x, y) result gcd(x, y) gcd x y {
            result = gcd(y, x);
        } result = gcd(y, x) result gcd(y, x) gcd y x System.out.println(result) System.out.println System.out System System.out result String[] args args static int gcd(int x, int y){
        if(y == 0){
            return x;
        } else {
            return gcd(y, x % y);
        }   
    } gcd {
        if(y == 0){
            return x;
        } else {
            return gcd(y, x % y);
        }   
    } if(y == 0){
            return x;
        } else {
            return gcd(y, x % y);
        } y == 0 y 0 {
            return x;
        } return x; x {
            return gcd(y, x % y);
        } return gcd(y, x % y); gcd(y, x % y) gcd y x % y x y int x x int y y public class Main {
    static Scanner sc = new Scanner(System.in);
    public static void main(String[] args) {
        int x = sc.nextInt();
        int y = sc.nextInt();
        int result = 0;
        if(x > y){
            result = gcd(x, y);
        } else {
            result = gcd(y, x);
        }
        System.out.println(result);
    }

    static int gcd(int x, int y){
        if(y == 0){
            return x;
        } else {
            return gcd(y, x % y);
        }   
    }
} public class Main {
    static Scanner sc = new Scanner(System.in);
    public static void main(String[] args) {
        int x = sc.nextInt();
        int y = sc.nextInt();
        int result = 0;
        if(x > y){
            result = gcd(x, y);
        } else {
            result = gcd(y, x);
        }
        System.out.println(result);
    }

    static int gcd(int x, int y){
        if(y == 0){
            return x;
        } else {
            return gcd(y, x % y);
        }   
    }
} Main

import java.util.Scanner;

public class Main {
    static Scanner sc = new Scanner(System.in);
    public static void main(String[] args) {
        int x = sc.nextInt();
        int y = sc.nextInt();
        int result = 0;
        if(x > y){
            result = gcd(x, y);
        } else {
            result = gcd(y, x);
        }
        System.out.println(result);
    }

    static int gcd(int x, int y){
        if(y == 0){
            return x;
        } else {
            return gcd(y, x % y);
        }   
    }
}

