#K71282. Character Stats Calculation

    ID: 33497 Type: Default 1000ms 256MiB

Character Stats Calculation

Character Stats Calculation

In many role-playing games, a character's attributes such as Strength, Agility, and Intelligence change according to events encountered during the game. Initially, the character starts with given points for each attribute. Then, a series of events occurs, each event specifying an attribute along with a change (positive or negative). Your task is to compute the final attribute points after all events have been applied.

For clarity, the final attribute values are computed as follows:
$$ Strength_{final} = S + \sum_{\text{event with attribute "Strength"}} \text{value} $$
$$ Agility_{final} = A + \sum_{\text{event with attribute "Agility"}} \text{value} $$
$$ Intelligence_{final} = I + \sum_{\text{event with attribute "Intelligence"}} \text{value} $$

Read the input from standard input (stdin) and write the output to standard output (stdout).

inputFormat

The input is given in the following format:
1. The first line contains three space-separated integers: S, A, and I, representing the initial points for Strength, Agility, and Intelligence respectively.
2. The second line contains an integer N, the number of events.
3. The next N lines each contain an event: an attribute name (which is one of 'Strength', 'Agility', 'Intelligence') followed by an integer value which could be positive or negative.

outputFormat

Output a single line containing three integers separated by spaces: the final points for Strength, Agility, and Intelligence, in that order.## sample

10 15 20
3
Strength 5
Agility 5
Intelligence 10
15 20 30

</p>