import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Scanner;
/**
 *
 * @author Y
 */
public class Main {
    public static void main(String[] args) throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        
        String[] s = br.readLine().split(" ");
        int a = Integer.parseInt(s[0]);
        int b = Integer.parseInt(s[1]);
        
        System.out.println( (a>b) ? GCDivisor(a,b) : GCDivisor(b,a) );
        
    }
    
    static int GCDivisor(int x1, int x2){
        return x2 == 0 ? x1 : GCDivisor(x2, x1%x2);
    }
} import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io import java.io.InputStreamReader; InputStreamReader java.io import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        
        String[] s = br.readLine().split(" ");
        int a = Integer.parseInt(s[0]);
        int b = Integer.parseInt(s[1]);
        
        System.out.println( (a>b) ? GCDivisor(a,b) : GCDivisor(b,a) );
        
    }
    
    static int GCDivisor(int x1, int x2){
        return x2 == 0 ? x1 : GCDivisor(x2, x1%x2);
    }
} Main public static void main(String[] args) throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        
        String[] s = br.readLine().split(" ");
        int a = Integer.parseInt(s[0]);
        int b = Integer.parseInt(s[1]);
        
        System.out.println( (a>b) ? GCDivisor(a,b) : GCDivisor(b,a) );
        
    } main {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        
        String[] s = br.readLine().split(" ");
        int a = Integer.parseInt(s[0]);
        int b = Integer.parseInt(s[1]);
        
        System.out.println( (a>b) ? GCDivisor(a,b) : GCDivisor(b,a) );
        
    } BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) String[] s = br.readLine().split(" "); s br.readLine().split(" ") br.readLine().split br.readLine() br.readLine br " " int a = Integer.parseInt(s[0]); a Integer.parseInt(s[0]) Integer.parseInt Integer s[0] s 0 int b = Integer.parseInt(s[1]); b Integer.parseInt(s[1]) Integer.parseInt Integer s[1] s 1 System.out.println( (a>b) ? GCDivisor(a,b) : GCDivisor(b,a) ) System.out.println System.out System System.out (a>b) ? GCDivisor(a,b) : GCDivisor(b,a) (a>b) a b GCDivisor(a,b) GCDivisor a b GCDivisor(b,a) GCDivisor b a String[] args args static int GCDivisor(int x1, int x2){
        return x2 == 0 ? x1 : GCDivisor(x2, x1%x2);
    } GCDivisor {
        return x2 == 0 ? x1 : GCDivisor(x2, x1%x2);
    } return x2 == 0 ? x1 : GCDivisor(x2, x1%x2); x2 == 0 ? x1 : GCDivisor(x2, x1%x2) x2 == 0 x2 0 x1 GCDivisor(x2, x1%x2) GCDivisor x2 x1%x2 x1 x2 int x1 x1 int x2 x2 public class Main {
    public static void main(String[] args) throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        
        String[] s = br.readLine().split(" ");
        int a = Integer.parseInt(s[0]);
        int b = Integer.parseInt(s[1]);
        
        System.out.println( (a>b) ? GCDivisor(a,b) : GCDivisor(b,a) );
        
    }
    
    static int GCDivisor(int x1, int x2){
        return x2 == 0 ? x1 : GCDivisor(x2, x1%x2);
    }
} public class Main {
    public static void main(String[] args) throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        
        String[] s = br.readLine().split(" ");
        int a = Integer.parseInt(s[0]);
        int b = Integer.parseInt(s[1]);
        
        System.out.println( (a>b) ? GCDivisor(a,b) : GCDivisor(b,a) );
        
    }
    
    static int GCDivisor(int x1, int x2){
        return x2 == 0 ? x1 : GCDivisor(x2, x1%x2);
    }
} Main
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Scanner;
/**
 *
 * @author Y
 */
public class Main {
    public static void main(String[] args) throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        
        String[] s = br.readLine().split(" ");
        int a = Integer.parseInt(s[0]);
        int b = Integer.parseInt(s[1]);
        
        System.out.println( (a>b) ? GCDivisor(a,b) : GCDivisor(b,a) );
        
    }
    
    static int GCDivisor(int x1, int x2){
        return x2 == 0 ? x1 : GCDivisor(x2, x1%x2);
    }
}