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