
"""simple docstring"""




def   __magic_name__     (				__snake_case    :	int  )			->    bool:
       lowercase   :    List[Any]			=							9

       while num > 0:
              if num % 10 != digit:
                     return False
              num //= 100
              digit -= 1

       return True


def   __magic_name__     (				)			->    int:
       lowercase   :    Optional[int]			=							1_3890_2663

       while not is_square_form(num * num  ):
              if num % 10 == 3:
                     num -= 6  # (3 - 6) % 10 = 7
              else:
                     num -= 4  # (7 - 4) % 10 = 3

       return num * 10


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




"""simple docstring"""




from __future__ import annotations

_A      :	List[str]       		=	"""Alexander Joslin"""


def   __magic_name__     (				__snake_case    :	int  )			->    int:

       if number <= 0:
              lowercase   :    Optional[Any]			=							f"""n must be greater than 0. Got n = {number}"""
              raise ValueError(__snake_case  )

       lowercase   :    List[str]			=							[number + 1] * (number + 1)

       # starting position
       lowercase   :    Optional[Any]			=							0
       for i in range(1					,			__snake_case  ):
              lowercase   :    str			=							min(table[i + 1]					,			table[i] + 1  )
              # check if out of bounds
              if i * 2 <= number:
                     lowercase   :    int			=							min(table[i * 2]					,			table[i] + 1  )
              # check if out of bounds
              if i * 3 <= number:
                     lowercase   :    Optional[int]			=							min(table[i * 3]					,			table[i] + 1  )
       return table[number]


if __name__ == "__main__":
   import doctest

   doctest.testmod()


