Task: Program Execution
Input (English): n, Q, b, 5099, J
Output (English): 5099