Task: Program Execution
Input (English): 5207, n, M, 747, s
Output (English): 5954