Task: Program Execution
Input (English): N, 6341, N, 8651, 1005, f, K, M, l, S, 1307, d
Output (English): 17304