Task: Program Execution
Input (English): 347, 161, q
Output (English): 1, 3, 4, 6, 7