You are checking out a shopping cart and need to calculate the total cost. You will be given a list of items, where each item has a quantity (number of units) and a price per unit. Your task is to compute the sum of the costs for all items in the cart. For each item, the cost is calculated as quantity × price. Use a for loop to process the items and output the total amount.
Input
The first line of the input consists of a line with an integer, $n$, the number of different items in the cart.
The next $n$ lines each contains two integers:
- quantity $q_i$: the number of units of the item
- price $p_i$: the price per unit of the item
Output
Output an integer, the total cost of the items.
Constraints
$1 \le n \le 100$, $1 \le q_i \le 100$, $1 \le p_i \le 1000$
Sample Test Cases
Input | Output | |
---|---|---|
3 2 10 1 25 4 5 |
65 | |
|
Scoring: Per Case
Authored by hclee and s17f18
Appeared in 2025 Mini Comp 0