import java.util.Scanner;

/**
 * @author kawakami
 *
 */
class Main {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		StringBuilder sb = new StringBuilder();
		Scanner as = new Scanner(System.in);
		
		int x,y,ama;
		int i = 0;
		int big = 0;
		int sma = 0;
		
		x = Integer.parseInt(as.next());
		y = Integer.parseInt(as.next());
		
		if(x > y){
			
			big = x;
			sma = y;
	
		}
		else{
			
			big = y;
			sma = x;
			
		}
		
		ama = big % sma;
		if(ama == 0){
			
			i = sma;
			
		}
		else{
			for(i=ama;i>=1;i--){
				
				if(ama % i == 0 && sma % i == 0){
					
					break;
					
				}
				
			}
		
		}
		if(i != 0){
			
			sb.append(String.valueOf(i));
		
		}
		else{
			
			sb.append(String.valueOf(1));
			
		}
		
		System.out.println(sb.toString());
	}

} import java.util.Scanner; Scanner java.util class Main {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		StringBuilder sb = new StringBuilder();
		Scanner as = new Scanner(System.in);
		
		int x,y,ama;
		int i = 0;
		int big = 0;
		int sma = 0;
		
		x = Integer.parseInt(as.next());
		y = Integer.parseInt(as.next());
		
		if(x > y){
			
			big = x;
			sma = y;
	
		}
		else{
			
			big = y;
			sma = x;
			
		}
		
		ama = big % sma;
		if(ama == 0){
			
			i = sma;
			
		}
		else{
			for(i=ama;i>=1;i--){
				
				if(ama % i == 0 && sma % i == 0){
					
					break;
					
				}
				
			}
		
		}
		if(i != 0){
			
			sb.append(String.valueOf(i));
		
		}
		else{
			
			sb.append(String.valueOf(1));
			
		}
		
		System.out.println(sb.toString());
	}

} Main /**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		StringBuilder sb = new StringBuilder();
		Scanner as = new Scanner(System.in);
		
		int x,y,ama;
		int i = 0;
		int big = 0;
		int sma = 0;
		
		x = Integer.parseInt(as.next());
		y = Integer.parseInt(as.next());
		
		if(x > y){
			
			big = x;
			sma = y;
	
		}
		else{
			
			big = y;
			sma = x;
			
		}
		
		ama = big % sma;
		if(ama == 0){
			
			i = sma;
			
		}
		else{
			for(i=ama;i>=1;i--){
				
				if(ama % i == 0 && sma % i == 0){
					
					break;
					
				}
				
			}
		
		}
		if(i != 0){
			
			sb.append(String.valueOf(i));
		
		}
		else{
			
			sb.append(String.valueOf(1));
			
		}
		
		System.out.println(sb.toString());
	} main {
		// TODO Auto-generated method stub
		StringBuilder sb = new StringBuilder();
		Scanner as = new Scanner(System.in);
		
		int x,y,ama;
		int i = 0;
		int big = 0;
		int sma = 0;
		
		x = Integer.parseInt(as.next());
		y = Integer.parseInt(as.next());
		
		if(x > y){
			
			big = x;
			sma = y;
	
		}
		else{
			
			big = y;
			sma = x;
			
		}
		
		ama = big % sma;
		if(ama == 0){
			
			i = sma;
			
		}
		else{
			for(i=ama;i>=1;i--){
				
				if(ama % i == 0 && sma % i == 0){
					
					break;
					
				}
				
			}
		
		}
		if(i != 0){
			
			sb.append(String.valueOf(i));
		
		}
		else{
			
			sb.append(String.valueOf(1));
			
		}
		
		System.out.println(sb.toString());
	} StringBuilder sb = new StringBuilder(); sb new StringBuilder() Scanner as = new Scanner(System.in); as new Scanner(System.in) int x x y y ama; ama int i = 0; i 0 int big = 0; big 0 int sma = 0; sma 0 x = Integer.parseInt(as.next()) x Integer.parseInt(as.next()) Integer.parseInt Integer as.next() as.next as y = Integer.parseInt(as.next()) y Integer.parseInt(as.next()) Integer.parseInt Integer as.next() as.next as if(x > y){
			
			big = x;
			sma = y;
	
		}
		else{
			
			big = y;
			sma = x;
			
		} x > y x y {
			
			big = x;
			sma = y;
	
		} big = x big x sma = y sma y {
			
			big = y;
			sma = x;
			
		} big = y big y sma = x sma x ama = big % sma ama big % sma big sma if(ama == 0){
			
			i = sma;
			
		}
		else{
			for(i=ama;i>=1;i--){
				
				if(ama % i == 0 && sma % i == 0){
					
					break;
					
				}
				
			}
		
		} ama == 0 ama 0 {
			
			i = sma;
			
		} i = sma i sma {
			for(i=ama;i>=1;i--){
				
				if(ama % i == 0 && sma % i == 0){
					
					break;
					
				}
				
			}
		
		} for(i=ama;i>=1;i--){
				
				if(ama % i == 0 && sma % i == 0){
					
					break;
					
				}
				
			} i=ama; i=ama i ama i>=1 i 1 i-- i-- i {
				
				if(ama % i == 0 && sma % i == 0){
					
					break;
					
				}
				
			} {
				
				if(ama % i == 0 && sma % i == 0){
					
					break;
					
				}
				
			} if(ama % i == 0 && sma % i == 0){
					
					break;
					
				} ama % i == 0 && sma % i == 0 ama % i == 0 ama % i ama i 0 sma % i == 0 sma % i sma i 0 {
					
					break;
					
				} break; if(i != 0){
			
			sb.append(String.valueOf(i));
		
		}
		else{
			
			sb.append(String.valueOf(1));
			
		} i != 0 i 0 {
			
			sb.append(String.valueOf(i));
		
		} sb.append(String.valueOf(i)) sb.append sb String.valueOf(i) String.valueOf String i {
			
			sb.append(String.valueOf(1));
			
		} sb.append(String.valueOf(1)) sb.append sb String.valueOf(1) String.valueOf String 1 System.out.println(sb.toString()) System.out.println System.out System System.out sb.toString() sb.toString sb String[] args args
import java.util.Scanner;

/**
 * @author kawakami
 *
 */
class Main {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		StringBuilder sb = new StringBuilder();
		Scanner as = new Scanner(System.in);
		
		int x,y,ama;
		int i = 0;
		int big = 0;
		int sma = 0;
		
		x = Integer.parseInt(as.next());
		y = Integer.parseInt(as.next());
		
		if(x > y){
			
			big = x;
			sma = y;
	
		}
		else{
			
			big = y;
			sma = x;
			
		}
		
		ama = big % sma;
		if(ama == 0){
			
			i = sma;
			
		}
		else{
			for(i=ama;i>=1;i--){
				
				if(ama % i == 0 && sma % i == 0){
					
					break;
					
				}
				
			}
		
		}
		if(i != 0){
			
			sb.append(String.valueOf(i));
		
		}
		else{
			
			sb.append(String.valueOf(1));
			
		}
		
		System.out.println(sb.toString());
	}

}