Task: Program Execution
Input (English): Q, n, Q, p, 1685
Output (English): 1685