import java.io.*;

class Main
{
 
  public static void main(String[] args)
  {
    try{
    	// ??\???????????????
      BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
      // ????????°???????????????
      //int n = Integer.parseInt(br.readLine());
      String[] str = br.readLine().split(" ");
      int[] array = new int[2];
 
      for(int i = 0; i < 2; i++){
        array[i] = Integer.parseInt(str[i]);
      }
      System.out.println(String.valueOf(getGraterValue(array[0],array[1])));
 
    }catch(Exception e){
      System.out.println(e);
    }
  }
 
  public static int getGraterValue(int a,int b){
	  
	  int greaterValue = a > b ? a : b;
	  if(a % greaterValue == 0 && b % greaterValue == 0)
	  {
		  return greaterValue;
	  }
	  else if(greaterValue < 2){
		  return 1;
	  }
	  else{
		  if(greaterValue == a){
			  // x > y
			  //gcd(x, y) = gcd(y, x%y)
			  return getGraterValue(b,a % b);
		  }
		  return getGraterValue(a,b % a);
	  }
  }
} import java.io.*; io.* java class Main
{
 
  public static void main(String[] args)
  {
    try{
    	// ??\???????????????
      BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
      // ????????°???????????????
      //int n = Integer.parseInt(br.readLine());
      String[] str = br.readLine().split(" ");
      int[] array = new int[2];
 
      for(int i = 0; i < 2; i++){
        array[i] = Integer.parseInt(str[i]);
      }
      System.out.println(String.valueOf(getGraterValue(array[0],array[1])));
 
    }catch(Exception e){
      System.out.println(e);
    }
  }
 
  public static int getGraterValue(int a,int b){
	  
	  int greaterValue = a > b ? a : b;
	  if(a % greaterValue == 0 && b % greaterValue == 0)
	  {
		  return greaterValue;
	  }
	  else if(greaterValue < 2){
		  return 1;
	  }
	  else{
		  if(greaterValue == a){
			  // x > y
			  //gcd(x, y) = gcd(y, x%y)
			  return getGraterValue(b,a % b);
		  }
		  return getGraterValue(a,b % a);
	  }
  }
} Main public static void main(String[] args)
  {
    try{
    	// ??\???????????????
      BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
      // ????????°???????????????
      //int n = Integer.parseInt(br.readLine());
      String[] str = br.readLine().split(" ");
      int[] array = new int[2];
 
      for(int i = 0; i < 2; i++){
        array[i] = Integer.parseInt(str[i]);
      }
      System.out.println(String.valueOf(getGraterValue(array[0],array[1])));
 
    }catch(Exception e){
      System.out.println(e);
    }
  } main {
    try{
    	// ??\???????????????
      BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
      // ????????°???????????????
      //int n = Integer.parseInt(br.readLine());
      String[] str = br.readLine().split(" ");
      int[] array = new int[2];
 
      for(int i = 0; i < 2; i++){
        array[i] = Integer.parseInt(str[i]);
      }
      System.out.println(String.valueOf(getGraterValue(array[0],array[1])));
 
    }catch(Exception e){
      System.out.println(e);
    }
  } try{
    	// ??\???????????????
      BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
      // ????????°???????????????
      //int n = Integer.parseInt(br.readLine());
      String[] str = br.readLine().split(" ");
      int[] array = new int[2];
 
      for(int i = 0; i < 2; i++){
        array[i] = Integer.parseInt(str[i]);
      }
      System.out.println(String.valueOf(getGraterValue(array[0],array[1])));
 
    }catch(Exception e){
      System.out.println(e);
    } catch(Exception e){
      System.out.println(e);
    } Exception e {
      System.out.println(e);
    } System.out.println(e) System.out.println System.out System System.out e {
    	// ??\???????????????
      BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
      // ????????°???????????????
      //int n = Integer.parseInt(br.readLine());
      String[] str = br.readLine().split(" ");
      int[] array = new int[2];
 
      for(int i = 0; i < 2; i++){
        array[i] = Integer.parseInt(str[i]);
      }
      System.out.println(String.valueOf(getGraterValue(array[0],array[1])));
 
    } BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) String[] str = br.readLine().split(" "); str br.readLine().split(" ") br.readLine().split br.readLine() br.readLine br " " int[] array = new int[2]; array new int[2] 2 for(int i = 0; i < 2; i++){
        array[i] = Integer.parseInt(str[i]);
      } int i = 0; int i = 0; i 0 i < 2 i 2 i++ i++ i {
        array[i] = Integer.parseInt(str[i]);
      } {
        array[i] = Integer.parseInt(str[i]);
      } array[i] = Integer.parseInt(str[i]) array[i] array i Integer.parseInt(str[i]) Integer.parseInt Integer str[i] str i System.out.println(String.valueOf(getGraterValue(array[0],array[1]))) System.out.println System.out System System.out String.valueOf(getGraterValue(array[0],array[1])) String.valueOf String getGraterValue(array[0],array[1]) getGraterValue array[0] array 0 array[1] array 1 String[] args args public static int getGraterValue(int a,int b){
	  
	  int greaterValue = a > b ? a : b;
	  if(a % greaterValue == 0 && b % greaterValue == 0)
	  {
		  return greaterValue;
	  }
	  else if(greaterValue < 2){
		  return 1;
	  }
	  else{
		  if(greaterValue == a){
			  // x > y
			  //gcd(x, y) = gcd(y, x%y)
			  return getGraterValue(b,a % b);
		  }
		  return getGraterValue(a,b % a);
	  }
  } getGraterValue {
	  
	  int greaterValue = a > b ? a : b;
	  if(a % greaterValue == 0 && b % greaterValue == 0)
	  {
		  return greaterValue;
	  }
	  else if(greaterValue < 2){
		  return 1;
	  }
	  else{
		  if(greaterValue == a){
			  // x > y
			  //gcd(x, y) = gcd(y, x%y)
			  return getGraterValue(b,a % b);
		  }
		  return getGraterValue(a,b % a);
	  }
  } int greaterValue = a > b ? a : b; greaterValue a > b ? a : b a > b a b a b if(a % greaterValue == 0 && b % greaterValue == 0)
	  {
		  return greaterValue;
	  }
	  else if(greaterValue < 2){
		  return 1;
	  }
	  else{
		  if(greaterValue == a){
			  // x > y
			  //gcd(x, y) = gcd(y, x%y)
			  return getGraterValue(b,a % b);
		  }
		  return getGraterValue(a,b % a);
	  } a % greaterValue == 0 && b % greaterValue == 0 a % greaterValue == 0 a % greaterValue a greaterValue 0 b % greaterValue == 0 b % greaterValue b greaterValue 0 {
		  return greaterValue;
	  } return greaterValue; greaterValue if(greaterValue < 2){
		  return 1;
	  }
	  else{
		  if(greaterValue == a){
			  // x > y
			  //gcd(x, y) = gcd(y, x%y)
			  return getGraterValue(b,a % b);
		  }
		  return getGraterValue(a,b % a);
	  } greaterValue < 2 greaterValue 2 {
		  return 1;
	  } return 1; 1 {
		  if(greaterValue == a){
			  // x > y
			  //gcd(x, y) = gcd(y, x%y)
			  return getGraterValue(b,a % b);
		  }
		  return getGraterValue(a,b % a);
	  } if(greaterValue == a){
			  // x > y
			  //gcd(x, y) = gcd(y, x%y)
			  return getGraterValue(b,a % b);
		  } greaterValue == a greaterValue a {
			  // x > y
			  //gcd(x, y) = gcd(y, x%y)
			  return getGraterValue(b,a % b);
		  } return getGraterValue(b,a % b); getGraterValue(b,a % b) getGraterValue b a % b a b return getGraterValue(a,b % a); getGraterValue(a,b % a) getGraterValue a b % a b a int a a int b b
import java.io.*;

class Main
{
 
  public static void main(String[] args)
  {
    try{
    	// ??\???????????????
      BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
      // ????????°???????????????
      //int n = Integer.parseInt(br.readLine());
      String[] str = br.readLine().split(" ");
      int[] array = new int[2];
 
      for(int i = 0; i < 2; i++){
        array[i] = Integer.parseInt(str[i]);
      }
      System.out.println(String.valueOf(getGraterValue(array[0],array[1])));
 
    }catch(Exception e){
      System.out.println(e);
    }
  }
 
  public static int getGraterValue(int a,int b){
	  
	  int greaterValue = a > b ? a : b;
	  if(a % greaterValue == 0 && b % greaterValue == 0)
	  {
		  return greaterValue;
	  }
	  else if(greaterValue < 2){
		  return 1;
	  }
	  else{
		  if(greaterValue == a){
			  // x > y
			  //gcd(x, y) = gcd(y, x%y)
			  return getGraterValue(b,a % b);
		  }
		  return getGraterValue(a,b % a);
	  }
  }
}