Task: Program Execution
Input (English): 3, 3, ['O', '1417', '7977', 'O', '3381']
Output (English): 7797