


from itertools import permutations

def 			_a  (				SCREAMING_SNAKE_CASE	:				Union[str, Any]     ):







	"""simple docstring"""



	if num[3] % 2 != 0:
		return False

	if (num[2] + num[3] + num[4]) % 3 != 0:
		return False

	if num[5] % 5 != 0:
		return False

	UpperCamelCase__					:    Tuple          =   [7, 11, 13, 17]
	for i, test in enumerate(__snake_case     ):
		if (num[i + 4] * 100 + num[i + 5] * 10 + num[i + 6]) % test != 0:
			return False
	return True

def 			_a  (				SCREAMING_SNAKE_CASE	:				List[str] = 10     ):







	"""simple docstring"""



	return sum(
	    int(''''''.join(map(__snake_case    , __snake_case     )     )     )
	    for num in permutations(range(__snake_case     )     )
	    if is_substring_divisible(__snake_case     )     )


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






from typing import TYPE_CHECKING

from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available


__UpperCamelCase       :       Optional[int]						       =				{
    "configuration_rag": ["RagConfig"],
    "retrieval_rag": ["RagRetriever"],
    "tokenization_rag": ["RagTokenizer"],
}

try:
       if not is_torch_available():
              raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
       pass
else:
       __UpperCamelCase       :       Optional[int]						       =				[
           "RagModel",
           "RagPreTrainedModel",
           "RagSequenceForGeneration",
           "RagTokenForGeneration",
       ]

try:
       if not is_tf_available():
              raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
       pass
else:
       __UpperCamelCase       :       List[Any]						       =				[
           "TFRagModel",
           "TFRagPreTrainedModel",
           "TFRagSequenceForGeneration",
           "TFRagTokenForGeneration",
       ]


if TYPE_CHECKING:
       from .configuration_rag import RagConfig
       from .retrieval_rag import RagRetriever
       from .tokenization_rag import RagTokenizer

       try:
              if not is_torch_available():
                     raise OptionalDependencyNotAvailable()
       except OptionalDependencyNotAvailable:
              pass
       else:
              from .modeling_rag import RagModel, RagPreTrainedModel, RagSequenceForGeneration, RagTokenForGeneration

       try:
              if not is_tf_available():
                     raise OptionalDependencyNotAvailable()
       except OptionalDependencyNotAvailable:
              pass
       else:
              from .modeling_tf_rag import (
                  TFRagModel,
                  TFRagPreTrainedModel,
                  TFRagSequenceForGeneration,
                  TFRagTokenForGeneration,
              )

else:
       import sys

       __UpperCamelCase       :       List[Any]						       =				_LazyModule(__name__, globals()["__file__"], _import_structure, module_spec=__spec__)


