#C9536. Total Weight of Numeric Parcels

    ID: 53640 Type: Default 1000ms 256MiB

Total Weight of Numeric Parcels

Total Weight of Numeric Parcels

You are given a list of parcels, each represented by a unique identifier and its corresponding weight. Your task is to compute the total weight of the parcels whose identifiers consist only of digits. In other words, if an identifier contains any non-digit characters, its weight should not be included.

The problem can be formalized as follows:

$$\text{Result} = \sum_{i=1}^{n} w_i \times \mathbb{I}(\text{identifier}_i \text{ is numeric}) $$

where (w_i) represents the weight of the (i^{th}) parcel, and (\mathbb{I}(\cdot)) is the indicator function that equals 1 if the condition is true and 0 otherwise.

inputFormat

The first line contains a single integer (n) --- the number of parcels. Each of the following (n) lines contains a string and an integer separated by a space. The string represents the parcel's identifier and the integer represents its weight.

outputFormat

Output a single integer --- the total weight of all parcels whose identifier is numeric, i.e. consists only of digits.## sample

3
123 10
456 30
00090 100
140

</p>