Task: Program Execution
Input (English): N, 3851, 8715, C, k, K, C, t, 847, T, v, 1805, Q
Output (English): 15218