import java.util.Scanner;
 
class Main { 
  public static void main(String[] args) {
    Scanner in = new Scanner(System.in);
    int a = in.nextInt();
    int b = in.nextInt();
    System.out.println(gcd(a, b));
  }
   
  public static int gcd(int x, int y) {
    return y == 0 ? x : gcd(y, x%y);
  }
} import java.util.Scanner; Scanner java.util class Main { 
  public static void main(String[] args) {
    Scanner in = new Scanner(System.in);
    int a = in.nextInt();
    int b = in.nextInt();
    System.out.println(gcd(a, b));
  }
   
  public static int gcd(int x, int y) {
    return y == 0 ? x : gcd(y, x%y);
  }
} Main public static void main(String[] args) {
    Scanner in = new Scanner(System.in);
    int a = in.nextInt();
    int b = in.nextInt();
    System.out.println(gcd(a, b));
  } main {
    Scanner in = new Scanner(System.in);
    int a = in.nextInt();
    int b = in.nextInt();
    System.out.println(gcd(a, b));
  } Scanner in = new Scanner(System.in); in new Scanner(System.in) int a = in.nextInt(); a in.nextInt() in.nextInt in int b = in.nextInt(); b in.nextInt() in.nextInt in System.out.println(gcd(a, b)) System.out.println System.out System System.out gcd(a, b) gcd a b String[] args args public static int gcd(int x, int y) {
    return y == 0 ? x : gcd(y, x%y);
  } gcd {
    return y == 0 ? x : gcd(y, x%y);
  } return y == 0 ? x : gcd(y, x%y); y == 0 ? x : gcd(y, x%y) y == 0 y 0 x gcd(y, x%y) gcd y x%y x y int x x int y y
import java.util.Scanner;
 
class Main { 
  public static void main(String[] args) {
    Scanner in = new Scanner(System.in);
    int a = in.nextInt();
    int b = in.nextInt();
    System.out.println(gcd(a, b));
  }
   
  public static int gcd(int x, int y) {
    return y == 0 ? x : gcd(y, x%y);
  }
}