x,y = gets.split.map(&:to_i) x2,y2 = gets.split.map(&:to_i) if x == y && x2 == y2 && x > x2 p x + 1 else p [x,y].max end