import java.util.*; import java.math.BigDecimal; public class SumMultiply { public static void main(String[] args) { Scanner sc = new Scanner(System.in); BigDecimal a = new BigDecimal(sc.next()); BigDecimal b = new BigDecimal(sc.next()); if (a.compareTo(b) == -1){ System.out.println(gcd(b,a)); }else{ System.out.println(gcd(a,b)); } } public static long gcd(BigDecimal bigNum, BigDecimal smallNum) { BigDecimal remainder = bigNum.remainder(smallNum); if (remainder.compareTo(new BigDecimal(0)) == 0){ return smallNum.longValue(); } return gcd(smallNum, remainder); } }