Task: Program Execution
Input (English): z, Q, 1605, 9715
Output (English): 2