import java.util.Scanner;
public class Main {
public static void main(String[] args){
Scanner input = new Scanner(System.in);
int a = input.nextInt();
int b = input.nextInt();
int x = Math.max(a,b);
int y = Math.min(a,b);
int out = helper(x,y);
System.out.println(out);
}

public static int helper(int x, int y){
if(y == 0){
return x;
} else if(x >= y){
return helper(y, x%y);
} else {
return 1;
}
}

} import java.util.Scanner; Scanner java.util public class Main {
public static void main(String[] args){
Scanner input = new Scanner(System.in);
int a = input.nextInt();
int b = input.nextInt();
int x = Math.max(a,b);
int y = Math.min(a,b);
int out = helper(x,y);
System.out.println(out);
}

public static int helper(int x, int y){
if(y == 0){
return x;
} else if(x >= y){
return helper(y, x%y);
} else {
return 1;
}
}

} Main public static void main(String[] args){
Scanner input = new Scanner(System.in);
int a = input.nextInt();
int b = input.nextInt();
int x = Math.max(a,b);
int y = Math.min(a,b);
int out = helper(x,y);
System.out.println(out);
} main {
Scanner input = new Scanner(System.in);
int a = input.nextInt();
int b = input.nextInt();
int x = Math.max(a,b);
int y = Math.min(a,b);
int out = helper(x,y);
System.out.println(out);
} Scanner input = new Scanner(System.in); input new Scanner(System.in) int a = input.nextInt(); a input.nextInt() input.nextInt input int b = input.nextInt(); b input.nextInt() input.nextInt input int x = Math.max(a,b); x Math.max(a,b) Math.max Math a b int y = Math.min(a,b); y Math.min(a,b) Math.min Math a b int out = helper(x,y); out helper(x,y) helper x y System.out.println(out) System.out.println System.out System System.out out String[] args args public static int helper(int x, int y){
if(y == 0){
return x;
} else if(x >= y){
return helper(y, x%y);
} else {
return 1;
}
} helper {
if(y == 0){
return x;
} else if(x >= y){
return helper(y, x%y);
} else {
return 1;
}
} if(y == 0){
return x;
} else if(x >= y){
return helper(y, x%y);
} else {
return 1;
} y == 0 y 0 {
return x;
} return x; x if(x >= y){
return helper(y, x%y);
} else {
return 1;
} x >= y x y {
return helper(y, x%y);
} return helper(y, x%y); helper(y, x%y) helper y x%y x y {
return 1;
} return 1; 1 int x x int y y public class Main {
public static void main(String[] args){
Scanner input = new Scanner(System.in);
int a = input.nextInt();
int b = input.nextInt();
int x = Math.max(a,b);
int y = Math.min(a,b);
int out = helper(x,y);
System.out.println(out);
}

public static int helper(int x, int y){
if(y == 0){
return x;
} else if(x >= y){
return helper(y, x%y);
} else {
return 1;
}
}

} public class Main {
public static void main(String[] args){
Scanner input = new Scanner(System.in);
int a = input.nextInt();
int b = input.nextInt();
int x = Math.max(a,b);
int y = Math.min(a,b);
int out = helper(x,y);
System.out.println(out);
}

public static int helper(int x, int y){
if(y == 0){
return x;
} else if(x >= y){
return helper(y, x%y);
} else {
return 1;
}
}

} Main
import java.util.Scanner;
public class Main {
public static void main(String[] args){
Scanner input = new Scanner(System.in);
int a = input.nextInt();
int b = input.nextInt();
int x = Math.max(a,b);
int y = Math.min(a,b);
int out = helper(x,y);
System.out.println(out);
}

public static int helper(int x, int y){
if(y == 0){
return x;
} else if(x >= y){
return helper(y, x%y);
} else {
return 1;
}
}

}
