import java.util.Scanner;
 
public class Main {
 
    public static final int BIG_NUM  = 2000000000;
    public static final int MOD  = 1000000007;
 
    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 a,int b){
 
        if(b == 0){
            return a;
        }else{
            return gcd(b,a%b);
        }
    }
} import java.util.Scanner; Scanner java.util public class Main {
 
    public static final int BIG_NUM  = 2000000000;
    public static final int MOD  = 1000000007;
 
    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 a,int b){
 
        if(b == 0){
            return a;
        }else{
            return gcd(b,a%b);
        }
    }
} Main public static final int BIG_NUM  = 2000000000; BIG_NUM 2000000000 public static final int MOD  = 1000000007; MOD 1000000007 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 a,int b){
 
        if(b == 0){
            return a;
        }else{
            return gcd(b,a%b);
        }
    } gcd {
 
        if(b == 0){
            return a;
        }else{
            return gcd(b,a%b);
        }
    } if(b == 0){
            return a;
        }else{
            return gcd(b,a%b);
        } b == 0 b 0 {
            return a;
        } return a; a {
            return gcd(b,a%b);
        } return gcd(b,a%b); gcd(b,a%b) gcd b a%b a b int a a int b b public class Main {
 
    public static final int BIG_NUM  = 2000000000;
    public static final int MOD  = 1000000007;
 
    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 a,int b){
 
        if(b == 0){
            return a;
        }else{
            return gcd(b,a%b);
        }
    }
} public class Main {
 
    public static final int BIG_NUM  = 2000000000;
    public static final int MOD  = 1000000007;
 
    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 a,int b){
 
        if(b == 0){
            return a;
        }else{
            return gcd(b,a%b);
        }
    }
} Main
import java.util.Scanner;
 
public class Main {
 
    public static final int BIG_NUM  = 2000000000;
    public static final int MOD  = 1000000007;
 
    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 a,int b){
 
        if(b == 0){
            return a;
        }else{
            return gcd(b,a%b);
        }
    }
}
