Task: Program Execution
Input (English): 7, 7, ['X', 'M', '3129', 'q', 'w', '8495', '1239']
Output (English): 1239