a = gets.chomp.split(" ") hatena = a.index("?") res = "" [1,4].each do |i| a[hatena] = i a.map!(&:to_i) res += i.to_s if a.min == a[1] or a.max == a[1] end puts res