Task: Program Execution
Input (English): 5, 5, ['8119', 'a', 'g', '7339', '4793', '3201', 'X', 'F']
Output (English): 3974