Task: Program Execution
Input (English): N, 5061, B, b, a, 3115, 7771, 7499, z, 1667, z, E, 8603, N, 7369
Output (English): 41085