score_a = Array.new(4)
score_b = Array.new(4)
score_a = gets.split(nil)
sum_a = score_a[0].to_i + score_a[1].to_i + score_a[2].to_i + score_a[3].to_i
score_b = gets.split(nil)
sum_b = score_b[0].to_i + score_b[1].to_i + score_b[2].to_i + score_b[3].to_i
if sum_a <= sum_b
	puts sum_b
else
	puts sum_a
end