Task: Program Execution
Input (English): g, 4391, n, m, J, D, q
Output (English): 4391