




import dataclasses
import enum
import functools
import math
import re

# The following script is adapted from the script of TaPas.
# Original: https://github.com/google-research/tapas/master/wikisql_utils.py
from typing import Any, List, Text


_lowerCamelCase    				=		'none'
_lowerCamelCase    				=		'none'




def       SCREAMING_SNAKE_CASE			( __UpperCamelCase    :		str ,  __UpperCamelCase    :		Any   )						->							Any:
    UpperCAmelCase_											=  value.split(__UpperCamelCase   )
    return len(__UpperCamelCase   ) > 1 and any((len(__UpperCamelCase   ) == 3 for x in split)   )




def       SCREAMING_SNAKE_CASE			( __UpperCamelCase    :		str   )						->							str:
    if isinstance(__UpperCamelCase ,  __UpperCamelCase   ):
        return value
    if isinstance(__UpperCamelCase ,  __UpperCamelCase   ):
        return float(__UpperCamelCase   )
    if not isinstance(__UpperCamelCase ,  __UpperCamelCase   ):
        raise ValueError('''Argument value is not a string. Can\'t parse it as float'''   )
    UpperCAmelCase_											=  value

    try:
        # Example: 1,000.7
        if "." in sanitized and "," in sanitized:
            return float(sanitized.replace(''',''' ,  ''''''   )   )
        # 1,000
        if "," in sanitized and _split_thousands(''',''' ,  __UpperCamelCase   ):
            return float(sanitized.replace(''',''' ,  ''''''   )   )
        # 5,5556
        if "," in sanitized and sanitized.count(''','''   ) == 1 and not _split_thousands(''',''' ,  __UpperCamelCase   ):
            return float(sanitized.replace(''',''' ,  '''.'''   )   )
        # 0.0.0.1
        if sanitized.count('''.'''   ) > 1:
            return float(sanitized.replace('''.''' ,  ''''''   )   )
        # 0,0,0,1
        if sanitized.count(''','''   ) > 1:
            return float(sanitized.replace(''',''' ,  ''''''   )   )
        return float(__UpperCamelCase   )
    except ValueError:
        # Avoid adding the sanitized value in the error message.
        raise ValueError('''Unable to convert value to float'''   )




def       SCREAMING_SNAKE_CASE			( __UpperCamelCase    :		Any   )						->							Any:
    if answer is None:
        return None
    try:
        UpperCAmelCase_											=  convert_to_float(__UpperCamelCase   )
        if isinstance(__UpperCamelCase ,  __UpperCamelCase   ) and math.isnan(__UpperCamelCase   ):
            return None
        return value
    except ValueError:
        return answer.lower()


_lowerCamelCase    				=		{
    'text': lambda x: x,
    'real': convert_to_float,
}



class     a  (     enum.Enum    ):

     '''simple docstring'''





     lowerCAmelCase       : Union[str, Any]     	=						0
     lowerCAmelCase       : Tuple     	=						1
     lowerCAmelCase       : Optional[int]     	=						2
     lowerCAmelCase       : Any     	=						3
     lowerCAmelCase       : Tuple     	=						4
     lowerCAmelCase       : Dict     	=						5



class     a  (     enum.Enum    ):

     '''simple docstring'''





     lowerCAmelCase       : Dict     	=						0
     lowerCAmelCase       : str     	=						1
     lowerCAmelCase       : List[str]     	=						2



@dataclasses.dataclass
class     a  :

     '''simple docstring'''





     lowerCAmelCase       : Text
     lowerCAmelCase       : _Operator
     lowerCAmelCase       : Any


_lowerCamelCase    				=		re.compile(r'\w+|[^\w\s]+', re.UNICODE | re.MULTILINE | re.DOTALL)




def       SCREAMING_SNAKE_CASE			( __UpperCamelCase    :		int   )						->							Dict:
    return list(_TOKENIZER.findall(x.lower()   )   )




def       SCREAMING_SNAKE_CASE			( __UpperCamelCase    :		str ,  __UpperCamelCase    :		Optional[int] ,  __UpperCamelCase    :		Optional[Any]   )						->							int:
    if operator == _Operator.EQUALS:
        return src == tgt
    elif operator == _Operator.GREATER:
        return src > tgt
    elif operator == _Operator.LESSER:
        return src < tgt
    raise ValueError(f'Unknown operator: {operator}'   )




def       SCREAMING_SNAKE_CASE			( __UpperCamelCase    :		int ,  __UpperCamelCase    :		Optional[Any] ,  __UpperCamelCase    :		List[Any]   )						->							Union[str, Any]:
    UpperCAmelCase_											=  table['''types''']
    return _TYPE_CONVERTER[types[column]](__UpperCamelCase   )




def       SCREAMING_SNAKE_CASE			( __UpperCamelCase    :		Any   )						->							str:
    return isinstance(__UpperCamelCase ,  __UpperCamelCase   )




def       SCREAMING_SNAKE_CASE			( __UpperCamelCase    :		str ,  __UpperCamelCase    :		Optional[Any] ,  __UpperCamelCase    :		Optional[int]   )						->							Dict:
    for cond in conditions:
        UpperCAmelCase_											=  row[cond.column]

        UpperCAmelCase_											=  _parse_value(__UpperCamelCase ,  cond.column ,  cond.cmp_value   )

        if _is_string(__UpperCamelCase   ) and _is_string(__UpperCamelCase   ):
            UpperCAmelCase_											=  _normalize_for_match(__UpperCamelCase   )
            UpperCAmelCase_											=  _normalize_for_match(__UpperCamelCase   )

        if not isinstance(__UpperCamelCase ,  type(__UpperCamelCase   )   ):
            raise ValueError('''Type difference {} != {}'''.format(type(__UpperCamelCase   ) ,  type(__UpperCamelCase   )   )   )

        if not _compare(cond.operator ,  __UpperCamelCase ,  __UpperCamelCase   ):
            return False
    return True




def       SCREAMING_SNAKE_CASE			( __UpperCamelCase    :		List[Any] ,  __UpperCamelCase    :		List[Any] ,  __UpperCamelCase    :		Tuple   )						->							Optional[Any]:
    if not answer_coordinates:
        if aggregation_op == _Aggregation.COUNT:
            return 0.0
        else:
            return EMPTY_ANSWER_AGG

    # Count can support non numeric answers.
    if aggregation_op == _Aggregation.COUNT:
        return float(len(__UpperCamelCase   )   )

    # If we have just one answer, if float returns it or try a conversion.
    UpperCAmelCase_											=  [table['''rows'''][i][j] for (i, j) in answer_coordinates]
    if len(__UpperCamelCase   ) == 1:
        try:
            return convert_to_float(values[0]   )
        except ValueError as e:
            if aggregation_op != _Aggregation.NONE:
                raise e

    if aggregation_op == _Aggregation.NONE:
        return None

    # Other aggregation only support numeric values. Bail out if we have strings.
    if not all((isinstance(__UpperCamelCase ,  (int, float)   ) for v in values)   ):
        return None

    if aggregation_op == _Aggregation.SUM:
        return float(sum(__UpperCamelCase   )   )
    elif aggregation_op == _Aggregation.AVERAGE:
        return sum(__UpperCamelCase   ) / len(__UpperCamelCase   )
    else:
        raise ValueError(f'Unknown aggregation: {aggregation_op}'   )




def       SCREAMING_SNAKE_CASE			( __UpperCamelCase    :		List[Any] ,  __UpperCamelCase    :		Dict   )						->							Optional[int]:
    UpperCAmelCase_											=  sql_query['''agg''']
    if aggregation_op_index >= 3:
        UpperCAmelCase_											=  _Aggregation(__UpperCamelCase   )
    else:
        UpperCAmelCase_											=  _Aggregation.NONE

    UpperCAmelCase_											=  sql_query['''sel''']
    UpperCAmelCase_											=  [
        _Condition(__UpperCamelCase ,  _Operator(__UpperCamelCase   ) ,  __UpperCamelCase   )
        for column, operator, cmp_value in zip(
            sql_query['''conds''']['''column_index'''] ,  sql_query['''conds''']['''operator_index'''] ,  sql_query['''conds''']['''condition''']   )
    ]

    UpperCAmelCase_											=  []
    for row in range(len(table['''rows''']   )   ):
        if _respect_conditions(__UpperCamelCase ,  table['''rows'''][row] ,  __UpperCamelCase   ):
            indices.append((row, target_column)   )

    if not indices:
        return [], aggregation_op

    if len(__UpperCamelCase   ) == 1:
        return indices, aggregation_op

    # Parsing of MIN/MAX.
    if aggregation_op_index in (1, 2):
        UpperCAmelCase_											=  {2: min, 1: max}
        UpperCAmelCase_											=  [(table['''rows'''][i][j], index) for index, (i, j) in enumerate(__UpperCamelCase   )]
        UpperCAmelCase_											=  functools.reduce(operators[sql_query['''agg''']] ,  __UpperCamelCase   )

        UpperCAmelCase_											=  [indices[reduced[1]]]
        return ret, _Aggregation.NONE

    return indices, aggregation_op




def       SCREAMING_SNAKE_CASE			( __UpperCamelCase    :		List[Any] ,  __UpperCamelCase    :		Any ,  __UpperCamelCase    :		Optional[Any]   )						->							Union[str, Any]:
    if float_answer is not None:
        return [str(__UpperCamelCase   )]
    return [str(table['''real_rows'''][r][c]   ) for r, c in answer_coordinates]




def       SCREAMING_SNAKE_CASE			( __UpperCamelCase    :		Union[str, Any] ,  __UpperCamelCase    :		List[Any]   )						->							List:
    UpperCAmelCase_				,							UpperCAmelCase_											=  _get_answer_coordinates(__UpperCamelCase ,  __UpperCamelCase   )
    UpperCAmelCase_											=  _get_float_answer(__UpperCamelCase ,  __UpperCamelCase ,  __UpperCamelCase   )
    UpperCAmelCase_											=  _get_answer_text(__UpperCamelCase ,  __UpperCamelCase ,  __UpperCamelCase   )
    # keep the original data the same with TaPas
    if len(__UpperCamelCase   ) == 0:
        UpperCAmelCase_											=  [EMPTY_ANSWER]
    return answer_text











import itertools




def       SCREAMING_SNAKE_CASE			( __UpperCamelCase    :		Tuple   )						->							List[Any]:
    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       SCREAMING_SNAKE_CASE			( )						->							Optional[Any]:
    return sum(
        {
            int(''''''.join(pandigital[5:9]   )   )
            for pandigital in itertools.permutations('''123456789'''   )
            if is_combination_valid(__UpperCamelCase   )
        }   )


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





