from __future__ import annotations




class  __magic_name__  :





   """simple docstring"""




   def __init__(	self					:  Tuple		,  _lowercase					:  int							):



    """simple docstring"""



    _UpperCamelCase:     int							= order

    # a_{0} ... a_{k}
    _UpperCamelCase:     List[str]							= [1.0] + [0.0] * order
    # b_{0} ... b_{k}
    _UpperCamelCase:     str							= [1.0] + [0.0] * order

    # x[n-1] ... x[n-k]
    _UpperCamelCase:     Tuple							= [0.0] * self.order
    # y[n-1] ... y[n-k]
    _UpperCamelCase:     Dict							= [0.0] * self.order



   def   lowerCAmelCase						(	self					:  int		,  _lowercase					:  list[float]		,  _lowercase					:  list[float]							):



    """simple docstring"""



    if len(__lowercase							) < self.order:
     _UpperCamelCase:     List[str]							= [1.0, *a_coeffs]

    if len(__lowercase							) != self.order + 1:
     _UpperCamelCase:     List[str]							= (
         f"""Expected a_coeffs to have {self.order + 1} elements """
         f"""for {self.order}-order filter, got {len(__lowercase							)}"""
     )
     raise ValueError(__lowercase							)

    if len(__lowercase							) != self.order + 1:
     _UpperCamelCase:     List[str]							= (
         f"""Expected b_coeffs to have {self.order + 1} elements """
         f"""for {self.order}-order filter, got {len(__lowercase							)}"""
     )
     raise ValueError(__lowercase							)

    _UpperCamelCase:     List[Any]							= a_coeffs
    _UpperCamelCase:     str							= b_coeffs



   def   lowerCAmelCase						(	self					:  List[Any]		,  _lowercase					:  float							):



    """simple docstring"""



    _UpperCamelCase:     List[str]							= 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]
     )

    _UpperCamelCase:     Union[str, Any]							= (result + self.b_coeffs[0] * sample) / self.a_coeffs[0]

    _UpperCamelCase:     Optional[int]							= self.input_history[:-1]
    _UpperCamelCase:     Union[str, Any]							= self.output_history[:-1]

    _UpperCamelCase:     str							= sample
    _UpperCamelCase:     Tuple							= result

    return result
def       lowerCAmelCase_     (		lowercase:							int = 10**9		)    ->				int:







 '''simple docstring'''
 _UpperCamelCase:     List[Any]							= 1
 _UpperCamelCase:     Dict							= 2

 _UpperCamelCase:     Tuple							= 0
 _UpperCamelCase:     int							= 0
 _UpperCamelCase:     Dict							= 0
 while perimeter <= max_perimeter:
  perimeters_sum += perimeter

  prev_value += 2 * value
  value += prev_value

  _UpperCamelCase:     str							= 2 * value + 2 if i % 2 == 0 else 2 * value - 2
  i += 1

 return perimeters_sum


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