import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main{
    public static void main(String[] args) throws IOException{
    	BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    	String str = br.readLine();
    	int[] numArray = strToInt(str.split("\\s"));
    	int result;

    	if(numArray[0] > numArray[1]){
			result = getGCD(numArray[0],numArray[1]);
    	}else{
			result = getGCD(numArray[1],numArray[0]);
    	}

        System.out.println(result);
    }
    public static int getGCD(int x,int y){
    	int temp;
    	while((temp = x % y) != 0){
    		x = y;
    		y = temp;
    	}
    	return y;
    }
    public static int[] strToInt(String[] strArray){
    	int[] numArray = new int[strArray.length];
    	for(int i=0; i<strArray.length; i++){
    		numArray[i] = Integer.parseInt(strArray[i]);
    	}
    	return numArray;
    }
} import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io import java.io.InputStreamReader; InputStreamReader java.io public class Main{
    public static void main(String[] args) throws IOException{
    	BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    	String str = br.readLine();
    	int[] numArray = strToInt(str.split("\\s"));
    	int result;

    	if(numArray[0] > numArray[1]){
			result = getGCD(numArray[0],numArray[1]);
    	}else{
			result = getGCD(numArray[1],numArray[0]);
    	}

        System.out.println(result);
    }
    public static int getGCD(int x,int y){
    	int temp;
    	while((temp = x % y) != 0){
    		x = y;
    		y = temp;
    	}
    	return y;
    }
    public static int[] strToInt(String[] strArray){
    	int[] numArray = new int[strArray.length];
    	for(int i=0; i<strArray.length; i++){
    		numArray[i] = Integer.parseInt(strArray[i]);
    	}
    	return numArray;
    }
} Main public static void main(String[] args) throws IOException{
    	BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    	String str = br.readLine();
    	int[] numArray = strToInt(str.split("\\s"));
    	int result;

    	if(numArray[0] > numArray[1]){
			result = getGCD(numArray[0],numArray[1]);
    	}else{
			result = getGCD(numArray[1],numArray[0]);
    	}

        System.out.println(result);
    } main {
    	BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    	String str = br.readLine();
    	int[] numArray = strToInt(str.split("\\s"));
    	int result;

    	if(numArray[0] > numArray[1]){
			result = getGCD(numArray[0],numArray[1]);
    	}else{
			result = getGCD(numArray[1],numArray[0]);
    	}

        System.out.println(result);
    } BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) String str = br.readLine(); str br.readLine() br.readLine br int[] numArray = strToInt(str.split("\\s")); numArray strToInt(str.split("\\s")) strToInt str.split("\\s") str.split str "\\s" int result; result if(numArray[0] > numArray[1]){
			result = getGCD(numArray[0],numArray[1]);
    	}else{
			result = getGCD(numArray[1],numArray[0]);
    	} numArray[0] > numArray[1] numArray[0] numArray 0 numArray[1] numArray 1 {
			result = getGCD(numArray[0],numArray[1]);
    	} result = getGCD(numArray[0],numArray[1]) result getGCD(numArray[0],numArray[1]) getGCD numArray[0] numArray 0 numArray[1] numArray 1 {
			result = getGCD(numArray[1],numArray[0]);
    	} result = getGCD(numArray[1],numArray[0]) result getGCD(numArray[1],numArray[0]) getGCD numArray[1] numArray 1 numArray[0] numArray 0 System.out.println(result) System.out.println System.out System System.out result String[] args args public static int getGCD(int x,int y){
    	int temp;
    	while((temp = x % y) != 0){
    		x = y;
    		y = temp;
    	}
    	return y;
    } getGCD {
    	int temp;
    	while((temp = x % y) != 0){
    		x = y;
    		y = temp;
    	}
    	return y;
    } int temp; temp while((temp = x % y) != 0){
    		x = y;
    		y = temp;
    	} (temp = x % y) != 0 (temp = x % y) temp x % y x y 0 {
    		x = y;
    		y = temp;
    	} x = y x y y = temp y temp return y; y int x x int y y public static int[] strToInt(String[] strArray){
    	int[] numArray = new int[strArray.length];
    	for(int i=0; i<strArray.length; i++){
    		numArray[i] = Integer.parseInt(strArray[i]);
    	}
    	return numArray;
    } strToInt {
    	int[] numArray = new int[strArray.length];
    	for(int i=0; i<strArray.length; i++){
    		numArray[i] = Integer.parseInt(strArray[i]);
    	}
    	return numArray;
    } int[] numArray = new int[strArray.length]; numArray new int[strArray.length] strArray.length strArray strArray.length for(int i=0; i<strArray.length; i++){
    		numArray[i] = Integer.parseInt(strArray[i]);
    	} int i=0; int i=0; i 0 i<strArray.length i strArray.length strArray strArray.length i++ i++ i {
    		numArray[i] = Integer.parseInt(strArray[i]);
    	} {
    		numArray[i] = Integer.parseInt(strArray[i]);
    	} numArray[i] = Integer.parseInt(strArray[i]) numArray[i] numArray i Integer.parseInt(strArray[i]) Integer.parseInt Integer strArray[i] strArray i return numArray; numArray String[] strArray strArray public class Main{
    public static void main(String[] args) throws IOException{
    	BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    	String str = br.readLine();
    	int[] numArray = strToInt(str.split("\\s"));
    	int result;

    	if(numArray[0] > numArray[1]){
			result = getGCD(numArray[0],numArray[1]);
    	}else{
			result = getGCD(numArray[1],numArray[0]);
    	}

        System.out.println(result);
    }
    public static int getGCD(int x,int y){
    	int temp;
    	while((temp = x % y) != 0){
    		x = y;
    		y = temp;
    	}
    	return y;
    }
    public static int[] strToInt(String[] strArray){
    	int[] numArray = new int[strArray.length];
    	for(int i=0; i<strArray.length; i++){
    		numArray[i] = Integer.parseInt(strArray[i]);
    	}
    	return numArray;
    }
} public class Main{
    public static void main(String[] args) throws IOException{
    	BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    	String str = br.readLine();
    	int[] numArray = strToInt(str.split("\\s"));
    	int result;

    	if(numArray[0] > numArray[1]){
			result = getGCD(numArray[0],numArray[1]);
    	}else{
			result = getGCD(numArray[1],numArray[0]);
    	}

        System.out.println(result);
    }
    public static int getGCD(int x,int y){
    	int temp;
    	while((temp = x % y) != 0){
    		x = y;
    		y = temp;
    	}
    	return y;
    }
    public static int[] strToInt(String[] strArray){
    	int[] numArray = new int[strArray.length];
    	for(int i=0; i<strArray.length; i++){
    		numArray[i] = Integer.parseInt(strArray[i]);
    	}
    	return numArray;
    }
} Main
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main{
    public static void main(String[] args) throws IOException{
    	BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    	String str = br.readLine();
    	int[] numArray = strToInt(str.split("\\s"));
    	int result;

    	if(numArray[0] > numArray[1]){
			result = getGCD(numArray[0],numArray[1]);
    	}else{
			result = getGCD(numArray[1],numArray[0]);
    	}

        System.out.println(result);
    }
    public static int getGCD(int x,int y){
    	int temp;
    	while((temp = x % y) != 0){
    		x = y;
    		y = temp;
    	}
    	return y;
    }
    public static int[] strToInt(String[] strArray){
    	int[] numArray = new int[strArray.length];
    	for(int i=0; i<strArray.length; i++){
    		numArray[i] = Integer.parseInt(strArray[i]);
    	}
    	return numArray;
    }
}