H. Huge Subsets
time limit per test
2 seconds
memory limit per test
1024 megabytes
input
standard input
output
standard output
Example
Input
3
4
1 2 3 4
1
1000000000000000000
3
6 6 6
Output
1 1 1 10
1000000000000000000
6 12 18