Task: Program Execution
Input (English): 3, 3, ['417', 'g', '7495', 'N', '1753', 'w', 'p', '1007']
Output (English): 5947