Task: Program Execution
Input (English): q, M, Q
Output (English):