Coin Collecting
In the coin collectors' club, there are n members. The club is currently hosting a contest to see who can be the first to assemble a complete collection of 19th-century coins. According to the club's rules, this collection must include m different types of coins. While members can have multiple coins of each type, they must have at least one of each type.
Vasya is determined to approach this challenge strategically and wants to devise the best coin exchange plan. He knows that any collector will willingly trade one of their coins of type a for one of Vasya's coins of type b, but only if the collector has more than one coin of type a and does not yet possess any coins of type b. Collectors are not open to any other types of exchanges. However, Vasya, unlike the others, is focused on overall optimization rather than immediate gains, and he can choose to ignore this rule if it benefits him.
Vasya aims to use these exchanges to gather as many different types of coins as possible, making it easier for him to win the contest in the future. Help him determine the optimal coin exchange strategy!
Input
The first line of the input file contains two integers n and m (1 ≤ m, n ≤ 100). The following n lines each contain m integers: the j-th integer on the i-th line represents the number of coins of the j-th type that the i-th collector possesses. All these integers are non-negative and do not exceed 1000. Vasya is identified as collector number 1.
Output
On the first line of the output file, print the maximum number of different types of coins that can be collected. Then, print any sequence of exchanges that leads to achieving that number of different types. Each exchange should be printed in the format x_i, u_i, v_i, where x_i is the number of the collector Vasya exchanges with, u_i is the type of coin Vasya receives, and v_i is the type of coin Vasya gives.