#C9205. Stock Quantity Adjustment

    ID: 53273 Type: Default 1000ms 256MiB

Stock Quantity Adjustment

Stock Quantity Adjustment

You are given n items with initial stock quantities and m adjustments. Each adjustment specifies an item index (1-based) and a quantity change. Your task is to update the stock quantities accordingly.

The mathematical formulation of the problem is as follows:

Let \( S = [s_1, s_2, \ldots, s_n] \) be the initial stock quantities. For each adjustment \( (i, d) \) (where \( 1 \leq i \leq n \)), update the corresponding stock as

\[ s_i = s_i + d \]

Print the final stock quantities as a sequence of integers separated by spaces.

inputFormat

The input is given via standard input (stdin) and follows the structure below:

  1. The first line contains an integer \( n \) (the number of items).
  2. The second line contains \( n \) space-separated integers representing the initial stock quantities.
  3. The third line contains an integer \( m \) (the number of adjustments).
  4. The following \( m \) lines each contain two space-separated integers: the first is the 1-based index of the item, and the second is the adjustment value.

outputFormat

Output a single line to standard output (stdout) containing \( n \) space-separated integers representing the final stock quantities after all adjustments have been applied.

## sample
3
100 200 300
1
2 50
100 250 300

</p>