Task: Program Execution
Input (English): W, 2861, q, D, d, Q, 4495, r, W, W, 7417
Output (English): 14773