import Foundation //最大公約数を求める関数 func gcd(_ num1: Int, _ num2: Int) -> Int { let r = num1 % num2 if r != 0 { return gcd(num2, r) } else { return num2 } } //3つ以上の数の最大公約数を求める func gcdArr(_ numArr: [Int]) -> Int { var ans: Int = numArr[0] for i in numArr { ans = gcd(ans, i) } return ans } //最小公倍数を求める関数 func lcm(_ num1: Int, _ num2: Int) -> Int { var gcdNum = gcd(num1, num2) return num1*num2/gcdNum } //3つ以上の最大公約数を求める func lcmArr(_ numArr: [Int]) -> Int { var ans: Int = 1 for i in numArr { ans = lcm(ans, i) } return ans } let ri = Int(readLine()!)! let ra = readLine()!.split(separator: " ").map({Int($0)!}) print(gcd(ra[0]+ra[1],ra[0]*ra[1]))