All problems

Building Subplots in a Loop

mediumPythonMatplotlibSubplots

Halewood Reporting builds a regional page where the number of regions changes month to month. Naming each panel by hand means editing the code every time a region opens or closes, so the panels are produced from the list of regions itself and the figure ends up with as many as there are. Each region gets one panel. Underneath, the page names the biggest region by its position on the row.

Task: Print the position of the region whose values add up to the most. Positions are numbered from 0, so the first region on the row is position 0. If two or more regions tie on the highest total, print the position of the earliest of them.

Input

The first line holds an integer k, the number of regions. Each of the next k lines holds that region's values, separated by single spaces. Regions need not hold the same number of values, and every region holds at least one. k is at least 2.

Output

One line holding a whole number: the position of the winning region.

Example:

Input:
3
10 20
5 5 5
100

Output:
2

Sign in to solve this problem

Reading problems is free for everyone — solving them (Run, Submit, and tracking what you've solved) needs an account.

Sign in

Discussion

Sign in to join the discussion — reading is open to everyone.

Loading comments…