Task: Program Execution
Input (English): N, P, w, A, 1925, 4699, 4907, a, 711, 2261, J
Output (English): 14503