Author: | N. Grebenyuk | Time limit: | 2 sec | |
Input file: | Standard input | Memory limit: | 256 Mb | |
Output file: | Standard output |
Aleksey lost his favourite array a! He remembers that the array consisted of n non-negative integers, and its sum was equal to sum.
Recently Aleksey found his calculations on this array. His calculations consist of n numbers bi such that
bi=(ai+ai+1)modk for 1≤i<n
bn=(an+a1)modk (ai — favourite array numbers)
Help Aleksey to find any correct favourite array a corresponding to the array b, or tell him that he has made a mistake, and there is no such array. Notice, that all elements of source array are non-negative integers that are not greater than 104.
The first line contains three integers n, k, sum.
The next line contains n non-negative integers bi.
If the answer exists, print "YES" in the first line and n space separated numbers of array a in the second line. If there are multiple answers, print any of them.
Print "NO" if there is no such array.
2≤n,k≤104
0≤sum≤109
0≤ai≤104
0≤bi<k
No. | Standard input | Standard output |
---|---|---|
1 |
|
|
2 |
|
|
3 |
|
|