import java.io.IOException;
import java.util.Scanner;
public class Main {
    public static void main(String[] args) throws IOException{
    	Scanner sc = new Scanner(System.in);

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

    	if(y>x) {
    		int tmp = x;
    		x = y;
    		y = tmp;
    	}

    	int a = 0;

    	if(x != y) {
	    	int z = x%y;

	    	a = z;

	    	while(true) {
	    		if(y%a==0 && z%a==0) {
	    			break;
	    		}
	    		a--;
	    	}
    	}else {
    		a = x;
    	}

    	System.out.println(a);

    	sc.close();
    }
} import java.io.IOException; IOException java.io import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) throws IOException{
    	Scanner sc = new Scanner(System.in);

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

    	if(y>x) {
    		int tmp = x;
    		x = y;
    		y = tmp;
    	}

    	int a = 0;

    	if(x != y) {
	    	int z = x%y;

	    	a = z;

	    	while(true) {
	    		if(y%a==0 && z%a==0) {
	    			break;
	    		}
	    		a--;
	    	}
    	}else {
    		a = x;
    	}

    	System.out.println(a);

    	sc.close();
    }
} Main public static void main(String[] args) throws IOException{
    	Scanner sc = new Scanner(System.in);

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

    	if(y>x) {
    		int tmp = x;
    		x = y;
    		y = tmp;
    	}

    	int a = 0;

    	if(x != y) {
	    	int z = x%y;

	    	a = z;

	    	while(true) {
	    		if(y%a==0 && z%a==0) {
	    			break;
	    		}
	    		a--;
	    	}
    	}else {
    		a = x;
    	}

    	System.out.println(a);

    	sc.close();
    } main {
    	Scanner sc = new Scanner(System.in);

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

    	if(y>x) {
    		int tmp = x;
    		x = y;
    		y = tmp;
    	}

    	int a = 0;

    	if(x != y) {
	    	int z = x%y;

	    	a = z;

	    	while(true) {
	    		if(y%a==0 && z%a==0) {
	    			break;
	    		}
	    		a--;
	    	}
    	}else {
    		a = x;
    	}

    	System.out.println(a);

    	sc.close();
    } 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 tmp = x;
    		x = y;
    		y = tmp;
    	} y>x y x {
    		int tmp = x;
    		x = y;
    		y = tmp;
    	} int tmp = x; tmp x x = y x y y = tmp y tmp int a = 0; a 0 if(x != y) {
	    	int z = x%y;

	    	a = z;

	    	while(true) {
	    		if(y%a==0 && z%a==0) {
	    			break;
	    		}
	    		a--;
	    	}
    	}else {
    		a = x;
    	} x != y x y {
	    	int z = x%y;

	    	a = z;

	    	while(true) {
	    		if(y%a==0 && z%a==0) {
	    			break;
	    		}
	    		a--;
	    	}
    	} int z = x%y; z x%y x y a = z a z while(true) {
	    		if(y%a==0 && z%a==0) {
	    			break;
	    		}
	    		a--;
	    	} true {
	    		if(y%a==0 && z%a==0) {
	    			break;
	    		}
	    		a--;
	    	} if(y%a==0 && z%a==0) {
	    			break;
	    		} y%a==0 && z%a==0 y%a==0 y%a y a 0 z%a==0 z%a z a 0 {
	    			break;
	    		} break; a-- a {
    		a = x;
    	} a = x a x System.out.println(a) System.out.println System.out System System.out a sc.close() sc.close sc String[] args args public class Main {
    public static void main(String[] args) throws IOException{
    	Scanner sc = new Scanner(System.in);

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

    	if(y>x) {
    		int tmp = x;
    		x = y;
    		y = tmp;
    	}

    	int a = 0;

    	if(x != y) {
	    	int z = x%y;

	    	a = z;

	    	while(true) {
	    		if(y%a==0 && z%a==0) {
	    			break;
	    		}
	    		a--;
	    	}
    	}else {
    		a = x;
    	}

    	System.out.println(a);

    	sc.close();
    }
} public class Main {
    public static void main(String[] args) throws IOException{
    	Scanner sc = new Scanner(System.in);

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

    	if(y>x) {
    		int tmp = x;
    		x = y;
    		y = tmp;
    	}

    	int a = 0;

    	if(x != y) {
	    	int z = x%y;

	    	a = z;

	    	while(true) {
	    		if(y%a==0 && z%a==0) {
	    			break;
	    		}
	    		a--;
	    	}
    	}else {
    		a = x;
    	}

    	System.out.println(a);

    	sc.close();
    }
} Main
import java.io.IOException;
import java.util.Scanner;
public class Main {
    public static void main(String[] args) throws IOException{
    	Scanner sc = new Scanner(System.in);

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

    	if(y>x) {
    		int tmp = x;
    		x = y;
    		y = tmp;
    	}

    	int a = 0;

    	if(x != y) {
	    	int z = x%y;

	    	a = z;

	    	while(true) {
	    		if(y%a==0 && z%a==0) {
	    			break;
	    		}
	    		a--;
	    	}
    	}else {
    		a = x;
    	}

    	System.out.println(a);

    	sc.close();
    }
}
