import java.util.*;
import java.math.BigInteger;
 
public class Main {
	public static void main(String[] args) {
 
	Scanner sc  = new Scanner(System.in);
	String str = "";
        
    String str3  = sc.next();
    String str2 = sc.next();
    BigInteger big1 = new  BigInteger( str3 );
    BigInteger big2 = new BigInteger( str2 );
    
    BigInteger big3 = new  BigInteger( str3 );
    BigInteger big4 = new BigInteger( str2 );
    
    BigInteger big5 = big1.add(big2);
    BigInteger big6 = big3.multiply(big4);
    
   // BigInteger big7 =  gcd( big5, big6);
    

    System.out.print( big5.gcd(big6) );
        System.out.println( );
	}
}