Task: Program Execution
Input (English): 4, 4, ['w', 'X', 'S', 'O', '8739', '6285', '6507']
Output (English): 0