Task: Program Execution
Input (English): 3, 12, ['2989', '8731', 'J', '3727', 'K', 'a', 't', 'p', 'q', '9199', '3947', 'U', 'M', '1445', '8943', 'V', '7711']
Output (English): 16873