I - Inverse Harmony

Languages: C, C++, Java, Python, Kotlin
Time & Memory limits: (details)

Input

Output

Sample test(s)

Input
4 2 10 2 5 1 7 6 3 9 9 6 2 8 5 9 9 8 1 8 5 9 4
--- Showing first 30 lines (click "Copy" to get full content) ---
Output
658563983 460728163 254182590 983686623
--- Showing first 30 lines (click "Copy" to get full content) ---