import java.util.Scanner;
public class Main {
	public static void main(String[] arg){
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		if(a >= b){
			gcd(a,b);
		}else{
			gcd(b,a);
		}
	}
	
	static void gcd(int n,int m){
		if((n % m) == 0) {
			System.out.println(m);
		}else if(m == 1){
			System.out.println(1);
		}else{
			int m1 = (n % m);
			gcd(m,m1);
		}
	}
} import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] arg){
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		if(a >= b){
			gcd(a,b);
		}else{
			gcd(b,a);
		}
	}
	
	static void gcd(int n,int m){
		if((n % m) == 0) {
			System.out.println(m);
		}else if(m == 1){
			System.out.println(1);
		}else{
			int m1 = (n % m);
			gcd(m,m1);
		}
	}
} Main public static void main(String[] arg){
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		if(a >= b){
			gcd(a,b);
		}else{
			gcd(b,a);
		}
	} main {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		if(a >= b){
			gcd(a,b);
		}else{
			gcd(b,a);
		}
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int a = sc.nextInt(); a sc.nextInt() sc.nextInt sc int b = sc.nextInt(); b sc.nextInt() sc.nextInt sc if(a >= b){
			gcd(a,b);
		}else{
			gcd(b,a);
		} a >= b a b {
			gcd(a,b);
		} gcd(a,b) gcd a b {
			gcd(b,a);
		} gcd(b,a) gcd b a String[] arg arg static void gcd(int n,int m){
		if((n % m) == 0) {
			System.out.println(m);
		}else if(m == 1){
			System.out.println(1);
		}else{
			int m1 = (n % m);
			gcd(m,m1);
		}
	} gcd {
		if((n % m) == 0) {
			System.out.println(m);
		}else if(m == 1){
			System.out.println(1);
		}else{
			int m1 = (n % m);
			gcd(m,m1);
		}
	} if((n % m) == 0) {
			System.out.println(m);
		}else if(m == 1){
			System.out.println(1);
		}else{
			int m1 = (n % m);
			gcd(m,m1);
		} (n % m) == 0 (n % m) n m 0 {
			System.out.println(m);
		} System.out.println(m) System.out.println System.out System System.out m if(m == 1){
			System.out.println(1);
		}else{
			int m1 = (n % m);
			gcd(m,m1);
		} m == 1 m 1 {
			System.out.println(1);
		} System.out.println(1) System.out.println System.out System System.out 1 {
			int m1 = (n % m);
			gcd(m,m1);
		} int m1 = (n % m); m1 (n % m) n m gcd(m,m1) gcd m m1 int n n int m m public class Main {
	public static void main(String[] arg){
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		if(a >= b){
			gcd(a,b);
		}else{
			gcd(b,a);
		}
	}
	
	static void gcd(int n,int m){
		if((n % m) == 0) {
			System.out.println(m);
		}else if(m == 1){
			System.out.println(1);
		}else{
			int m1 = (n % m);
			gcd(m,m1);
		}
	}
} public class Main {
	public static void main(String[] arg){
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		if(a >= b){
			gcd(a,b);
		}else{
			gcd(b,a);
		}
	}
	
	static void gcd(int n,int m){
		if((n % m) == 0) {
			System.out.println(m);
		}else if(m == 1){
			System.out.println(1);
		}else{
			int m1 = (n % m);
			gcd(m,m1);
		}
	}
} Main
import java.util.Scanner;
public class Main {
	public static void main(String[] arg){
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		if(a >= b){
			gcd(a,b);
		}else{
			gcd(b,a);
		}
	}
	
	static void gcd(int n,int m){
		if((n % m) == 0) {
			System.out.println(m);
		}else if(m == 1){
			System.out.println(1);
		}else{
			int m1 = (n % m);
			gcd(m,m1);
		}
	}
}