Task: Program Execution
Input (English): Z, z, q, D, 6141, 6951, 6939, M
Output (English): Z, z, q, D, M, 6141, 6951, 6939