Task: Program Execution
Input (English): 9541, K, N, K, R, n, W
Output (English): 6