Problem: There are arrays, each array has positive integer elements The -th element of the -th array is .
Initially, Chaneka's digital wallet contains money. Given an integer . Chaneka will do operations. In the -th operation, Chaneka does the following procedure:
- Choose any array. Let's say Chaneka chooses the -th array.
- Choose an index in that array such that .
- Add the value of to the total money in the wallet.
- Change the value of into .
Determine the maximum total money that can be earned!
Input Format: The first line contains three integers , , and (; ; ) — the number of arrays, the size of each array, and the constant that describes the operation constraints.
The -th of the next lines contains integers () — the elements of the -th array.
Output Format: Output an integer representing the maximum total money that can be earned.
Note: In the first example, the following is a sequence of operations of one optimal strategy:
- Choosing element with a value of .
- Choosing element with a value of .
- Choosing element with a value of .
So the total money earned is .
In the second example, the following is a sequence of operations of one optimal strategy:
- Choosing element with a value of .
- Choosing element with a value of .
So the total money earned is .
In the third example, the following is a sequence of operations of one optimal strategy:
- Choosing element with a value of .
- Choosing element with a value of .
So the total money earned is .