'''simple docstring'''




import importlib.metadata
import subprocess
import sys







def 			A_   ( _lowerCamelCase			:							bool = False    ):
      _lowerCAmelCase		   =   False
      if "IPython" in sys.modules:
            _lowerCAmelCase		   =   'google.colab' in str(sys.modules['IPython'].get_ipython()    )

      if in_colab:
            if upgrade:
                  _lowerCAmelCase		   =   ['pip', 'install', '-U', 'torch']
                  subprocess.run(_lowerCamelCase  ,  check=_lowerCamelCase    )
            # get the current version of torch
            _lowerCAmelCase		   =   importlib.metadata.version('torch'    )
            _lowerCAmelCase		   =   torch_version[: torch_version.rindex('.'    )]
            _lowerCAmelCase		   =   F"https://storage.googleapis.com/tpu-pytorch/wheels/colab/torch_xla-{torch_version_trunc}-cp37-cp37m-linux_x86_64.whl"
            _lowerCAmelCase		   =   ['pip', 'install', xla_wheel]
            subprocess.run(_lowerCamelCase  ,  check=_lowerCamelCase    )
      else:
            raise RuntimeError('`install_xla` utility works only on google colab.'    )






'''simple docstring'''




import itertools







def 			A_   ( _lowerCamelCase			:							Tuple    ):
      return (
          int(''.join(combination[0:2]    )    ) * int(''.join(combination[2:5]    )    )
          == int(''.join(combination[5:9]    )    )
      ) or (
          int(''.join(combination[0]    )    ) * int(''.join(combination[1:5]    )    )
          == int(''.join(combination[5:9]    )    )
      )







def 			A_   ( ):
      return sum(
          {
              int(''.join(pandigital[5:9]    )    )
              for pandigital in itertools.permutations('123456789'    )
              if is_combination_valid(_lowerCamelCase    )
          }    )


if __name__ == "__main__":
 print(solution())





