Task: Program Execution
Input (English): 3, 3, ['X', 'f', '505', '7217']
Output (English): 505