Task: Program Execution
Input (English): 2355, Q, 8259, M, 1251, 6213
Output (English): 18078