import java.util.Scanner;
public class Divisor1 {
//static int m;
//static int n;
int a,b;
public static void main(String[]args){
//输入两个数m,n
System.out.println("请输入第一个数m=");
Scanner in = new Scanner(System.in);
int m = in.nextInt();
System.out.println("请输入第二个数n=");
int n = in.nextInt();
int r;
while(n!=0){
r = m%n;
m = n;
n = r;
}
System.out.println(m);
}
}