


'''simple docstring'''






def      UpperCAmelCase      (		lowerCamelCase_  :list ):







		'''simple docstring'''
		if not isinstance(lowerCamelCase_				,      lowerCamelCase_ ):
				raise ValueError("""Input series is not valid, valid series - [2, 4, 6]""" )
		if len(lowerCamelCase_ ) == 0:
				raise ValueError("""Input list must be a non empty list""" )
		if len(lowerCamelCase_ ) == 1:
				return True
		snake_case_		:							Union[str, Any]			       =						series[1] - series[0]
		for index in range(len(lowerCamelCase_ ) - 1 ):
				if series[index + 1] - series[index] != common_diff:
						return False
		return True





def      UpperCAmelCase      (		lowerCamelCase_  :list ):







		'''simple docstring'''
		if not isinstance(lowerCamelCase_				,      lowerCamelCase_ ):
				raise ValueError("""Input series is not valid, valid series - [2, 4, 6]""" )
		if len(lowerCamelCase_ ) == 0:
				raise ValueError("""Input list must be a non empty list""" )
		snake_case_		:							List[Any]			       =						0
		for val in series:
				answer += val
		return answer / len(lowerCamelCase_ )


if __name__ == "__main__":
							import doctest

							doctest.testmod()



'''simple docstring'''






from __future__ import annotations

import os
from collections.abc import Mapping

__A	:	str     =     tuple[int, int]
class 						__UpperCamelCase	:





							def __init__(  self		:Union[str, Any]  ,_UpperCamelCase		:set[int]  ,_UpperCamelCase		:Mapping[EdgeT, int]			):
									snake_case_		:							set[int]			       =						vertices
									snake_case_		:							dict[EdgeT, int]			       =						{
									    (min(_UpperCamelCase			), max(_UpperCamelCase			)): weight for edge, weight in edges.items()
									}





							def 		a__   (  self		:Tuple  ,_UpperCamelCase		:EdgeT  ,_UpperCamelCase		:int			):
									self.vertices.add(edge[0]			)
									self.vertices.add(edge[1]			)
									snake_case_		:							str			       =						weight





							def 		a__   (  self		:Tuple			):
									snake_case_		:							Graph			       =						Graph({min(self.vertices			)}  ,{}			)
									snake_case_		:							EdgeT
									snake_case_		:							int
									snake_case_		:							EdgeT
									snake_case_		:							int

									while len(subgraph.vertices			) < len(self.vertices			):
											snake_case_		:							int			       =						max(self.edges.values()			) + 1
											for edge, weight in self.edges.items():
													if (edge[0] in subgraph.vertices) ^ (edge[1] in subgraph.vertices):
															if weight < min_weight:
																	snake_case_		:							Dict			       =						edge
																	snake_case_		:							Dict			       =						weight

											subgraph.add_edge(_UpperCamelCase  ,_UpperCamelCase			)

									return subgraph





def      UpperCAmelCase      (		lowerCamelCase_  :str = "p107_network.txt" ):







		'''simple docstring'''
		snake_case_		:							str			       =						os.path.abspath(os.path.dirname(lowerCamelCase_ ) )
		snake_case_		:							str			       =						os.path.join(lowerCamelCase_				,      lowerCamelCase_ )
		snake_case_		:							dict[EdgeT, int]			       =						{}
		snake_case_		:							list[str]
		snake_case_		:							int
		snake_case_		:							int

		with open(lowerCamelCase_ ) as f:
				snake_case_		:							Optional[int]			       =						f.read().strip().split("""\n""" )

		snake_case_		:							Any			       =						[line.split(""",""" ) for line in data]

		for edgea in range(1				,      len(lowerCamelCase_ ) ):
				for edgea in range(lowerCamelCase_ ):
						if adjaceny_matrix[edgea][edgea] != "-":
								snake_case_		:							str			       =						int(adjaceny_matrix[edgea][edgea] )

		snake_case_		:							Graph			       =						Graph(set(range(len(lowerCamelCase_ ) ) )				,      lowerCamelCase_ )

		snake_case_		:							Graph			       =						graph.prims_algorithm()

		snake_case_		:							int			       =						sum(graph.edges.values() )
		snake_case_		:							int			       =						sum(subgraph.edges.values() )

		return initial_total - optimal_total


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