





'''simple docstring'''


from collections.abc import Sequence
from queue import Queue






class       UpperCamelCase__  :







	def __init__(				self			:   List[Any] , lowerCamelCase			:   int , lowerCamelCase			:   Optional[int] , lowerCamelCase			:   Any , lowerCamelCase			:   Optional[int]=None , lowerCamelCase			:   Tuple=None		):




				'''simple docstring'''
				a__     = start
				a__     = end
				a__     = val
				a__     = (start + end) // 2
				a__     = left
				a__     = right







	def __repr__(				self			:   List[Any]		):




				'''simple docstring'''
				return F'''SegmentTreeNode(start={self.start}, end={self.end}, val={self.val})'''






class       UpperCamelCase__  :







	def __init__(				self			:   Union[str, Any] , lowerCamelCase			:   Sequence , lowerCamelCase			:   str		):




				'''simple docstring'''
				a__     = collection
				a__     = function
				if self.collection:
							a__     = self._build_tree(0 , len(lowerCamelCase		) - 1		)







	def 						__a   (				self			:   Optional[int] , lowerCamelCase			:   str , lowerCamelCase			:   Optional[Any]		):




				'''simple docstring'''
				self._update_tree(self.root , lowerCamelCase , lowerCamelCase		)







	def 						__a   (				self			:   int , lowerCamelCase			:   List[str] , lowerCamelCase			:   str		):




				'''simple docstring'''
				return self._query_range(self.root , lowerCamelCase , lowerCamelCase		)







	def 						__a   (				self			:   Optional[int] , lowerCamelCase			:   Tuple , lowerCamelCase			:   List[Any]		):




				'''simple docstring'''
				if start == end:
							return SegmentTreeNode(lowerCamelCase , lowerCamelCase , self.collection[start]		)
				a__     = (start + end) // 2
				a__     = self._build_tree(lowerCamelCase , lowerCamelCase		)
				a__     = self._build_tree(mid + 1 , lowerCamelCase		)
				return SegmentTreeNode(lowerCamelCase , lowerCamelCase , self.fn(left.val , right.val		) , lowerCamelCase , lowerCamelCase		)







	def 						__a   (				self			:   List[Any] , lowerCamelCase			:   Union[str, Any] , lowerCamelCase			:   int , lowerCamelCase			:   int		):




				'''simple docstring'''
				if node.start == i and node.end == i:
							a__     = val
							return
				if i <= node.mid:
							self._update_tree(node.left , lowerCamelCase , lowerCamelCase		)
				else:
							self._update_tree(node.right , lowerCamelCase , lowerCamelCase		)
				a__     = self.fn(node.left.val , node.right.val		)







	def 						__a   (				self			:   List[str] , lowerCamelCase			:   List[str] , lowerCamelCase			:   List[Any] , lowerCamelCase			:   Tuple		):




				'''simple docstring'''
				if node.start == i and node.end == j:
							return node.val

				if i <= node.mid:
							if j <= node.mid:
										# range in left child tree
										return self._query_range(node.left , lowerCamelCase , lowerCamelCase		)
							else:
										# range in left child tree and right child tree
										return self.fn(
										    self._query_range(node.left , lowerCamelCase , node.mid		) , self._query_range(node.right , node.mid + 1 , lowerCamelCase		) , )
				else:
							# range in right child tree
							return self._query_range(node.right , lowerCamelCase , lowerCamelCase		)







	def 						__a   (				self			:   Dict		):




				'''simple docstring'''
				if self.root is not None:
							a__     = Queue()
							queue.put(self.root		)
							while not queue.empty():
										a__     = queue.get()
										yield node

										if node.left is not None:
													queue.put(node.left		)

										if node.right is not None:
													queue.put(node.right		)


if __name__ == "__main__":
		import operator

		for fn in [operator.add, max, min]:
				print("*" * 50)
				lowerCAmelCase_   :   Tuple       =					SegmentTree([2, 1, 5, 3, 4], fn)
				for node in arr.traverse():
						print(node)
				print()

				arr.update(1, 5)
				for node in arr.traverse():
						print(node)
				print()

				print(arr.query_range(3, 4))  # 7
				print(arr.query_range(2, 2))  # 5
				print(arr.query_range(1, 3))  # 13
				print()










'''simple docstring'''


import re







def    _lowerCamelCase  (__lowerCamelCase  :     str     )   ->    bool:
			a__     = re.compile(
			    r"^(?:0|94|\+94|0{2}94)" r"7(0|1|2|4|5|6|7|8)" r"(-| |)" r"\d{7}$"     )

			return bool(re.search(__lowerCamelCase					,  __lowerCamelCase     )     )


if __name__ == "__main__":
		lowerCAmelCase_   :   Any       =					"0094702343221"

		print(is_sri_lankan_phone_number(phone))



