import java.io.*;
import java.util.*;
import java.lang.Math;

public class Main {

    public static int gcd(int a, int b){
        if(a % b == 0)return b;
        return gcd(b, a % b);
    }
    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        int x = sc.nextInt(), y = sc.nextInt();

        System.out.println(gcd(x, y));

    }
  
} import java.io.*; io.* java import java.util.*; util.* java import java.lang.Math; Math java.lang public class Main {

    public static int gcd(int a, int b){
        if(a % b == 0)return b;
        return gcd(b, a % b);
    }
    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        int x = sc.nextInt(), y = sc.nextInt();

        System.out.println(gcd(x, y));

    }
  
} Main public static int gcd(int a, int b){
        if(a % b == 0)return b;
        return gcd(b, a % b);
    } gcd {
        if(a % b == 0)return b;
        return gcd(b, a % b);
    } if(a % b == 0)return b; a % b == 0 a % b a b 0 return b; b return gcd(b, a % b); gcd(b, a % b) gcd b a % b a b int a a int b b public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        int x = sc.nextInt(), y = sc.nextInt();

        System.out.println(gcd(x, y));

    } main {

        Scanner sc = new Scanner(System.in);
        int x = sc.nextInt(), y = sc.nextInt();

        System.out.println(gcd(x, y));

    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int x = sc.nextInt() x sc.nextInt() sc.nextInt sc y = sc.nextInt(); y sc.nextInt() sc.nextInt sc System.out.println(gcd(x, y)) System.out.println System.out System System.out gcd(x, y) gcd x y String[] args args public class Main {

    public static int gcd(int a, int b){
        if(a % b == 0)return b;
        return gcd(b, a % b);
    }
    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        int x = sc.nextInt(), y = sc.nextInt();

        System.out.println(gcd(x, y));

    }
  
} public class Main {

    public static int gcd(int a, int b){
        if(a % b == 0)return b;
        return gcd(b, a % b);
    }
    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        int x = sc.nextInt(), y = sc.nextInt();

        System.out.println(gcd(x, y));

    }
  
} Main
import java.io.*;
import java.util.*;
import java.lang.Math;

public class Main {

    public static int gcd(int a, int b){
        if(a % b == 0)return b;
        return gcd(b, a % b);
    }
    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        int x = sc.nextInt(), y = sc.nextInt();

        System.out.println(gcd(x, y));

    }
  
}
