X, Y = gets.split.map(&:to_i).minmax if 4 <= X puts X - 4 elsif 8 <= Y puts Y - 4 else puts Y + 4 end