



"""simple docstring"""






from __future__ import annotations



class 			A__   :




	'''simple docstring'''





	def __init__(     self:		List[Any]       ,			_SCREAMING_SNAKE_CASE:		int)				->       None:

				"""simple docstring"""

				__lowerCAmelCase      :  List[str]												=       order

				# a_{0} ... a_{k}
				__lowerCAmelCase      :  Tuple												=       [1.0] + [0.0] * order
				# b_{0} ... b_{k}
				__lowerCAmelCase      :  Tuple												=       [1.0] + [0.0] * order

				# x[n-1] ... x[n-k]
				__lowerCAmelCase      :  Any												=       [0.0] * self.order
				# y[n-1] ... y[n-k]
				__lowerCAmelCase      :  List[Any]												=       [0.0] * self.order

	def 							_SCREAMING_SNAKE_CASE   (     self:		List[Any]       ,			_SCREAMING_SNAKE_CASE:		list[float]       ,			_SCREAMING_SNAKE_CASE:		list[float])				->       None:

				"""simple docstring"""

				if len(_SCREAMING_SNAKE_CASE) < self.order:
							__lowerCAmelCase      :  Tuple												=       [1.0, *a_coeffs]

				if len(_SCREAMING_SNAKE_CASE) != self.order + 1:
							__lowerCAmelCase      :  Dict												=       (
							    F"""Expected a_coeffs to have {self.order + 1} elements """
							    F"""for {self.order}-order filter, got {len(_SCREAMING_SNAKE_CASE)}"""
							)
							raise ValueError(_SCREAMING_SNAKE_CASE)

				if len(_SCREAMING_SNAKE_CASE) != self.order + 1:
							__lowerCAmelCase      :  Any												=       (
							    F"""Expected b_coeffs to have {self.order + 1} elements """
							    F"""for {self.order}-order filter, got {len(_SCREAMING_SNAKE_CASE)}"""
							)
							raise ValueError(_SCREAMING_SNAKE_CASE)

				__lowerCAmelCase      :  List[Any]												=       a_coeffs
				__lowerCAmelCase      :  List[Any]												=       b_coeffs







	def 							_SCREAMING_SNAKE_CASE   (     self:		int       ,			_SCREAMING_SNAKE_CASE:		float)				->       float:

				"""simple docstring"""

				__lowerCAmelCase      :  Union[str, Any]												=       0.0

				# Start at index 1 and do index 0 at the end.
				for i in range(1       ,			self.order + 1):
							result += (
							    self.b_coeffs[i] * self.input_history[i - 1]
							    - self.a_coeffs[i] * self.output_history[i - 1]
							)

				__lowerCAmelCase      :  List[str]												=       (result + self.b_coeffs[0] * sample) / self.a_coeffs[0]

				__lowerCAmelCase      :  str												=       self.input_history[:-1]
				__lowerCAmelCase      :  Optional[int]												=       self.output_history[:-1]

				__lowerCAmelCase      :  Union[str, Any]												=       sample
				__lowerCAmelCase      :  List[Any]												=       result

				return result




"""simple docstring"""






import os
from math import logaa


def 			_lowercase				(  __snake_case = "base_exp.txt"	)						->   int:
			__lowerCAmelCase      :  float												=       0
			__lowerCAmelCase      :  Any												=       0
			for i, line in enumerate(open(os.path.join(os.path.dirname(__snake_case	)					,__snake_case	)	)	):
						__lowerCAmelCase						,	__lowerCAmelCase      :  List[str]												=       list(map(__snake_case					,line.split(","	)	)	)
						if x * logaa(__snake_case	) > largest:
									__lowerCAmelCase      :  Tuple												=       x * logaa(__snake_case	)
									__lowerCAmelCase      :  Optional[Any]												=       i + 1
			return result


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