Task: Program Execution
Input (English): 7321, S, p, q, i, 887, 9699, 9467, T, i, T, 9031, 3585, J, Q
Output (English): 39990