Task: Program Execution
Input (English): n, j, 5787, T, 3587, B, m, t
Output (English): 9374