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

public class Main {

	public static void main(String[] args) throws IOException{
		// TODO Auto-generated method stub
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		ArrayList<String> lines = new ArrayList<String>();
		while (br.ready()){
			lines.add(br.readLine());
		}
		String[] tmp = lines.get(0).split(" ");
		int[] num = new int[tmp.length];
		for(int i=0; i<tmp.length; i++){
			num[i] = Integer.parseInt(tmp[i]);
		}
		System.out.println(gcd(num[0],num[1]));

	}
	static int gcd(int x, int y){
		if (x%y ==0)
			return y;
		return gcd(y, x%y);
	}

} import java.io.BufferedReader; BufferedReader java.io import java.io.InputStreamReader; InputStreamReader java.io import java.io.IOException; IOException java.io import java.util.ArrayList; ArrayList java.util public class Main {

	public static void main(String[] args) throws IOException{
		// TODO Auto-generated method stub
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		ArrayList<String> lines = new ArrayList<String>();
		while (br.ready()){
			lines.add(br.readLine());
		}
		String[] tmp = lines.get(0).split(" ");
		int[] num = new int[tmp.length];
		for(int i=0; i<tmp.length; i++){
			num[i] = Integer.parseInt(tmp[i]);
		}
		System.out.println(gcd(num[0],num[1]));

	}
	static int gcd(int x, int y){
		if (x%y ==0)
			return y;
		return gcd(y, x%y);
	}

} Main public static void main(String[] args) throws IOException{
		// TODO Auto-generated method stub
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		ArrayList<String> lines = new ArrayList<String>();
		while (br.ready()){
			lines.add(br.readLine());
		}
		String[] tmp = lines.get(0).split(" ");
		int[] num = new int[tmp.length];
		for(int i=0; i<tmp.length; i++){
			num[i] = Integer.parseInt(tmp[i]);
		}
		System.out.println(gcd(num[0],num[1]));

	} main {
		// TODO Auto-generated method stub
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		ArrayList<String> lines = new ArrayList<String>();
		while (br.ready()){
			lines.add(br.readLine());
		}
		String[] tmp = lines.get(0).split(" ");
		int[] num = new int[tmp.length];
		for(int i=0; i<tmp.length; i++){
			num[i] = Integer.parseInt(tmp[i]);
		}
		System.out.println(gcd(num[0],num[1]));

	} BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) ArrayList<String> lines = new ArrayList<String>(); lines new ArrayList<String>() while (br.ready()){
			lines.add(br.readLine());
		} br.ready() br.ready br {
			lines.add(br.readLine());
		} lines.add(br.readLine()) lines.add lines br.readLine() br.readLine br String[] tmp = lines.get(0).split(" "); tmp lines.get(0).split(" ") lines.get(0).split lines.get(0) lines.get lines 0 " " int[] num = new int[tmp.length]; num new int[tmp.length] tmp.length tmp tmp.length for(int i=0; i<tmp.length; i++){
			num[i] = Integer.parseInt(tmp[i]);
		} int i=0; int i=0; i 0 i<tmp.length i tmp.length tmp tmp.length i++ i++ i {
			num[i] = Integer.parseInt(tmp[i]);
		} {
			num[i] = Integer.parseInt(tmp[i]);
		} num[i] = Integer.parseInt(tmp[i]) num[i] num i Integer.parseInt(tmp[i]) Integer.parseInt Integer tmp[i] tmp i System.out.println(gcd(num[0],num[1])) System.out.println System.out System System.out gcd(num[0],num[1]) gcd num[0] num 0 num[1] num 1 String[] args args static int gcd(int x, int y){
		if (x%y ==0)
			return y;
		return gcd(y, x%y);
	} gcd {
		if (x%y ==0)
			return y;
		return gcd(y, x%y);
	} if (x%y ==0)
			return y; x%y ==0 x%y x y 0 return y; y return gcd(y, x%y); gcd(y, x%y) gcd y x%y x y int x x int y y public class Main {

	public static void main(String[] args) throws IOException{
		// TODO Auto-generated method stub
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		ArrayList<String> lines = new ArrayList<String>();
		while (br.ready()){
			lines.add(br.readLine());
		}
		String[] tmp = lines.get(0).split(" ");
		int[] num = new int[tmp.length];
		for(int i=0; i<tmp.length; i++){
			num[i] = Integer.parseInt(tmp[i]);
		}
		System.out.println(gcd(num[0],num[1]));

	}
	static int gcd(int x, int y){
		if (x%y ==0)
			return y;
		return gcd(y, x%y);
	}

} public class Main {

	public static void main(String[] args) throws IOException{
		// TODO Auto-generated method stub
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		ArrayList<String> lines = new ArrayList<String>();
		while (br.ready()){
			lines.add(br.readLine());
		}
		String[] tmp = lines.get(0).split(" ");
		int[] num = new int[tmp.length];
		for(int i=0; i<tmp.length; i++){
			num[i] = Integer.parseInt(tmp[i]);
		}
		System.out.println(gcd(num[0],num[1]));

	}
	static int gcd(int x, int y){
		if (x%y ==0)
			return y;
		return gcd(y, x%y);
	}

} Main
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
import java.util.ArrayList;

public class Main {

	public static void main(String[] args) throws IOException{
		// TODO Auto-generated method stub
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		ArrayList<String> lines = new ArrayList<String>();
		while (br.ready()){
			lines.add(br.readLine());
		}
		String[] tmp = lines.get(0).split(" ");
		int[] num = new int[tmp.length];
		for(int i=0; i<tmp.length; i++){
			num[i] = Integer.parseInt(tmp[i]);
		}
		System.out.println(gcd(num[0],num[1]));

	}
	static int gcd(int x, int y){
		if (x%y ==0)
			return y;
		return gcd(y, x%y);
	}

}