

import java.io.*;
public class Main {

    public static void main(String[] args) throws IOException  {

        // ?¨??????\??????????????????????????????
        int c;
        int keta = 0;
        // int hairetsu_keta[] = new int[4]; hairetsu_keta[0] = 0;hairetsu_keta[1] = 0;hairetsu_keta[2] = 0;hairetsu_keta[3] = 0;
        int hairetsu_keta[] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; // ???????????¨???????????¨????????£????????????
        int j = 0;
        int deru = 0;
        // int hairetsu[] = new int[4]; hairetsu[0] = 0; hairetsu[1] = 0; hairetsu[2] = 0; hairetsu[3] = 0;
        int hairetsu[] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};//??? ????????¨???????????¨????????£???????????????????????????????????°????¢??????? ?????????20???
        int hairetsu_fugou[] = {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1};//?¬???????????????¨??????????????¨????????? ???????¬???????????????????????????\???
        int i= 0;
        while ((c = System.in.read()) != -1  )
        {
            // System.out.println(c);
            if ( c > 47 && c < 58) // suuji ga kita
               {
                hairetsu[i] = c-48;
                i++;
                keta++;

                // System.out.println("Qurege_no_kazu_keta_hantaikara:" + Qurage_no_kazu);
               }
            if ( c == 45) // minus ga kita
               {
                hairetsu_fugou[j] = -1;
               }

            if ( c == 10) // return ga kita
            {
                hairetsu_keta[j] = keta;
                deru++; //return ga  kitara while wo deru
                j++;
            }
            if ( c == 32) //space ga kita
            {

                hairetsu_keta[j] = keta;
                keta = 0;//space ga kitara tsugi no moji no tame keta ha sokomade
                j++;
            }
            if (deru > 0)
            {
                break;
                }
        }
           // ?¨??????\?????????????????????????????????????????????

        // ??°??????????????\??????
        //int hairetsu_suuchi[] = new int[4]; hairetsu_suuchi[0] = 0; hairetsu_suuchi[1] = 0; hairetsu_suuchi[2] = 0; hairetsu_suuchi[3] = 0;
        int hairetsu_suuchi[] = {0,0,0,0,0,0,0,0,0,0};//???????????¨????????? ??¨????????£????????????
        int k = 0;
        int m = 0;
        int n = 0;


        while( n < (j + 1))
        {
        while(j > 0 && hairetsu_keta[n] > 0 )
        {
            hairetsu_suuchi[k] = hairetsu_suuchi[k]*10 + hairetsu[m];
            hairetsu_keta[n] = hairetsu_keta[n] - 1;
            m++;
        }
        if (hairetsu_keta[n] == 0)
        {
            if(hairetsu_fugou[n] == -1)
            {
                hairetsu_suuchi[k] = hairetsu_suuchi[k]*(-1);

            }
            n++;
            k++;
        }
        }

        //??°??????????????\???????????????
        /*
          for (int p = 0; p < k - 1 ; p++)

        {
        System.out.println("???????????°??????" + hairetsu_suuchi[p]);
        }

        */
        int x = hairetsu_suuchi[0];
        int y = hairetsu_suuchi[1];
        int z;
        while(x != 0)
        {
        if( y > x )
        {
           z = y;
           y = x;
           x = z;
        }
        x = x%y;
        }
        
        	System.out.println(y);

    }

}
/tmp/hf-datasets-cache/medium/datasets/42704881117311-config-parquet-and-info-qiankunmu-Project_CodeNet-896c9d36/hub/datasets--qiankunmu--Project_CodeNet_Python800_and_Java250/snapshots/c899fde44a77ba1cc14973ed3de064e4ff3aadc7/Project_CodeNet_Java250.tar.gz