Task: Program Execution
Input (English): q, 297, d, p, 429, 141
Output (English): 1, 2, 4, 7, 9