b = gets.chomp.split.map(&:to_i) g = b[0] - b[1] v = b[1] - b[2] r = v.to_f / g.to_f d = b[0] * r - b[1] puts ([2] * r - d).to_i