The turtle wants to pass the rectangular table as quickly as possible from top left corner to bottom right corner along the route with the least losses.
The first line contains two positive integers and m~(n, m \le 1000) — the size of the table. Each of the next lines contains integers — the description of the table, each cell contains the amount of acid in it (in milliliters).
The turtle can move only one cell down or right.
In the first line, print the turtle's minimum possible damage. In the next lines print the cell coordinates through which the appropriate path passes. Print the coordinates in the order like they appear on the route.

Example 1
Example 2