



from __future__ import annotations

__snake_case							 =  {1: 1}


def   _A       (    SCREAMING_SNAKE_CASE__  :     int	):
    if n in COLLATZ_SEQUENCE_LENGTHS:
        return COLLATZ_SEQUENCE_LENGTHS[n]
    UpperCamelCase	:Any     							=       n // 2 if n % 2 == 0 else 3 * n + 1
    UpperCamelCase	:str     							=       collatz_sequence_length(SCREAMING_SNAKE_CASE__	) + 1
    UpperCamelCase	:Optional[Any]     							=       sequence_length
    return sequence_length


def   _A       (    SCREAMING_SNAKE_CASE__  :     int = 1000000	):
    UpperCamelCase	:Optional[Any]     							=       max((collatz_sequence_length(SCREAMING_SNAKE_CASE__	), i) for i in range(1					,  SCREAMING_SNAKE_CASE__	)	)
    return result[1]


if __name__ == "__main__":
 print(solution(int(input().strip())))













def   _A       (    SCREAMING_SNAKE_CASE__  :     int = 998001	):

    # fetches the next number
    for number in range(n - 1					,  9999					,  -1	):
        UpperCamelCase	:Union[str, Any]     							=       str(SCREAMING_SNAKE_CASE__	)

        # checks whether 'str_number' is a palindrome.
        if str_number == str_number[::-1]:
            UpperCamelCase	:Dict     							=       999

            # if 'number' is a product of two 3-digit numbers
            # then number is the answer otherwise fetch next number.
            while divisor != 99:
                if (number % divisor == 0) and (len(str(number // divisor	)	) == 3.0):
                    return number
                divisor -= 1
    raise ValueError('''That number is larger than our acceptable range.'''	)


if __name__ == "__main__":
 print(f'''{solution() = }''')





