import java.util.Scanner;

public class Main {
	static int gcd(int a, int b){
		int c;
		while (b>0){
			c=a%b;
			a=b;
			b=c;
		}
		return a;
	}
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int x = sc.nextInt();
		int y = sc.nextInt();
		if (x>=y){
			int n =gcd(x,y);
			 System.out.println(n);
	} else if (y>x){
		int n =gcd(y,x);
			 System.out.println(n);
	}
	}
} import java.util.Scanner; Scanner java.util public class Main {
	static int gcd(int a, int b){
		int c;
		while (b>0){
			c=a%b;
			a=b;
			b=c;
		}
		return a;
	}
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int x = sc.nextInt();
		int y = sc.nextInt();
		if (x>=y){
			int n =gcd(x,y);
			 System.out.println(n);
	} else if (y>x){
		int n =gcd(y,x);
			 System.out.println(n);
	}
	}
} Main static int gcd(int a, int b){
		int c;
		while (b>0){
			c=a%b;
			a=b;
			b=c;
		}
		return a;
	} gcd {
		int c;
		while (b>0){
			c=a%b;
			a=b;
			b=c;
		}
		return a;
	} int c; c while (b>0){
			c=a%b;
			a=b;
			b=c;
		} b>0 b 0 {
			c=a%b;
			a=b;
			b=c;
		} c=a%b c a%b a b a=b a b b=c b c return a; a int a a int b b public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int x = sc.nextInt();
		int y = sc.nextInt();
		if (x>=y){
			int n =gcd(x,y);
			 System.out.println(n);
	} else if (y>x){
		int n =gcd(y,x);
			 System.out.println(n);
	}
	} main {
		Scanner sc = new Scanner(System.in);
		int x = sc.nextInt();
		int y = sc.nextInt();
		if (x>=y){
			int n =gcd(x,y);
			 System.out.println(n);
	} else if (y>x){
		int n =gcd(y,x);
			 System.out.println(n);
	}
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int x = sc.nextInt(); x sc.nextInt() sc.nextInt sc int y = sc.nextInt(); y sc.nextInt() sc.nextInt sc if (x>=y){
			int n =gcd(x,y);
			 System.out.println(n);
	} else if (y>x){
		int n =gcd(y,x);
			 System.out.println(n);
	} x>=y x y {
			int n =gcd(x,y);
			 System.out.println(n);
	} int n =gcd(x,y); n gcd(x,y) gcd x y System.out.println(n) System.out.println System.out System System.out n if (y>x){
		int n =gcd(y,x);
			 System.out.println(n);
	} y>x y x {
		int n =gcd(y,x);
			 System.out.println(n);
	} int n =gcd(y,x); n gcd(y,x) gcd y x System.out.println(n) System.out.println System.out System System.out n String[] args args public class Main {
	static int gcd(int a, int b){
		int c;
		while (b>0){
			c=a%b;
			a=b;
			b=c;
		}
		return a;
	}
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int x = sc.nextInt();
		int y = sc.nextInt();
		if (x>=y){
			int n =gcd(x,y);
			 System.out.println(n);
	} else if (y>x){
		int n =gcd(y,x);
			 System.out.println(n);
	}
	}
} public class Main {
	static int gcd(int a, int b){
		int c;
		while (b>0){
			c=a%b;
			a=b;
			b=c;
		}
		return a;
	}
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int x = sc.nextInt();
		int y = sc.nextInt();
		if (x>=y){
			int n =gcd(x,y);
			 System.out.println(n);
	} else if (y>x){
		int n =gcd(y,x);
			 System.out.println(n);
	}
	}
} Main
import java.util.Scanner;

public class Main {
	static int gcd(int a, int b){
		int c;
		while (b>0){
			c=a%b;
			a=b;
			b=c;
		}
		return a;
	}
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int x = sc.nextInt();
		int y = sc.nextInt();
		if (x>=y){
			int n =gcd(x,y);
			 System.out.println(n);
	} else if (y>x){
		int n =gcd(y,x);
			 System.out.println(n);
	}
	}
}
