from math import factorial
class   _lowerCAmelCase		:







							def __init__(				self     :    Dict	,					__snake_case     :    str	,					__snake_case     :    int		):
										lowerCamelCase						:Optional[Any]						  =     real
										if isinstance(lowerCamelCase_	,					lowerCamelCase_		):
													lowerCamelCase						:Optional[int]						  =     [1] * rank
										else:
													lowerCamelCase						:Dict						  =     rank







							def __repr__(				self     :    Union[str, Any]		):
										return (
										    F"{self.real}+"
										    F"{'+'.join(str(lowerCamelCase_		)+'E'+str(n+1		)for n,dual in enumerate(self.duals		)		)}"
										)







							def 				snake_case  (				self     :    int		):
										lowerCamelCase						:List[str]						  =     self.duals.copy()
										while cur[-1] == 0:
													cur.pop(-1		)
										return Dual(self.real	,					lowerCamelCase_		)







							def __add__(				self     :    Union[str, Any]	,					__snake_case     :    Dict		):



										if not isinstance(lowerCamelCase_	,					lowerCamelCase_		):
													return Dual(self.real + other	,					self.duals		)
										lowerCamelCase						:Optional[Any]						  =     self.duals.copy()
										lowerCamelCase						:List[Any]						  =     other.duals.copy()
										if len(lowerCamelCase_		) > len(lowerCamelCase_		):
													o_dual.extend([1] * (len(lowerCamelCase_		) - len(lowerCamelCase_		))		)
										elif len(lowerCamelCase_		) < len(lowerCamelCase_		):
													s_dual.extend([1] * (len(lowerCamelCase_		) - len(lowerCamelCase_		))		)
										lowerCamelCase						:Any						  =     []
										for i in range(len(lowerCamelCase_		)		):
													new_duals.append(s_dual[i] + o_dual[i]		)
										return Dual(self.real + other.real	,					lowerCamelCase_		)

							_UpperCAmelCase						    =     __add__







							def __sub__(				self     :    int	,					__snake_case     :    Union[str, Any]		):
										return self + other * -1







							def __mul__(				self     :    List[str]	,					__snake_case     :    int		):



										if not isinstance(lowerCamelCase_	,					lowerCamelCase_		):
													lowerCamelCase						:Union[str, Any]						  =     []
													for i in self.duals:
																new_duals.append(i * other		)
													return Dual(self.real * other	,					lowerCamelCase_		)
										lowerCamelCase						:Tuple						  =     [0] * (len(self.duals		) + len(other.duals		) + 1)
										for i, item in enumerate(self.duals		):
													for j, jtem in enumerate(other.duals		):
																new_duals[i + j + 1] += item * jtem
										for k in range(len(self.duals		)		):
													new_duals[k] += self.duals[k] * other.real
										for index in range(len(other.duals		)		):
													new_duals[index] += other.duals[index] * self.real
										return Dual(self.real * other.real	,					lowerCamelCase_		)

							_UpperCAmelCase						    =     __mul__







							def __truediv__(				self     :    str	,					__snake_case     :    int		):



										if not isinstance(lowerCamelCase_	,					lowerCamelCase_		):
													lowerCamelCase						:Tuple						  =     []
													for i in self.duals:
																new_duals.append(i / other		)
													return Dual(self.real / other	,					lowerCamelCase_		)
										raise ValueError







							def __floordiv__(				self     :    List[str]	,					__snake_case     :    Optional[Any]		):



										if not isinstance(lowerCamelCase_	,					lowerCamelCase_		):
													lowerCamelCase						:Optional[int]						  =     []
													for i in self.duals:
																new_duals.append(i // other		)
													return Dual(self.real // other	,					lowerCamelCase_		)
										raise ValueError







							def __pow__(				self     :    int	,					__snake_case     :    List[str]		):



										if n < 0 or isinstance(lowerCamelCase_	,					lowerCamelCase_		):
													raise ValueError('''power must be a positive integer'''		)
										if n == 0:
													return 1
										if n == 1:
													return self
										lowerCamelCase						:Optional[Any]						  =     self
										for _ in range(n - 1		):
													x *= self
										return x





def  _lowerCamelCase					(   a_				: Any						,			a_				: Tuple						,			a_				: List[str]):



			if not callable(lowerCamelCase_):
						raise ValueError('''differentiate() requires a function as input for func''')
			if not isinstance(lowerCamelCase_						,			(float, int)):
						raise ValueError('''differentiate() requires a float as input for position''')
			if not isinstance(lowerCamelCase_						,			lowerCamelCase_):
						raise ValueError('''differentiate() requires an int as input for order''')
			lowerCamelCase						:Optional[int]						  =     Dual(lowerCamelCase_						,			1)
			lowerCamelCase						:Tuple						  =     func(lowerCamelCase_)
			if order == 0:
						return result.real
			return result.duals[order - 1] * factorial(lowerCamelCase_)


if __name__ == "__main__":
			import doctest

			doctest.testmod()





			def  _lowerCamelCase					(   a_				: Dict):
						return y**2 * y**4


			print(differentiate(f, 9, 2))




def  _lowerCamelCase					(   a_				: str						,			a_				: str):
			lowerCamelCase						:List[str]						  =     len(a_)
			lowerCamelCase						:List[str]						  =     len(a_)
			lowerCamelCase						:int						  =     [[False for _ in range(m + 1)] for _ in range(n + 1)]
			lowerCamelCase						:Optional[Any]						  =     True
			for i in range(a_):
						for j in range(m + 1):
									if dp[i][j]:
												if j < m and a[i].upper() == b[j]:
															lowerCamelCase						:Any						  =     True
												if a[i].islower():
															lowerCamelCase						:List[str]						  =     True
			return dp[n][m]


if __name__ == "__main__":
			import doctest

			doctest.testmod()



