ku, ro = gets.chomp.map(&:to_i) ba, u = gets.chomp.map(&:to_i) puts (ku+ro+ba + u) / 2