



'''simple docstring'''



from __future__ import annotations


def 							__UpperCAmelCase				(				UpperCamelCase__				:int			)		->						list[int]:
				snake_case__      :   Any      =    [0] * max_one

				for i in range(0   ,				UpperCamelCase__			):
								snake_case__      :   str      =    i

				for i in range(2   ,				UpperCamelCase__			):
								if totients[i] == i:
												for j in range(UpperCamelCase__   ,				UpperCamelCase__   ,				UpperCamelCase__			):
																totients[j] -= totients[j] // i

				return totients


def 							__UpperCAmelCase				(				UpperCamelCase__				:int   ,				UpperCamelCase__				:int			)		->						bool:
				return sorted(str(UpperCamelCase__			)			) == sorted(str(UpperCamelCase__			)			)


def 							__UpperCAmelCase				(				UpperCamelCase__				:int = 1000_0000			)		->						int:
				snake_case__      :   int      =    1  # i
				snake_case__      :   List[Any]      =    0  # φ(i)
				snake_case__      :   List[str]      =    get_totients(max_n + 1			)

				for i in range(2   ,				max_n + 1			):
								snake_case__      :   Optional[int]      =    totients[i]

								if i * min_denominator < min_numerator * t and has_same_digits(UpperCamelCase__   ,				UpperCamelCase__			):
												snake_case__      :   List[Any]      =    i
												snake_case__      :   Optional[int]      =    t

				return min_numerator


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






import sys

sys.set_int_max_str_digits(0)  # type: ignore





def        lowerCAmelCase       (				snake_case__   :      int )->			bool:
    A_								=					[0] * 11
    A_								=					[0] * 11

    # mark last 9 numbers
    for _ in range(9 ):
        A_								=					1
        A_								=					number // 10
    # flag
    A_								=					True

    # check last 9 numbers for pandigitality

    for x in range(9 ):
        if not check_last[x + 1]:
            A_								=					False
    if not f:
        return f

    # mark first 9 numbers
    A_								=					int(str(snake_case__ )[:9] )

    for _ in range(9 ):
        A_								=					1
        A_								=					number // 10

    # check first 9 numbers for pandigitality

    for x in range(9 ):
        if not check_front[x + 1]:
            A_								=					False
    return f





def        lowerCAmelCase       (				snake_case__   :      int )->			bool:
    A_								=					[0] * 11

    # mark last 9 numbers
    for _ in range(9 ):
        A_								=					1
        A_								=					number // 10
    # flag
    A_								=					True

    # check last 9 numbers for pandigitality

    for x in range(9 ):
        if not check_last[x + 1]:
            A_								=					False
    return f





def        lowerCAmelCase       (				)->			int:
    A_								=					1
    A_								=					1
    A_								=					2
    # temporary Fibonacci numbers

    A_								=					1
    A_								=					1
    A_								=					2
    # temporary Fibonacci numbers mod 1e9

    # mod m=1e9, done for fast optimisation
    A_								=					[0] * 1000000
    A_								=					1000000000

    for x in range(1000000 ):
        A_								=					(aa + ba) % m
        A_								=					ba % m
        A_								=					ca % m
        if checka(snake_case__ ):
            A_								=					1

    for x in range(1000000 ):
        A_								=					a + b
        A_								=					b
        A_								=					c
        # perform check only if in tocheck
        if tocheck[x + 3] and check(snake_case__ ):
            return x + 3  # first 2 already done
    return -1


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






