import java.io.*;
import java.util.ArrayList;
public class Main{
	public static void main(String args[]){
    int a,b,ans = 0;
    BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
    try{
        String line = reader.readLine();
        String[] splitted = line.split(" ");
          if(Integer.parseInt(splitted[0]) > Integer.parseInt(splitted[1])){
            a = Integer.parseInt(splitted[0]);
            b = Integer.parseInt(splitted[1]);
          }else{
            a = Integer.parseInt(splitted[1]);
            b = Integer.parseInt(splitted[0]);
          }
      
		}catch(Exception e){
      a = 0;
      b = 0;
    }

    while(true){
      ans = b;
      b = a % b;
      a = ans;
      if (b == 0) break;
    }

    System.out.println(ans);

	}
} import java.io.*; io.* java import java.util.ArrayList; ArrayList java.util public class Main{
	public static void main(String args[]){
    int a,b,ans = 0;
    BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
    try{
        String line = reader.readLine();
        String[] splitted = line.split(" ");
          if(Integer.parseInt(splitted[0]) > Integer.parseInt(splitted[1])){
            a = Integer.parseInt(splitted[0]);
            b = Integer.parseInt(splitted[1]);
          }else{
            a = Integer.parseInt(splitted[1]);
            b = Integer.parseInt(splitted[0]);
          }
      
		}catch(Exception e){
      a = 0;
      b = 0;
    }

    while(true){
      ans = b;
      b = a % b;
      a = ans;
      if (b == 0) break;
    }

    System.out.println(ans);

	}
} Main public static void main(String args[]){
    int a,b,ans = 0;
    BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
    try{
        String line = reader.readLine();
        String[] splitted = line.split(" ");
          if(Integer.parseInt(splitted[0]) > Integer.parseInt(splitted[1])){
            a = Integer.parseInt(splitted[0]);
            b = Integer.parseInt(splitted[1]);
          }else{
            a = Integer.parseInt(splitted[1]);
            b = Integer.parseInt(splitted[0]);
          }
      
		}catch(Exception e){
      a = 0;
      b = 0;
    }

    while(true){
      ans = b;
      b = a % b;
      a = ans;
      if (b == 0) break;
    }

    System.out.println(ans);

	} main {
    int a,b,ans = 0;
    BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
    try{
        String line = reader.readLine();
        String[] splitted = line.split(" ");
          if(Integer.parseInt(splitted[0]) > Integer.parseInt(splitted[1])){
            a = Integer.parseInt(splitted[0]);
            b = Integer.parseInt(splitted[1]);
          }else{
            a = Integer.parseInt(splitted[1]);
            b = Integer.parseInt(splitted[0]);
          }
      
		}catch(Exception e){
      a = 0;
      b = 0;
    }

    while(true){
      ans = b;
      b = a % b;
      a = ans;
      if (b == 0) break;
    }

    System.out.println(ans);

	} int a a b b ans = 0; ans 0 BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); reader new BufferedReader(new InputStreamReader(System.in)) try{
        String line = reader.readLine();
        String[] splitted = line.split(" ");
          if(Integer.parseInt(splitted[0]) > Integer.parseInt(splitted[1])){
            a = Integer.parseInt(splitted[0]);
            b = Integer.parseInt(splitted[1]);
          }else{
            a = Integer.parseInt(splitted[1]);
            b = Integer.parseInt(splitted[0]);
          }
      
		}catch(Exception e){
      a = 0;
      b = 0;
    } catch(Exception e){
      a = 0;
      b = 0;
    } Exception e {
      a = 0;
      b = 0;
    } a = 0 a 0 b = 0 b 0 {
        String line = reader.readLine();
        String[] splitted = line.split(" ");
          if(Integer.parseInt(splitted[0]) > Integer.parseInt(splitted[1])){
            a = Integer.parseInt(splitted[0]);
            b = Integer.parseInt(splitted[1]);
          }else{
            a = Integer.parseInt(splitted[1]);
            b = Integer.parseInt(splitted[0]);
          }
      
		} String line = reader.readLine(); line reader.readLine() reader.readLine reader String[] splitted = line.split(" "); splitted line.split(" ") line.split line " " if(Integer.parseInt(splitted[0]) > Integer.parseInt(splitted[1])){
            a = Integer.parseInt(splitted[0]);
            b = Integer.parseInt(splitted[1]);
          }else{
            a = Integer.parseInt(splitted[1]);
            b = Integer.parseInt(splitted[0]);
          } Integer.parseInt(splitted[0]) > Integer.parseInt(splitted[1]) Integer.parseInt(splitted[0]) Integer.parseInt Integer splitted[0] splitted 0 Integer.parseInt(splitted[1]) Integer.parseInt Integer splitted[1] splitted 1 {
            a = Integer.parseInt(splitted[0]);
            b = Integer.parseInt(splitted[1]);
          } a = Integer.parseInt(splitted[0]) a Integer.parseInt(splitted[0]) Integer.parseInt Integer splitted[0] splitted 0 b = Integer.parseInt(splitted[1]) b Integer.parseInt(splitted[1]) Integer.parseInt Integer splitted[1] splitted 1 {
            a = Integer.parseInt(splitted[1]);
            b = Integer.parseInt(splitted[0]);
          } a = Integer.parseInt(splitted[1]) a Integer.parseInt(splitted[1]) Integer.parseInt Integer splitted[1] splitted 1 b = Integer.parseInt(splitted[0]) b Integer.parseInt(splitted[0]) Integer.parseInt Integer splitted[0] splitted 0 while(true){
      ans = b;
      b = a % b;
      a = ans;
      if (b == 0) break;
    } true {
      ans = b;
      b = a % b;
      a = ans;
      if (b == 0) break;
    } ans = b ans b b = a % b b a % b a b a = ans a ans if (b == 0) break; b == 0 b 0 break; System.out.println(ans) System.out.println System.out System System.out ans String args[] args public class Main{
	public static void main(String args[]){
    int a,b,ans = 0;
    BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
    try{
        String line = reader.readLine();
        String[] splitted = line.split(" ");
          if(Integer.parseInt(splitted[0]) > Integer.parseInt(splitted[1])){
            a = Integer.parseInt(splitted[0]);
            b = Integer.parseInt(splitted[1]);
          }else{
            a = Integer.parseInt(splitted[1]);
            b = Integer.parseInt(splitted[0]);
          }
      
		}catch(Exception e){
      a = 0;
      b = 0;
    }

    while(true){
      ans = b;
      b = a % b;
      a = ans;
      if (b == 0) break;
    }

    System.out.println(ans);

	}
} public class Main{
	public static void main(String args[]){
    int a,b,ans = 0;
    BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
    try{
        String line = reader.readLine();
        String[] splitted = line.split(" ");
          if(Integer.parseInt(splitted[0]) > Integer.parseInt(splitted[1])){
            a = Integer.parseInt(splitted[0]);
            b = Integer.parseInt(splitted[1]);
          }else{
            a = Integer.parseInt(splitted[1]);
            b = Integer.parseInt(splitted[0]);
          }
      
		}catch(Exception e){
      a = 0;
      b = 0;
    }

    while(true){
      ans = b;
      b = a % b;
      a = ans;
      if (b == 0) break;
    }

    System.out.println(ans);

	}
} Main
import java.io.*;
import java.util.ArrayList;
public class Main{
	public static void main(String args[]){
    int a,b,ans = 0;
    BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
    try{
        String line = reader.readLine();
        String[] splitted = line.split(" ");
          if(Integer.parseInt(splitted[0]) > Integer.parseInt(splitted[1])){
            a = Integer.parseInt(splitted[0]);
            b = Integer.parseInt(splitted[1]);
          }else{
            a = Integer.parseInt(splitted[1]);
            b = Integer.parseInt(splitted[0]);
          }
      
		}catch(Exception e){
      a = 0;
      b = 0;
    }

    while(true){
      ans = b;
      b = a % b;
      a = ans;
      if (b == 0) break;
    }

    System.out.println(ans);

	}
}
