a, b, c = read_line.split.map(&.to_i).sort puts("INF") + exit if a.gcd(b).gcd(c) != 1 dp = [false] * (b * c) dp[0] = true (0...dp.size).each do |i| if dp[i] {a, b, c}.each do |x| dp[i + x] = true if i + x < b*c end end end puts dp.count(false)