Task: Program Execution
Input (English): 2, 10, ['w', '5871', 'd', '9897', '4963', '35', '2795', '351', '513', '5167', '1109', '8509', 'T', '4419']
Output (English): 29592