


'''simple docstring'''





import sys

sys.set_int_max_str_digits(0)  # type: ignore


def 					a__    (				UpperCamelCase_	:			int	):
   UpperCAmelCase__  :Optional[int]            =			[0] * 11
   UpperCAmelCase__  :List[Any]            =			[0] * 11

   # mark last 9 numbers
   for _ in range(9	):
      UpperCAmelCase__  :Optional[int]            =			1
      UpperCAmelCase__  :Union[str, Any]            =			number // 10
   # flag
   UpperCAmelCase__  :int            =			True

   # check last 9 numbers for pandigitality

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

   # mark first 9 numbers
   UpperCAmelCase__  :Dict            =			int(str(UpperCamelCase_	)[:9]	)

   for _ in range(9	):
      UpperCAmelCase__  :Dict            =			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 					a__    (				UpperCamelCase_	:			int	):
   UpperCAmelCase__  :Tuple            =			[0] * 11

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

   # check last 9 numbers for pandigitality

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


def 					a__    (				):
   UpperCAmelCase__  :List[str]            =			1
   UpperCAmelCase__  :Optional[Any]            =			1
   UpperCAmelCase__  :Union[str, Any]            =			2
   # temporary Fibonacci numbers

   UpperCAmelCase__  :List[str]            =			1
   UpperCAmelCase__  :str            =			1
   UpperCAmelCase__  :int            =			2
   # temporary Fibonacci numbers mod 1e9

   # mod m=1e9, done for fast optimisation
   UpperCAmelCase__  :str            =			[0] * 1_000_000
   UpperCAmelCase__  :Optional[Any]            =			1_000_000_000

   for x in range(1_000_000	):
      UpperCAmelCase__  :List[str]            =			(aa + ba) % m
      UpperCAmelCase__  :List[Any]            =			ba % m
      UpperCAmelCase__  :str            =			ca % m
      if checka(UpperCamelCase_	):
         UpperCAmelCase__  :int            =			1

   for x in range(1_000_000	):
      UpperCAmelCase__  :Tuple            =			a + b
      UpperCAmelCase__  :List[str]            =			b
      UpperCAmelCase__  :List[str]            =			c
      # perform check only if in tocheck
      if tocheck[x + 3] and check(UpperCamelCase_	):
         return x + 3  # first 2 already done
   return -1


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







'''simple docstring'''





from typing import List, Optional, Tuple, Union

from . import logging
from .import_utils import is_torch_available, is_torch_version


if is_torch_available():
    import torch

__lowerCamelCase       				=	logging.get_logger(__name__)  # pylint: disable=invalid-name

try:
    from torch._dynamo import allow_in_graph as maybe_allow_in_graph
except (ImportError, ModuleNotFoundError):


    def 					a__    (				cls	:			Optional[int]	):
       return cls


def 					a__    (				UpperCamelCase_	:			Union[Tuple, List],      UpperCamelCase_	:			Optional[Union[List["torch.Generator"], "torch.Generator"]] = None,      UpperCamelCase_	:			Optional["torch.device"] = None,      UpperCamelCase_	:			Optional["torch.dtype"] = None,      UpperCamelCase_	:			Optional["torch.layout"] = None,      ):
   UpperCAmelCase__  :Union[str, Any]            =			device
   UpperCAmelCase__  :List[Any]            =			shape[0]

   UpperCAmelCase__  :Tuple            =			layout or torch.strided
   UpperCAmelCase__  :Union[str, Any]            =			device or torch.device('''cpu'''	)

   if generator is not None:
      UpperCAmelCase__  :str            =			generator.device.type if not isinstance(UpperCamelCase_,      UpperCamelCase_	) else generator[0].device.type
      if gen_device_type != device.type and gen_device_type == "cpu":
         UpperCAmelCase__  :Tuple            =			'''cpu'''
         if device != "mps":
            logger.info(
                F'''The passed generator was created on \'cpu\' even though a tensor on {device} was expected.'''
                F''' Tensors will be created on \'cpu\' and then moved to {device}. Note that one can probably'''
                F''' slighly speed up this function by passing a generator that was created on the {device} device.'''	)
      elif gen_device_type != device.type and gen_device_type == "cuda":
         raise ValueError(F'''Cannot generate a {device} tensor from a generator of type {gen_device_type}.'''	)

   if isinstance(UpperCamelCase_,      UpperCamelCase_	):
      UpperCAmelCase__  :List[str]            =			(1,) + shape[1:]
      UpperCAmelCase__  :Optional[int]            =			[
          torch.randn(UpperCamelCase_,      generator=generator[i],      device=UpperCamelCase_,      dtype=UpperCamelCase_,      layout=UpperCamelCase_	)
          for i in range(UpperCamelCase_	)
      ]
      UpperCAmelCase__  :int            =			torch.cat(UpperCamelCase_,      dim=0	).to(UpperCamelCase_	)
   else:
      UpperCAmelCase__  :Optional[int]            =			torch.randn(UpperCamelCase_,      generator=UpperCamelCase_,      device=UpperCamelCase_,      dtype=UpperCamelCase_,      layout=UpperCamelCase_	).to(UpperCamelCase_	)

   return latents


def 					a__    (				UpperCamelCase_	:			Dict	):
   if is_torch_version('''<''',      '''2.0.0'''	) or not hasattr(UpperCamelCase_,      '''_dynamo'''	):
      return False
   return isinstance(UpperCamelCase_,      torch._dynamo.eval_frame.OptimizedModule	)



