Task: Program Execution
Input (English): 6809, 8397, 6561, 1827, 7489, Q, 7583, 6899
Output (English): 6