import java.util.Scanner;

public class Main {
    public static final int BIG_NUM = 200000000;
    public static final int MOD     = 100000007;
    
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int x = scanner.nextInt();
        int y = scanner.nextInt();
        
        System.out.println(gcd(Math.max(x, y), Math.min(x, y)));
    }
    
    public 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 {
    public static final int BIG_NUM = 200000000;
    public static final int MOD     = 100000007;
    
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int x = scanner.nextInt();
        int y = scanner.nextInt();
        
        System.out.println(gcd(Math.max(x, y), Math.min(x, y)));
    }
    
    public static int gcd(int x, int y) {
        if(y == 0) {
            return x;
        }else {
            return gcd(y, x % y);
        }
    }
} Main public static final int BIG_NUM = 200000000; BIG_NUM 200000000 public static final int MOD     = 100000007; MOD 100000007 public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int x = scanner.nextInt();
        int y = scanner.nextInt();
        
        System.out.println(gcd(Math.max(x, y), Math.min(x, y)));
    } main {
        Scanner scanner = new Scanner(System.in);
        int x = scanner.nextInt();
        int y = scanner.nextInt();
        
        System.out.println(gcd(Math.max(x, y), Math.min(x, y)));
    } Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) int x = scanner.nextInt(); x scanner.nextInt() scanner.nextInt scanner int y = scanner.nextInt(); y scanner.nextInt() scanner.nextInt scanner System.out.println(gcd(Math.max(x, y), Math.min(x, y))) System.out.println System.out System System.out gcd(Math.max(x, y), Math.min(x, y)) gcd Math.max(x, y) Math.max Math x y Math.min(x, y) Math.min Math x y String[] args args public 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 {
    public static final int BIG_NUM = 200000000;
    public static final int MOD     = 100000007;
    
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int x = scanner.nextInt();
        int y = scanner.nextInt();
        
        System.out.println(gcd(Math.max(x, y), Math.min(x, y)));
    }
    
    public static int gcd(int x, int y) {
        if(y == 0) {
            return x;
        }else {
            return gcd(y, x % y);
        }
    }
} public class Main {
    public static final int BIG_NUM = 200000000;
    public static final int MOD     = 100000007;
    
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int x = scanner.nextInt();
        int y = scanner.nextInt();
        
        System.out.println(gcd(Math.max(x, y), Math.min(x, y)));
    }
    
    public 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 {
    public static final int BIG_NUM = 200000000;
    public static final int MOD     = 100000007;
    
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int x = scanner.nextInt();
        int y = scanner.nextInt();
        
        System.out.println(gcd(Math.max(x, y), Math.min(x, y)));
    }
    
    public static int gcd(int x, int y) {
        if(y == 0) {
            return x;
        }else {
            return gcd(y, x % y);
        }
    }
}
