Task: Program Execution
Input (English): n, r, 8269, 4247, K
Output (English): 12516