




import itertools






def 				UpperCAmelCase__  (							_A			):






  """simple docstring"""


  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 				UpperCAmelCase__  (							):






  """simple docstring"""


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


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



def   _lowerCAmelCase(						):

  for a in range(300      ):
    for b in range(a + 1 ,							400      ):
      for c in range(b + 1 ,							500      ):
        if (a + b + c) == 1000 and (a**2) + (b**2) == (c**2):
          return a * b * c

  return -1
def   _lowerCAmelCase(						):

  for a in range(300      ):
    for b in range(400      ):
      UpperCAmelCase          =	1000 - a - b
      if a < b < c and (a**2) + (b**2) == (c**2):
        return a * b * c

  return -1
def   _lowerCAmelCase(						):
  import timeit

  print(
      timeit.timeit("solution()" ,							setup="from __main__ import solution" ,							number=1000      )      )
  print(
      timeit.timeit(
          "solution_fast()" ,							setup="from __main__ import solution_fast" ,							number=1000      )      )


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



