Task: Program Execution
Input (English): q, M, l, 5843, 771, 3425, 5865, 2525, 2899, B
Output (English): 1, 2, 3, 10