import java.util.Scanner;

public class Main {
	
	// we can assume that a is always greater than b
	
	public static int gcd(int a, int b) {
		return (b == 0)?  a : gcd(b, a % b);
	}
	public static void main(String[] args) {
		Scanner cin = new Scanner(System.in);
		int a = 0, b = 0;
		
		a = cin.nextInt();
		b = cin.nextInt();
		
		int c = Math.min(a,b);
		a = Math.max(a, b);
		
		System.out.println(gcd(a , c));
		
	
	}
} import java.util.Scanner; Scanner java.util public class Main {
	
	// we can assume that a is always greater than b
	
	public static int gcd(int a, int b) {
		return (b == 0)?  a : gcd(b, a % b);
	}
	public static void main(String[] args) {
		Scanner cin = new Scanner(System.in);
		int a = 0, b = 0;
		
		a = cin.nextInt();
		b = cin.nextInt();
		
		int c = Math.min(a,b);
		a = Math.max(a, b);
		
		System.out.println(gcd(a , c));
		
	
	}
} Main public static int gcd(int a, int b) {
		return (b == 0)?  a : gcd(b, a % b);
	} gcd {
		return (b == 0)?  a : gcd(b, a % b);
	} return (b == 0)?  a : gcd(b, a % b); (b == 0)?  a : gcd(b, a % b) (b == 0) b 0 a gcd(b, a % b) gcd b a % b a b int a a int b b public static void main(String[] args) {
		Scanner cin = new Scanner(System.in);
		int a = 0, b = 0;
		
		a = cin.nextInt();
		b = cin.nextInt();
		
		int c = Math.min(a,b);
		a = Math.max(a, b);
		
		System.out.println(gcd(a , c));
		
	
	} main {
		Scanner cin = new Scanner(System.in);
		int a = 0, b = 0;
		
		a = cin.nextInt();
		b = cin.nextInt();
		
		int c = Math.min(a,b);
		a = Math.max(a, b);
		
		System.out.println(gcd(a , c));
		
	
	} Scanner cin = new Scanner(System.in); cin new Scanner(System.in) int a = 0 a 0 b = 0; b 0 a = cin.nextInt() a cin.nextInt() cin.nextInt cin b = cin.nextInt() b cin.nextInt() cin.nextInt cin int c = Math.min(a,b); c Math.min(a,b) Math.min Math a b a = Math.max(a, b) a Math.max(a, b) Math.max Math a b System.out.println(gcd(a , c)) System.out.println System.out System System.out gcd(a , c) gcd a c String[] args args public class Main {
	
	// we can assume that a is always greater than b
	
	public static int gcd(int a, int b) {
		return (b == 0)?  a : gcd(b, a % b);
	}
	public static void main(String[] args) {
		Scanner cin = new Scanner(System.in);
		int a = 0, b = 0;
		
		a = cin.nextInt();
		b = cin.nextInt();
		
		int c = Math.min(a,b);
		a = Math.max(a, b);
		
		System.out.println(gcd(a , c));
		
	
	}
} public class Main {
	
	// we can assume that a is always greater than b
	
	public static int gcd(int a, int b) {
		return (b == 0)?  a : gcd(b, a % b);
	}
	public static void main(String[] args) {
		Scanner cin = new Scanner(System.in);
		int a = 0, b = 0;
		
		a = cin.nextInt();
		b = cin.nextInt();
		
		int c = Math.min(a,b);
		a = Math.max(a, b);
		
		System.out.println(gcd(a , c));
		
	
	}
} Main
import java.util.Scanner;

public class Main {
	
	// we can assume that a is always greater than b
	
	public static int gcd(int a, int b) {
		return (b == 0)?  a : gcd(b, a % b);
	}
	public static void main(String[] args) {
		Scanner cin = new Scanner(System.in);
		int a = 0, b = 0;
		
		a = cin.nextInt();
		b = cin.nextInt();
		
		int c = Math.min(a,b);
		a = Math.max(a, b);
		
		System.out.println(gcd(a , c));
		
	
	}
}