#C2621. Calculate Final Scores

    ID: 45958 Type: Default 1000ms 256MiB

Calculate Final Scores

Calculate Final Scores

You are given n players each with an initial score. In addition, there are m rounds, and during each round, the points for each player are modified. Your task is to compute the final score for each player after applying all the rounds of modifications.

The final score \(S_i\) for the \(i^{th}\) player is computed as follows:

\(S_i = \text{initial}_i + \sum_{j=1}^{m} d_{ij}\)

where \(\text{initial}_i\) is the initial score of the \(i^{th}\) player and \(d_{ij}\) is the change in points for the \(i^{th}\) player in the \(j^{th}\) round.

inputFormat

The input is read from standard input (stdin) and has the following format:

  • The first line contains an integer n representing the number of players.
  • The second line contains n space-separated integers representing the initial scores of each player.
  • The third line contains an integer m representing the number of rounds.
  • The next m lines each contain n space-separated integers representing the score changes for each player during that round.

outputFormat

The output should be printed to standard output (stdout) as a single line containing n space-separated integers representing the final scores of each player after all rounds.

## sample
3
10 15 20
2
5 -3 2
-1 4 -5
14 16 17