Task: Program Execution
Input (English): 4, 4, ['2477', 'K', 'M', '3187', '2371', 'K']
Output (English): 7813