





from __future__ import annotations

from collections.abc import MutableSequence

class        __SCREAMING_SNAKE_CASE					:






							def __init__(						self  , __lowerCAmelCase  , __lowerCAmelCase  ):
											if len(__snake_case  ) != degree + 1:
															raise ValueError(
															    """The number of coefficients should be equal to the degree + 1."""  )

											UpperCamelCase__				     =			list(__snake_case  )
											UpperCamelCase__				     =			degree






							def __add__(						self  , __lowerCAmelCase  ):

											if self.degree > polynomial_a.degree:
															UpperCamelCase__				     =			self.coefficients[:]
															for i in range(polynomial_a.degree + 1  ):
																			coefficients[i] += polynomial_a.coefficients[i]
															return Polynomial(self.degree  , __snake_case  )
											else:
															UpperCamelCase__				     =			polynomial_a.coefficients[:]
															for i in range(self.degree + 1  ):
																			coefficients[i] += self.coefficients[i]
															return Polynomial(polynomial_a.degree  , __snake_case  )






							def __sub__(						self  , __lowerCAmelCase  ):
											return self + polynomial_a * Polynomial(0  , [-1]  )






							def __neg__(						self  ):
											return Polynomial(self.degree  , [-c for c in self.coefficients]  )






							def __mul__(						self  , __lowerCAmelCase  ):
											UpperCamelCase__				     =			[0] * (self.degree + polynomial_a.degree + 1)
											for i in range(self.degree + 1  ):
															for j in range(polynomial_a.degree + 1  ):
																			coefficients[i + j] += (
																			    self.coefficients[i] * polynomial_a.coefficients[j]
																			)

											return Polynomial(self.degree + polynomial_a.degree  , __snake_case  )






							def 				_lowerCamelCase		(						self  , __lowerCAmelCase  ):
											UpperCamelCase__				     =			0
											for i in range(self.degree + 1  ):
															result += self.coefficients[i] * (substitution**i)
											return result






							def __str__(						self  ):
											UpperCamelCase__				     =			''''''
											for i in range(self.degree  , -1  , -1  ):
															if self.coefficients[i] == 0:
																			continue
															elif self.coefficients[i] > 0:
																			if polynomial:
																							polynomial += " + "
															else:
																			polynomial += " - "

															if i == 0:
																			polynomial += str(abs(self.coefficients[i]  )  )
															elif i == 1:
																			polynomial += str(abs(self.coefficients[i]  )  ) + "x"
															else:
																			polynomial += str(abs(self.coefficients[i]  )  ) + "x^" + str(__snake_case  )

											return polynomial






							def __repr__(						self  ):
											return self.__str__()






							def 				_lowerCamelCase		(						self  ):
											UpperCamelCase__				     =			[0] * self.degree
											for i in range(self.degree  ):
															UpperCamelCase__				     =			self.coefficients[i + 1] * (i + 1)
											return Polynomial(self.degree - 1  , __snake_case  )






							def 				_lowerCamelCase		(						self  , __lowerCAmelCase = 0  ):
											UpperCamelCase__				     =			[0] * (self.degree + 2)
											UpperCamelCase__				     =			constant
											for i in range(self.degree + 1  ):
															UpperCamelCase__				     =			self.coefficients[i] / (i + 1)
											return Polynomial(self.degree + 1  , __snake_case  )






							def __eq__(						self  , __lowerCAmelCase  ):
											if not isinstance(__snake_case  , __snake_case  ):
															return False

											if self.degree != polynomial_a.degree:
															return False

											for i in range(self.degree + 1  ):
															if self.coefficients[i] != polynomial_a.coefficients[i]:
																			return False

											return True







							def __ne__(						self  , __lowerCAmelCase  ):
											return not self.__eq__(__snake_case  )











def     _UpperCamelCase     (a__   :int       ):






							"""simple docstring"""





							if divisor % 5 == 0 or divisor % 2 == 0:
														return 0
							UpperCamelCase__				     =			1
							UpperCamelCase__				     =			1
							while repunit:
														UpperCamelCase__				     =			(10 * repunit + 1) % divisor
														repunit_index += 1
							return repunit_index





def     _UpperCamelCase     (a__   :int = 100_0000       ):






							"""simple docstring"""





							UpperCamelCase__				     =			limit - 1
							if divisor % 2 == 0:
														divisor += 1
							while least_divisible_repunit(a__       ) <= limit:
														divisor += 2
							return divisor


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




