Task: Program Execution
Input (English): 847, 9721, N, 1473, q, q, i, I, O
Output (English): 1, 2, 4