import java.util.Scanner;
public class Main {
	public static Scanner sc = new Scanner(System.in);
	public static void main(String[] args) {
		int i, j, k;
		int x = sc.nextInt();
		int y = sc.nextInt();
		if(x >= y) gcd(x, y);
		else gcd(y, x);
	}
	
	public static void gcd(int x, int y){
		int r = 0;
		if(y != 0){
			r = x % y;
			gcd(y, r);
		}
		else System.out.println(x);
	}
} import java.util.Scanner; Scanner java.util public class Main {
	public static Scanner sc = new Scanner(System.in);
	public static void main(String[] args) {
		int i, j, k;
		int x = sc.nextInt();
		int y = sc.nextInt();
		if(x >= y) gcd(x, y);
		else gcd(y, x);
	}
	
	public static void gcd(int x, int y){
		int r = 0;
		if(y != 0){
			r = x % y;
			gcd(y, r);
		}
		else System.out.println(x);
	}
} Main public static Scanner sc = new Scanner(System.in); sc new Scanner(System.in) public static void main(String[] args) {
		int i, j, k;
		int x = sc.nextInt();
		int y = sc.nextInt();
		if(x >= y) gcd(x, y);
		else gcd(y, x);
	} main {
		int i, j, k;
		int x = sc.nextInt();
		int y = sc.nextInt();
		if(x >= y) gcd(x, y);
		else gcd(y, x);
	} int i i j j k; k int x = sc.nextInt(); x sc.nextInt() sc.nextInt sc int y = sc.nextInt(); y sc.nextInt() sc.nextInt sc if(x >= y) gcd(x, y);
		else gcd(y, x); x >= y x y gcd(x, y) gcd x y gcd(y, x) gcd y x String[] args args public static void gcd(int x, int y){
		int r = 0;
		if(y != 0){
			r = x % y;
			gcd(y, r);
		}
		else System.out.println(x);
	} gcd {
		int r = 0;
		if(y != 0){
			r = x % y;
			gcd(y, r);
		}
		else System.out.println(x);
	} int r = 0; r 0 if(y != 0){
			r = x % y;
			gcd(y, r);
		}
		else System.out.println(x); y != 0 y 0 {
			r = x % y;
			gcd(y, r);
		} r = x % y r x % y x y gcd(y, r) gcd y r System.out.println(x) System.out.println System.out System System.out x int x x int y y public class Main {
	public static Scanner sc = new Scanner(System.in);
	public static void main(String[] args) {
		int i, j, k;
		int x = sc.nextInt();
		int y = sc.nextInt();
		if(x >= y) gcd(x, y);
		else gcd(y, x);
	}
	
	public static void gcd(int x, int y){
		int r = 0;
		if(y != 0){
			r = x % y;
			gcd(y, r);
		}
		else System.out.println(x);
	}
} public class Main {
	public static Scanner sc = new Scanner(System.in);
	public static void main(String[] args) {
		int i, j, k;
		int x = sc.nextInt();
		int y = sc.nextInt();
		if(x >= y) gcd(x, y);
		else gcd(y, x);
	}
	
	public static void gcd(int x, int y){
		int r = 0;
		if(y != 0){
			r = x % y;
			gcd(y, r);
		}
		else System.out.println(x);
	}
} Main
import java.util.Scanner;
public class Main {
	public static Scanner sc = new Scanner(System.in);
	public static void main(String[] args) {
		int i, j, k;
		int x = sc.nextInt();
		int y = sc.nextInt();
		if(x >= y) gcd(x, y);
		else gcd(y, x);
	}
	
	public static void gcd(int x, int y){
		int r = 0;
		if(y != 0){
			r = x % y;
			gcd(y, r);
		}
		else System.out.println(x);
	}
}
