




'''simple docstring'''






from __future__ import annotations

from scipy.special import comb  # type: ignore






class        lowercase_      :





     def __init__(     self     :					List[Any]     ,							__lowerCamelCase     :					list[tuple[float, float]]			):
           snake_case__       :   Any	      =    list_of_points
           # Degree determines the flexibility of the curve.
           # Degree = 1 will produce a straight line.
           snake_case__       :   List[Any]	      =    len(__lowerCamelCase			) - 1





     def 			_lowerCAmelCase      (     self     :					Tuple     ,							__lowerCamelCase     :					float			):
           assert 0 <= t <= 1, "Time t must be between 0 and 1."
           snake_case__       :   list[float]	      =    []
           for i in range(len(self.list_of_points			)			):
                 # basis function for each i
                 output_values.append(
                     comb(self.degree     ,							__lowerCamelCase			) * ((1 - t) ** (self.degree - i)) * (t**i)			)
           # the basis must sum up to 1 for it to produce a valid Bezier curve.
           assert round(sum(__lowerCamelCase			)     ,							5			) == 1
           return output_values





     def 			_lowerCAmelCase      (     self     :					Any     ,							__lowerCamelCase     :					float			):
           assert 0 <= t <= 1, "Time t must be between 0 and 1."

           snake_case__       :   Optional[Any]	      =    self.basis_function(__lowerCamelCase			)
           snake_case__       :   str	      =    0.0
           snake_case__       :   List[str]	      =    0.0
           for i in range(len(self.list_of_points			)			):
                 # For all points, sum up the product of i-th basis function and i-th point.
                 x += basis_function[i] * self.list_of_points[i][0]
                 y += basis_function[i] * self.list_of_points[i][1]
           return (x, y)





     def 			_lowerCAmelCase      (     self     :					Optional[int]     ,							__lowerCamelCase     :					float = 0.0_1			):
           from matplotlib import pyplot as plt  # type: ignore

           snake_case__       :   list[float]	      =    []  # x coordinates of points to plot
           snake_case__       :   list[float]	      =    []  # y coordinates of points to plot

           snake_case__       :   Union[str, Any]	      =    0.0
           while t <= 1:
                 snake_case__       :   Tuple	      =    self.bezier_curve_function(__lowerCamelCase			)
                 to_plot_x.append(value[0]			)
                 to_plot_y.append(value[1]			)
                 t += step_size

           snake_case__       :   Optional[int]	      =    [i[0] for i in self.list_of_points]
           snake_case__       :   Any	      =    [i[1] for i in self.list_of_points]

           plt.plot(
               __lowerCamelCase     ,							__lowerCamelCase     ,							color='blue'     ,							label='Curve of Degree ' + str(self.degree			)     ,							)
           plt.scatter(__lowerCamelCase     ,							__lowerCamelCase     ,							color='red'     ,							label='Control Points'			)
           plt.legend()
           plt.show()


if __name__ == "__main__":
      import doctest

      doctest.testmod()

      BezierCurve([(1, 2), (3, 5)]).plot_curve()  # degree 1
      BezierCurve([(0, 0), (5, 5), (5, 0)]).plot_curve()  # degree 2
      BezierCurve([(0, 0), (5, 5), (5, 0), (2.5, -2.5)]).plot_curve()  # degree 3






'''simple docstring'''






def 		UpperCamelCase__      (		__SCREAMING_SNAKE_CASE		)    ->   str:
      snake_case__      ,							snake_case__       :   Optional[int]	      =    [], []
      while len(__SCREAMING_SNAKE_CASE		) > 1:
            snake_case__      ,							snake_case__       :   Tuple	      =    min(__SCREAMING_SNAKE_CASE		), max(__SCREAMING_SNAKE_CASE		)
            start.append(__SCREAMING_SNAKE_CASE		)
            end.append(__SCREAMING_SNAKE_CASE		)
            collection.remove(__SCREAMING_SNAKE_CASE		)
            collection.remove(__SCREAMING_SNAKE_CASE		)
      end.reverse()
      return start + collection + end


if __name__ == "__main__":
      A_			      =		input("Enter numbers separated by a comma:\n").strip()
      A_			      =		[int(item) for item in user_input.split(",")]
      print(*merge_sort(unsorted), sep=",")
