Task: Program Execution
Input (English): 2, 7, ['6327', '3077', '4779', '1837', '9783', 'M', '3485', 'M', '8935', 'M', '5601', 'C', '2517', '8883', '9447', 'P']
Output (English): 22961