Task: Program Execution
Input (English): M, Q, F, 629, D
Output (English): 629