Task: Program Execution
Input (English): 5, 5, ['1287', '7983', 'P', '4387', '6817', '89']
Output (English): 7186