Task: Program Execution
Input (English): N, P, 1139, 4179, 4105, 4161, u, a, 9137
Output (English): 22721