Task: Program Execution
Input (English): S, q, n, 8817, q, 3907, c, 943, 3925, 9901
Output (English): 27493