



'''simple docstring'''






import sys

sys.set_int_max_str_digits(0)  # type: ignore




def        snake_case_   (	lowerCAmelCase_						)->						bool:





       '''simple docstring'''


       _UpperCAmelCase    :		Any     	=					[0] * 11
       _UpperCAmelCase    :		List[Any]     	=					[0] * 11

       # mark last 9 numbers
       for _ in range(9						):
              _UpperCAmelCase    :		Optional[Any]     	=					1
              _UpperCAmelCase    :		List[Any]     	=					number // 10
       # flag
       _UpperCAmelCase    :		Optional[Any]     	=					True

       # check last 9 numbers for pandigitality

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

       # mark first 9 numbers
       _UpperCAmelCase    :		Tuple     	=					int(str(lowerCAmelCase_						)[:9]						)

       for _ in range(9						):
              _UpperCAmelCase    :		Any     	=					1
              _UpperCAmelCase    :		Tuple     	=					number // 10

       # check first 9 numbers for pandigitality

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




def        snake_case_   (	lowerCAmelCase_						)->						bool:





       '''simple docstring'''


       _UpperCAmelCase    :		Optional[int]     	=					[0] * 11

       # mark last 9 numbers
       for _ in range(9						):
              _UpperCAmelCase    :		Tuple     	=					1
              _UpperCAmelCase    :		Optional[int]     	=					number // 10
       # flag
       _UpperCAmelCase    :		List[Any]     	=					True

       # check last 9 numbers for pandigitality

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




def        snake_case_   (	)->						int:





       '''simple docstring'''


       _UpperCAmelCase    :		Optional[int]     	=					1
       _UpperCAmelCase    :		Optional[int]     	=					1
       _UpperCAmelCase    :		Optional[Any]     	=					2
       # temporary Fibonacci numbers

       _UpperCAmelCase    :		Union[str, Any]     	=					1
       _UpperCAmelCase    :		Any     	=					1
       _UpperCAmelCase    :		int     	=					2
       # temporary Fibonacci numbers mod 1e9

       # mod m=1e9, done for fast optimisation
       _UpperCAmelCase    :		Optional[int]     	=					[0] * 1000000
       _UpperCAmelCase    :		Optional[Any]     	=					1000000000

       for x in range(1000000						):
              _UpperCAmelCase    :		List[Any]     	=					(aa + ba) % m
              _UpperCAmelCase    :		Tuple     	=					ba % m
              _UpperCAmelCase    :		Union[str, Any]     	=					ca % m
              if checka(lowerCAmelCase_						):
                     _UpperCAmelCase    :		List[str]     	=					1

       for x in range(1000000						):
              _UpperCAmelCase    :		Optional[Any]     	=					a + b
              _UpperCAmelCase    :		Tuple     	=					b
              _UpperCAmelCase    :		str     	=					c
              # perform check only if in tocheck
              if tocheck[x + 3] and check(lowerCAmelCase_						):
                     return x + 3  # first 2 already done
       return -1


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








'''simple docstring'''






import qiskit
from qiskit.providers import Backend




def        snake_case_   (	lowerCAmelCase_			,  lowerCAmelCase_						)->						tuple[qiskit.QuantumCircuit, str, str]:





       '''simple docstring'''


       _UpperCAmelCase	,_UpperCAmelCase    :		Optional[Any]     	=					bin(lowerCAmelCase_						)[2:], bin(lowerCAmelCase_						)[2:]  # Remove leading '0b'

       # Ensure that both strings are of the same length
       if len(lowerCAmelCase_						) > len(lowerCAmelCase_						):
              _UpperCAmelCase    :		str     	=					y.zfill(len(lowerCAmelCase_						)						)
       else:
              _UpperCAmelCase    :		int     	=					x.zfill(len(lowerCAmelCase_						)						)

       # We need (3 * number of bits in the larger number)+1 qBits
       # The second parameter is the number of classical registers, to measure the result
       _UpperCAmelCase    :		Any     	=					qiskit.QuantumCircuit((len(lowerCAmelCase_						) * 3) + 1			,  len(lowerCAmelCase_						) + 1						)

       # We are essentially "not-ing" the bits that are 1
       # Reversed because it's easier to perform ops on more significant bits
       for i in range(len(lowerCAmelCase_						)						):
              if x[::-1][i] == "1":
                     circuit.x(lowerCAmelCase_						)
       for j in range(len(lowerCAmelCase_						)						):
              if y[::-1][j] == "1":
                     circuit.x(len(lowerCAmelCase_						) + j						)

       return circuit, x, y




def        snake_case_   (	lowerCAmelCase_			,  lowerCAmelCase_			,  lowerCAmelCase_			,  lowerCAmelCase_			,  lowerCAmelCase_			,  )->						Dict:





       '''simple docstring'''


       circuit.ccx(lowerCAmelCase_			,  lowerCAmelCase_			,  lowerCAmelCase_						)
       circuit.cx(lowerCAmelCase_			,  lowerCAmelCase_						)
       circuit.ccx(lowerCAmelCase_			,  lowerCAmelCase_			,  lowerCAmelCase_						)
       circuit.cx(lowerCAmelCase_			,  lowerCAmelCase_						)
       circuit.cx(lowerCAmelCase_			,  lowerCAmelCase_						)




def        snake_case_   (	lowerCAmelCase_			,  lowerCAmelCase_			,  lowerCAmelCase_ = qiskit.Aer.get_backend("""aer_simulator"""						)			,  )->						int:





       '''simple docstring'''


       if vala < 0 or vala < 0:
              raise ValueError("""Both Integers must be positive!"""						)

       # Store the Integers
       _UpperCAmelCase	,_UpperCAmelCase	,_UpperCAmelCase    :		Union[str, Any]     	=					store_two_classics(lowerCAmelCase_			,  lowerCAmelCase_						)
       for i in range(len(lowerCAmelCase_						)						):
              full_adder(lowerCAmelCase_			,  lowerCAmelCase_			,  len(lowerCAmelCase_						) + i			,  len(lowerCAmelCase_						) + len(lowerCAmelCase_						) + i			,  len(lowerCAmelCase_						) + len(lowerCAmelCase_						) + i + 1						)
              circuit.barrier()  # Optional, just for aesthetics

       # Measure the resultant qBits
       for i in range(len(lowerCAmelCase_						) + 1						):
              circuit.measure([(len(lowerCAmelCase_						) * 2) + i]			,  [i]						)

       _UpperCAmelCase    :		Optional[int]     	=					qiskit.execute(lowerCAmelCase_			,  lowerCAmelCase_			,  shots=1						).result()

       # The result is in binary. Convert it back to int
       return int(list(res.get_counts()						)[0]			,  2						)


if __name__ == "__main__":
   import doctest

   doctest.testmod()



