A, B, C = gets.split.map(&:to_i).sort if [A, B, C].inject(&:gcd) != 1 puts 'INF' exit end LIM = 5 * 10 ** 6 + 1 dp = Array.new(LIM, false) dp[0] = true [A, B, C].each do |x| x.upto(LIM) do |y| next if !dp[y - x] dp[y] = true end end puts dp.count(false)