Task: Program Execution
Input (English): N, 1731, 4955, 5235, 8545, v, s, 565, 7879, 6677, G, v, g, p
Output (English): 35587