def lscan; gets.split.map(&:to_i); end n = gets.to_i aa, bb = (n-1).times.map{lscan}.transpose a = aa.reduce(:+) b = bb.reduce(:+) a, b = b, a if a > b p a+1