B - Bespoke Shuffle

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

Input

Output

Sample test(s)

Input
3 6 4 12
--- Showing first 30 lines (click "Copy" to get full content) ---
Output
5 2 S 1 W 1 3 4 1 S 1 7 2 S 1 W 1 5
--- Showing first 30 lines (click "Copy" to get full content) ---