import java.util.Scanner;
class Main{
  public static void main(String[] args){
    Scanner scanner = new Scanner(System.in);
    int x,y,z=1;
    x = scanner.nextInt();
    y = scanner.nextInt();

    while(!(z==0)){
      if(x<y){
        z=x;
        x=y;
        y=z;
      }
      z = x % y;
      if(z==0){
        System.out.println(y);
      }
      x = y;
      y = z;
    }
  }
}
 import java.util.Scanner; Scanner java.util class Main{
  public static void main(String[] args){
    Scanner scanner = new Scanner(System.in);
    int x,y,z=1;
    x = scanner.nextInt();
    y = scanner.nextInt();

    while(!(z==0)){
      if(x<y){
        z=x;
        x=y;
        y=z;
      }
      z = x % y;
      if(z==0){
        System.out.println(y);
      }
      x = y;
      y = z;
    }
  }
} Main public static void main(String[] args){
    Scanner scanner = new Scanner(System.in);
    int x,y,z=1;
    x = scanner.nextInt();
    y = scanner.nextInt();

    while(!(z==0)){
      if(x<y){
        z=x;
        x=y;
        y=z;
      }
      z = x % y;
      if(z==0){
        System.out.println(y);
      }
      x = y;
      y = z;
    }
  } main {
    Scanner scanner = new Scanner(System.in);
    int x,y,z=1;
    x = scanner.nextInt();
    y = scanner.nextInt();

    while(!(z==0)){
      if(x<y){
        z=x;
        x=y;
        y=z;
      }
      z = x % y;
      if(z==0){
        System.out.println(y);
      }
      x = y;
      y = z;
    }
  } Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) int x x y y z=1; z 1 x = scanner.nextInt() x scanner.nextInt() scanner.nextInt scanner y = scanner.nextInt() y scanner.nextInt() scanner.nextInt scanner while(!(z==0)){
      if(x<y){
        z=x;
        x=y;
        y=z;
      }
      z = x % y;
      if(z==0){
        System.out.println(y);
      }
      x = y;
      y = z;
    } !(z==0) (z==0) z 0 {
      if(x<y){
        z=x;
        x=y;
        y=z;
      }
      z = x % y;
      if(z==0){
        System.out.println(y);
      }
      x = y;
      y = z;
    } if(x<y){
        z=x;
        x=y;
        y=z;
      } x<y x y {
        z=x;
        x=y;
        y=z;
      } z=x z x x=y x y y=z y z z = x % y z x % y x y if(z==0){
        System.out.println(y);
      } z==0 z 0 {
        System.out.println(y);
      } System.out.println(y) System.out.println System.out System System.out y x = y x y y = z y z String[] args args
import java.util.Scanner;
class Main{
  public static void main(String[] args){
    Scanner scanner = new Scanner(System.in);
    int x,y,z=1;
    x = scanner.nextInt();
    y = scanner.nextInt();

    while(!(z==0)){
      if(x<y){
        z=x;
        x=y;
        y=z;
      }
      z = x % y;
      if(z==0){
        System.out.println(y);
      }
      x = y;
      y = z;
    }
  }
}

