Task: Program Execution
Input (English): 5, 5, ['B', '3341', '5069', 'M', '3661', 'E', '3151', '2591', 'd', 'z', 'B']
Output (English): 3661