x, y = gets.chomp.split(' ') x = x.to_i y = y.to_i x2, y2 = gets.chomp.split(' ') x2 = x2.to_i y2 = y2.to_i #p x, y, x2,y2 if x2 == y2 && x > x2 && y > y2 if x > y step = x elsif x < y step = y else step = x + 1 end else step = [x, y].max end puts step