#C8577. Highest Product Rating After Additions

    ID: 52574 Type: Default 1000ms 256MiB

Highest Product Rating After Additions

Highest Product Rating After Additions

You are given n products, each with an initial rating. In addition, you are given q queries. In each query, a number is provided which will be added to every product's rating. Your task is to determine the highest rating among all products after each query.

Formally, let \( M = \max\{a_1, a_2, \dots, a_n\} \) where \(a_i\) represents the initial rating of the \(i\)-th product. For each query with value \( k \), the answer is \( M + k \).

inputFormat

The input is read from stdin and consists of the following lines:

  1. The first line contains a single integer \( n \) denoting the number of products.
  2. The second line contains \( n \) space-separated integers representing the initial ratings of the products.
  3. The third line contains a single integer \( q \) representing the number of queries.
  4. The fourth line contains \( q \) space-separated integers; each integer denotes the additional rating to add for that query.

outputFormat

Output the highest rating after processing each query on stdout. Print all the answers on a single line separated by spaces.

## sample
4
8 5 3 4
3
1 2 3
9 10 11