


'''simple docstring'''
lowerCAmelCase__  =     10_00



def 				lowerCAmelCase__	(       UpperCAmelCase     ):






       """simple docstring"""





       return x * x



def 				lowerCAmelCase__	(       UpperCAmelCase    ,       UpperCAmelCase    ,       UpperCAmelCase    ,       UpperCAmelCase = 4     ):






       """simple docstring"""





       assert callable(
           UpperCAmelCase     ), f"""the function(object) passed should be callable your input : {function}"""
       assert isinstance(UpperCAmelCase    ,       (float, int)     ), f"""a should be float or integer your input : {a}"""
       assert isinstance(function(UpperCAmelCase     )    ,       (float, int)     ), (
           "the function should return integer or float return type of your function, "
           f"""{type(UpperCAmelCase     )}"""
       )
       assert isinstance(UpperCAmelCase    ,       (float, int)     ), f"""b should be float or integer your input : {b}"""
       assert (
           isinstance(UpperCAmelCase    ,       UpperCAmelCase     ) and precision > 0
       ), f"""precision should be positive integer your input : {precision}"""

       # just applying the formula of simpson for approximate integration written in
       # mentioned article in first comment of this file and above this function

       snake_case__					:	Any          =					(b - a) / N_STEPS
       snake_case__					:	Any          =					function(UpperCAmelCase     ) + function(UpperCAmelCase     )

       for i in range(1    ,       UpperCAmelCase     ):
              snake_case__					:	List[str]          =					a + h * i
              result += function(UpperCAmelCase     ) * (4 if i % 2 else 2)

       result *= h / 3
       return round(UpperCAmelCase    ,       UpperCAmelCase     )


if __name__ == "__main__":
     import doctest

     doctest.testmod()








'''simple docstring'''
from __future__ import annotations







class 					_A						:



   '''simple docstring'''






   def __init__(	self	:					Any					, lowerCamelCase	:					int						)->	None:
          snake_case__					:	Optional[int]          =					value
          snake_case__					:	Node | None          =					None
          snake_case__					:	Node | None          =					None







class 					_A						:



   '''simple docstring'''






   _lowercase    						= 42




   def __init__(	self	:					str						)->	None:
          snake_case__					:	int          =					0




   def   __lowerCAmelCase						(	self	:					Tuple					, lowerCamelCase	:					Node | None					, lowerCamelCase	:					int						)->	None:
          if node is None:
                 return

          if path_sum == self.target:
                 self.paths += 1

          if node.left:
                 self.depth_first_search(node.left					, path_sum + node.left.value						)
          if node.right:
                 self.depth_first_search(node.right					, path_sum + node.right.value						)




   def   __lowerCAmelCase						(	self	:					Tuple					, lowerCamelCase	:					Node | None					, lowerCamelCase	:					int | None = None						)->	int:
          if node is None:
                 return 0
          if target is not None:
                 snake_case__					:	Dict          =					target

          self.depth_first_search(lowerCamelCase					, node.value						)
          self.path_sum(node.left						)
          self.path_sum(node.right						)

          return self.paths


if __name__ == "__main__":
     import doctest

     doctest.testmod()




