#C4190. Magical Nuts Redistribution
Magical Nuts Redistribution
Magical Nuts Redistribution
You are given n trees, where the ith tree initially contains a certain number of magical nuts. In the redistribution process, all the nuts are collected and then redistributed so that each tree ends up with the same number of nuts. Mathematically, if the initial nuts in the trees are \(a_1, a_2, \dots, a_n\), then each tree will receive:
\(S = \sum_{i=1}^{n} a_i\)
Your task is to compute the final number of nuts on each tree.
Example:
Input: 4\n3 1 2 4 Output: 10 10 10 10
inputFormat
The input is given via standard input (stdin) and consists of two lines:
- The first line contains an integer n -- the number of trees.
- The second line contains n space-separated integers \(a_1, a_2, \dots, a_n\) representing the initial number of magical nuts on each tree.
outputFormat
Output via standard output (stdout) a single line containing n space-separated integers. Each integer should be equal to \(S = \sum_{i=1}^{n} a_i\), which is the final number of nuts on each tree.
## sample1
5
5