import java.util.Scanner;
public class Main {
	Scanner sc = new Scanner(System.in);
	int x,y;	
	int keep=0;
	
	public void input() {
		x = sc.nextInt();
		y = sc.nextInt();
	}
	
	public void conpute() {
		if(x > y) {
			while(x%y != 0) {
				keep = x;
				x = y;
				y = keep % y;
			}
			System.out.println(y);
		}else {
			while(y%x != 0) {
				keep = y;
				y = x;
				x = keep % y;
			}
			System.out.println(x);
		}
	}
	
	public static void main(String[] args) {
		Main obj = new Main();
		obj.input();
		obj.conpute();
	}
}
 import java.util.Scanner; Scanner java.util public class Main {
	Scanner sc = new Scanner(System.in);
	int x,y;	
	int keep=0;
	
	public void input() {
		x = sc.nextInt();
		y = sc.nextInt();
	}
	
	public void conpute() {
		if(x > y) {
			while(x%y != 0) {
				keep = x;
				x = y;
				y = keep % y;
			}
			System.out.println(y);
		}else {
			while(y%x != 0) {
				keep = y;
				y = x;
				x = keep % y;
			}
			System.out.println(x);
		}
	}
	
	public static void main(String[] args) {
		Main obj = new Main();
		obj.input();
		obj.conpute();
	}
} Main Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int x x y; y int keep=0; keep 0 public void input() {
		x = sc.nextInt();
		y = sc.nextInt();
	} input {
		x = sc.nextInt();
		y = sc.nextInt();
	} x = sc.nextInt() x sc.nextInt() sc.nextInt sc y = sc.nextInt() y sc.nextInt() sc.nextInt sc public void conpute() {
		if(x > y) {
			while(x%y != 0) {
				keep = x;
				x = y;
				y = keep % y;
			}
			System.out.println(y);
		}else {
			while(y%x != 0) {
				keep = y;
				y = x;
				x = keep % y;
			}
			System.out.println(x);
		}
	} conpute {
		if(x > y) {
			while(x%y != 0) {
				keep = x;
				x = y;
				y = keep % y;
			}
			System.out.println(y);
		}else {
			while(y%x != 0) {
				keep = y;
				y = x;
				x = keep % y;
			}
			System.out.println(x);
		}
	} if(x > y) {
			while(x%y != 0) {
				keep = x;
				x = y;
				y = keep % y;
			}
			System.out.println(y);
		}else {
			while(y%x != 0) {
				keep = y;
				y = x;
				x = keep % y;
			}
			System.out.println(x);
		} x > y x y {
			while(x%y != 0) {
				keep = x;
				x = y;
				y = keep % y;
			}
			System.out.println(y);
		} while(x%y != 0) {
				keep = x;
				x = y;
				y = keep % y;
			} x%y != 0 x%y x y 0 {
				keep = x;
				x = y;
				y = keep % y;
			} keep = x keep x x = y x y y = keep % y y keep % y keep y System.out.println(y) System.out.println System.out System System.out y {
			while(y%x != 0) {
				keep = y;
				y = x;
				x = keep % y;
			}
			System.out.println(x);
		} while(y%x != 0) {
				keep = y;
				y = x;
				x = keep % y;
			} y%x != 0 y%x y x 0 {
				keep = y;
				y = x;
				x = keep % y;
			} keep = y keep y y = x y x x = keep % y x keep % y keep y System.out.println(x) System.out.println System.out System System.out x public static void main(String[] args) {
		Main obj = new Main();
		obj.input();
		obj.conpute();
	} main {
		Main obj = new Main();
		obj.input();
		obj.conpute();
	} Main obj = new Main(); obj new Main() obj.input() obj.input obj obj.conpute() obj.conpute obj String[] args args public class Main {
	Scanner sc = new Scanner(System.in);
	int x,y;	
	int keep=0;
	
	public void input() {
		x = sc.nextInt();
		y = sc.nextInt();
	}
	
	public void conpute() {
		if(x > y) {
			while(x%y != 0) {
				keep = x;
				x = y;
				y = keep % y;
			}
			System.out.println(y);
		}else {
			while(y%x != 0) {
				keep = y;
				y = x;
				x = keep % y;
			}
			System.out.println(x);
		}
	}
	
	public static void main(String[] args) {
		Main obj = new Main();
		obj.input();
		obj.conpute();
	}
} public class Main {
	Scanner sc = new Scanner(System.in);
	int x,y;	
	int keep=0;
	
	public void input() {
		x = sc.nextInt();
		y = sc.nextInt();
	}
	
	public void conpute() {
		if(x > y) {
			while(x%y != 0) {
				keep = x;
				x = y;
				y = keep % y;
			}
			System.out.println(y);
		}else {
			while(y%x != 0) {
				keep = y;
				y = x;
				x = keep % y;
			}
			System.out.println(x);
		}
	}
	
	public static void main(String[] args) {
		Main obj = new Main();
		obj.input();
		obj.conpute();
	}
} Main
import java.util.Scanner;
public class Main {
	Scanner sc = new Scanner(System.in);
	int x,y;	
	int keep=0;
	
	public void input() {
		x = sc.nextInt();
		y = sc.nextInt();
	}
	
	public void conpute() {
		if(x > y) {
			while(x%y != 0) {
				keep = x;
				x = y;
				y = keep % y;
			}
			System.out.println(y);
		}else {
			while(y%x != 0) {
				keep = y;
				y = x;
				x = keep % y;
			}
			System.out.println(x);
		}
	}
	
	public static void main(String[] args) {
		Main obj = new Main();
		obj.input();
		obj.conpute();
	}
}

