Task: Program Execution
Input (English): 5, 5, ['d', 'L', 'c', 'P', '3389', 'O', 'h', 'P', '5781', '7231']
Output (English): 3389