

import sys

a_      =     (
    '73167176531330624919225119674426574742355349194934'
    '96983520312774506326239578318016984801869478851843'
    '85861560789112949495459501737958331952853208805511'
    '12540698747158523863050715693290963295227443043557'
    '66896648950445244523161731856403098711121722383113'
    '62229893423380308135336276614282806444486645238749'
    '30358907296290491560440772390713810515859307960866'
    '70172427121883998797908792274921901699720888093776'
    '65727333001053367881220235421809751254540594752243'
    '52584907711670556013604839586446706324415722155397'
    '53697817977846174064955149290862569321978468622482'
    '83972241375657056057490261407972968652414535100474'
    '82166370484403199890008895243450658541227588666881'
    '16427171479924442928230863465674813919123162824586'
    '17866458359124566529476545682848912883142607690042'
    '24219022671055626321111109370544217506941658960408'
    '07198403850962455444362981230987879927244284909188'
    '84580156166097919133875499200524063689912560717606'
    '05886116467109405077541002256983155200055935729725'
    '71636269561882670428252483600823257530420752963450'
)

def 			lowerCamelCase__			(       _a = N):
	SCREAMING_SNAKE_CASE :   Optional[Any]					  =							-sys.maxsize - 1
	for i in range(len(_a) - 12):
		SCREAMING_SNAKE_CASE :   List[Any]					  =							1
		for j in range(13):
			product *= int(n[i + j])
		if product > largest_product:
			SCREAMING_SNAKE_CASE :   Union[str, Any]					  =							product
	return largest_product


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



from typing import Any

def 			lowerCAmelCase__					(     a__:						list     ,    a__:						list     ,    a__:						dict     ,    a__:						dict     ,    a__:						dict     ,    )    ->						list:


							'''simple docstring'''





							_validation(
							    a__     ,    a__     ,    a__     ,    a__     ,    a__     ,    )
							# Creates data structures and fill initial step
							_UpperCAmelCase											=     {}
							_UpperCAmelCase											=     {}
							for state in states_space:
														_UpperCAmelCase											=     observations_space[0]
														_UpperCAmelCase											=     (
														    initial_probabilities[state] * emission_probabilities[state][observation]
														)
														_UpperCAmelCase											=     None

							# Fills the data structure with the probabilities of
							# different transitions and pointers to previous states
							for o in range(1     ,    len(a__			)			):
														_UpperCAmelCase											=     observations_space[o]
														_UpperCAmelCase											=     observations_space[o - 1]
														for state in states_space:
																					# Calculates the argmax for probability function
																					_UpperCAmelCase											=     ''
																					_UpperCAmelCase											=     -1
																					for k_state in states_space:
																												_UpperCAmelCase											=     (
																												    probabilities[(k_state, prior_observation)]
																												    * transition_probabilities[k_state][state]
																												    * emission_probabilities[state][observation]
																												)
																												if probability > max_probability:
																																			_UpperCAmelCase											=     probability
																																			_UpperCAmelCase											=     k_state

            # Update probabilities and pointers dicts
																					_UpperCAmelCase											=     (
																					    probabilities[(arg_max, prior_observation)]
																					    * transition_probabilities[arg_max][state]
																					    * emission_probabilities[state][observation]
																					)

																					_UpperCAmelCase											=     arg_max

    # The final observation
							_UpperCAmelCase											=     observations_space[len(a__			) - 1]

							# argmax for given final observation
							_UpperCAmelCase											=     ''
							_UpperCAmelCase											=     -1
							for k_state in states_space:
														_UpperCAmelCase											=     probabilities[(k_state, final_observation)]
														if probability > max_probability:
																					_UpperCAmelCase											=     probability
																					_UpperCAmelCase											=     k_state
							_UpperCAmelCase											=     arg_max

							# Process pointers backwards
							_UpperCAmelCase											=     last_state
							_UpperCAmelCase											=     []
							for o in range(len(a__			) - 1     ,    -1     ,    -1			):
														result.append(a__			)
														_UpperCAmelCase											=     pointers[previous, observations_space[o]]
							result.reverse()

							return result

def 			lowerCAmelCase__					(     a__:						Any     ,    a__:						Any     ,    a__:						Any     ,    a__:						Any     ,    a__:						Any     ,    )    ->						None:


							'''simple docstring'''





							_validate_not_empty(
							    a__     ,    a__     ,    a__     ,    a__     ,    a__     ,    )
							_validate_lists(a__     ,    a__			)
							_validate_dicts(
							    a__     ,    a__     ,    a__			)

def 			lowerCAmelCase__					(     a__:						Any     ,    a__:						Any     ,    a__:						Any     ,    a__:						Any     ,    a__:						Any     ,    )    ->						None:


							'''simple docstring'''





							if not all(
							    [
							        observations_space,
							        states_space,
							        initial_probabilities,
							        transition_probabilities,
							        emission_probabilities,
							    ]			):
														raise ValueError('There\'s an empty parameter'			)

def 			lowerCAmelCase__					(     a__:						Any     ,    a__:						Any			)    ->						None:


							'''simple docstring'''





							_validate_list(a__     ,    'observations_space'			)
							_validate_list(a__     ,    'states_space'			)

def 			lowerCAmelCase__					(     a__:						Any     ,    a__:						str			)    ->						None:


							'''simple docstring'''





							if not isinstance(_object     ,    a__			):
														_UpperCAmelCase											=     F'''{var_name} must be a list'''
														raise ValueError(a__			)
							else:
														for x in _object:
																					if not isinstance(a__     ,    a__			):
																												_UpperCAmelCase											=     F'''{var_name} must be a list of strings'''
																												raise ValueError(a__			)

def 			lowerCAmelCase__					(     a__:						Any     ,    a__:						Any     ,    a__:						Any     ,    )    ->						None:


							'''simple docstring'''





							_validate_dict(a__     ,    'initial_probabilities'     ,    a__			)
							_validate_nested_dict(a__     ,    'transition_probabilities'			)
							_validate_nested_dict(a__     ,    'emission_probabilities'			)

def 			lowerCAmelCase__					(     a__:						Any     ,    a__:						str			)    ->						None:


							'''simple docstring'''





							_validate_dict(_object     ,    a__     ,    a__			)
							for x in _object.values():
														_validate_dict(a__     ,    a__     ,    a__     ,    a__			)

def 			lowerCAmelCase__					(     a__:						Any     ,    a__:						str     ,    a__:						type     ,    a__:						bool = False			)    ->						None:


							'''simple docstring'''





							if not isinstance(_object     ,    a__			):
														_UpperCAmelCase											=     F'''{var_name} must be a dict'''
														raise ValueError(a__			)
							if not all(isinstance(a__     ,    a__			) for x in _object			):
														_UpperCAmelCase											=     F'''{var_name} all keys must be strings'''
														raise ValueError(a__			)
							if not all(isinstance(a__     ,    a__			) for x in _object.values()			):
														_UpperCAmelCase											=     'nested dictionary ' if nested else ''
														_UpperCAmelCase											=     F'''{var_name} {nested_text}all values must be {value_type.__name__}'''
														raise ValueError(a__			)


if __name__ == "__main__":
		from doctest import testmod

		testmod()
