import java.util.Scanner;

public class Main{
    public static void main(String[] args){

        Scanner  sc = new Scanner(System.in);

        int x = sc.nextInt();
        int y = sc.nextInt();

        if(y<x) {
            int t=0;
            t=y;    y=x;    x=t;
        }
        int z = 0;
        for(int i=0;;i++){
            z = y % x;
            if(z==0){
                System.out.println(x);
                break;
            }else{
                y = x;  x = z;
            }

        }
            
        
    }
} import java.util.Scanner; Scanner java.util public class Main{
    public static void main(String[] args){

        Scanner  sc = new Scanner(System.in);

        int x = sc.nextInt();
        int y = sc.nextInt();

        if(y<x) {
            int t=0;
            t=y;    y=x;    x=t;
        }
        int z = 0;
        for(int i=0;;i++){
            z = y % x;
            if(z==0){
                System.out.println(x);
                break;
            }else{
                y = x;  x = z;
            }

        }
            
        
    }
} Main public static void main(String[] args){

        Scanner  sc = new Scanner(System.in);

        int x = sc.nextInt();
        int y = sc.nextInt();

        if(y<x) {
            int t=0;
            t=y;    y=x;    x=t;
        }
        int z = 0;
        for(int i=0;;i++){
            z = y % x;
            if(z==0){
                System.out.println(x);
                break;
            }else{
                y = x;  x = z;
            }

        }
            
        
    } main {

        Scanner  sc = new Scanner(System.in);

        int x = sc.nextInt();
        int y = sc.nextInt();

        if(y<x) {
            int t=0;
            t=y;    y=x;    x=t;
        }
        int z = 0;
        for(int i=0;;i++){
            z = y % x;
            if(z==0){
                System.out.println(x);
                break;
            }else{
                y = x;  x = z;
            }

        }
            
        
    } Scanner  sc = new Scanner(System.in); sc new Scanner(System.in) int x = sc.nextInt(); x sc.nextInt() sc.nextInt sc int y = sc.nextInt(); y sc.nextInt() sc.nextInt sc if(y<x) {
            int t=0;
            t=y;    y=x;    x=t;
        } y<x y x {
            int t=0;
            t=y;    y=x;    x=t;
        } int t=0; t 0 t=y t y y=x y x x=t x t int z = 0; z 0 for(int i=0;;i++){
            z = y % x;
            if(z==0){
                System.out.println(x);
                break;
            }else{
                y = x;  x = z;
            }

        } int i=0; int i=0; i 0 i++ i++ i {
            z = y % x;
            if(z==0){
                System.out.println(x);
                break;
            }else{
                y = x;  x = z;
            }

        } {
            z = y % x;
            if(z==0){
                System.out.println(x);
                break;
            }else{
                y = x;  x = z;
            }

        } z = y % x z y % x y x if(z==0){
                System.out.println(x);
                break;
            }else{
                y = x;  x = z;
            } z==0 z 0 {
                System.out.println(x);
                break;
            } System.out.println(x) System.out.println System.out System System.out x break; {
                y = x;  x = z;
            } y = x y x x = z x z String[] args args public class Main{
    public static void main(String[] args){

        Scanner  sc = new Scanner(System.in);

        int x = sc.nextInt();
        int y = sc.nextInt();

        if(y<x) {
            int t=0;
            t=y;    y=x;    x=t;
        }
        int z = 0;
        for(int i=0;;i++){
            z = y % x;
            if(z==0){
                System.out.println(x);
                break;
            }else{
                y = x;  x = z;
            }

        }
            
        
    }
} public class Main{
    public static void main(String[] args){

        Scanner  sc = new Scanner(System.in);

        int x = sc.nextInt();
        int y = sc.nextInt();

        if(y<x) {
            int t=0;
            t=y;    y=x;    x=t;
        }
        int z = 0;
        for(int i=0;;i++){
            z = y % x;
            if(z==0){
                System.out.println(x);
                break;
            }else{
                y = x;  x = z;
            }

        }
            
        
    }
} Main
import java.util.Scanner;

public class Main{
    public static void main(String[] args){

        Scanner  sc = new Scanner(System.in);

        int x = sc.nextInt();
        int y = sc.nextInt();

        if(y<x) {
            int t=0;
            t=y;    y=x;    x=t;
        }
        int z = 0;
        for(int i=0;;i++){
            z = y % x;
            if(z==0){
                System.out.println(x);
                break;
            }else{
                y = x;  x = z;
            }

        }
            
        
    }
}
