


from __future__ import annotations

class 						A__							:




						def __init__(       self					:      Optional[int]				,    _a					:      int  )							->     None:


										"""simple docstring"""





										_SCREAMING_SNAKE_CASE			  =order

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

										# x[n-1] ... x[n-k]
										_SCREAMING_SNAKE_CASE			  =[0.0] * self.order
										# y[n-1] ... y[n-k]
										_SCREAMING_SNAKE_CASE			  =[0.0] * self.order




						def 							__UpperCamelCase				(       self					:      Optional[Any]				,    _a					:      list[float]				,    _a					:      list[float]  )							->     None:


										"""simple docstring"""





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

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

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

										_SCREAMING_SNAKE_CASE			  =a_coeffs
										_SCREAMING_SNAKE_CASE			  =b_coeffs




						def 							__UpperCamelCase				(       self					:      Union[str, Any]				,    _a					:      float  )							->     float:


										"""simple docstring"""





										_SCREAMING_SNAKE_CASE			  =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]
														)

										_SCREAMING_SNAKE_CASE			  =(result + self.b_coeffs[0] * sample) / self.a_coeffs[0]

										_SCREAMING_SNAKE_CASE			  =self.input_history[:-1]
										_SCREAMING_SNAKE_CASE			  =self.output_history[:-1]

										_SCREAMING_SNAKE_CASE			  =sample
										_SCREAMING_SNAKE_CASE			  =result

										return result



snake_case_						:			dict[tuple[int, int, int], int]													=							{}







def 						lowerCamelCase(   a__	,a__	,a__):

				# if we are absent twice, or late 3 consecutive days,
				# no further prize strings are possible
				if late == 3 or absent == 2:
								return 0

				# if we have no days left, and have not failed any other rules,
				# we have a prize string
				if days == 0:
								return 1

				# No easy solution, so now we need to do the recursive calculation

				# First, check if the combination is already in the cache, and
				# if yes, return the stored value from there since we already
				# know the number of possible prize strings from this point on
				_SCREAMING_SNAKE_CASE			  =(days, absent, late)
				if key in cache:
								return cache[key]

				# now we calculate the three possible ways that can unfold from
				# this point on, depending on our attendance today

				# 1) if we are late (but not absent), the "absent" counter stays as
				# it is, but the "late" counter increases by one
				_SCREAMING_SNAKE_CASE			  =_calculate(days - 1	,a__	,late + 1)

				# 2) if we are absent, the "absent" counter increases by 1, and the
				# "late" counter resets to 0
				_SCREAMING_SNAKE_CASE			  =_calculate(days - 1	,absent + 1	,0)

				# 3) if we are on time, this resets the "late" counter and keeps the
				# absent counter
				_SCREAMING_SNAKE_CASE			  =_calculate(days - 1	,a__	,0)

				_SCREAMING_SNAKE_CASE			  =state_late + state_absent + state_ontime

				_SCREAMING_SNAKE_CASE			  =prizestrings
				return prizestrings







def 						lowerCamelCase(   a__ = 30):
				return _calculate(a__	,absent=0	,late=0)


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