Task: Program Execution
Input (English): q, N, y, 7859, u, 2861, 4151, Q, x
Output (English): 14871