You are assigned to put some amount of boxes onto one truck. You are given a 2D array `boxTypes`, where `boxTypes[i] = [numberOfBoxes_i, numberOfUnitsPerBox_i]`:
- `numberOfBoxes_i` is the number of boxes of type `i`.
- `numberOfUnitsPerBox_i` is the number of units in each box of the type `i`.
You are also given an integer `truckSize`, which is the maximum number of boxes that can be put on the truck. You can choose any boxes to put on the truck as long as the number of boxes does not exceed `truckSize`.
Return the maximum total number of units that can be put on the truck.
### Constraints
- `1 <= boxTypes.length <= 1000`
- `1 <= numberOfBoxes_i, numberOfUnitsPerBox_i <= 1000`
- `1 <= truckSize <= 10^6`
### Input Format
- Line 1: Two space-separated integers `n` and `truckSize`.
- Next `n` lines: Two space-separated integers `numberOfBoxes numberOfUnitsPerBox`.
### Output Format
Print the maximum total units.
Sample Cases
Example 1Sample Case
Input: 3 4
1 3
2 2
3 1
Output: 8
Example 2Sample Case
Input: 4 10
5 10
2 5
4 7
3 9
Output: 91
Example 3Sample Case
Input: 3 1
2 2
1 3
3 4
Output: 4
Example 4Sample Case
Input: 3 9
4 7
2 5
5 10
4 10
Output: 78
Constraints
Runtime Limit: 2000 ms per test batch
Memory Limit: 256 MB
Standard I/O stream reading
Official submissions are evaluated against hidden test cases on the server to verify time & memory complexity.