





from __future__ import annotations

from collections.abc import Callable
from typing import Any, Generic, TypeVar

snake_case_     :       List[str]						=  TypeVar("T")


class 					__a      (Generic[T]     ):

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







													"""simple docstring"""
													UpperCAmelCase_			:      Any | T     						=  None

													UpperCAmelCase_			:      int     						=  len(__magic_name__   )
													UpperCAmelCase_			:      list[T]     						=  [any_type for _ in range(self.N   )] + arr
													UpperCAmelCase_			:      Optional[Any]     						=  fnc
													self.build()

							def     UpperCAmelCase__	(							self							:     str   )					->       None:







													"""simple docstring"""
													for p in range(self.N - 1       ,     0       ,     -1   ):
																			UpperCAmelCase_			:      Optional[Any]     						=  self.fn(self.st[p * 2]       ,     self.st[p * 2 + 1]   )

							def     UpperCAmelCase__	(							self							:     Tuple       ,     __magic_name__							:     Union[str, Any]       ,     __magic_name__							:     Dict   )					->       None:







													"""simple docstring"""
													p += self.N
													UpperCAmelCase_			:      Optional[Any]     						=  v
													while p > 1:
																			UpperCAmelCase_			:      List[str]     						=  p // 2
																			UpperCAmelCase_			:      List[Any]     						=  self.fn(self.st[p * 2]       ,     self.st[p * 2 + 1]   )



							def     UpperCAmelCase__	(							self							:     List[str]       ,     __magic_name__							:     Dict       ,     __magic_name__							:     Optional[int]   )					->       T | None:  # noqa: E741







													"""simple docstring"""
													UpperCAmelCase_			:      List[str]     						=  l + self.N, r + self.N

													UpperCAmelCase_			:      T | None     						=  None
													while l <= r:
																			if l % 2 == 1:
																									UpperCAmelCase_			:      List[str]     						=  self.st[l] if res is None else self.fn(__magic_name__       ,     self.st[l]   )
																			if r % 2 == 0:
																									UpperCAmelCase_			:      Union[str, Any]     						=  self.st[r] if res is None else self.fn(__magic_name__       ,     self.st[r]   )
																			UpperCAmelCase_			:      List[str]     						=  (l + 1) // 2, (r - 1) // 2
													return res


if __name__ == "__main__":
					from functools import reduce

					snake_case_     :       Optional[Any]						=  [1, 10, -2, 9, -3, 8, 4, -7, 5, 6, 11, -12]

					snake_case_     :       Dict						=  {
					    0: 7,
					    1: 2,
					    2: 6,
					    3: -14,
					    4: 5,
					    5: 4,
					    6: 7,
					    7: -10,
					    8: 9,
					    9: 10,
					    10: 12,
					    11: 1,
					}

					snake_case_     :       Optional[int]						=  SegmentTree(test_array, min)
					snake_case_     :       Dict						=  SegmentTree(test_array, max)
					snake_case_     :       Dict						=  SegmentTree(test_array, lambda a, b: a + b)





					def        lowerCamelCase_      (  ) ->	None:


											for i in range(len(__snake_case   )   ):
																	for j in range(__snake_case,			len(__snake_case   )   ):
																							UpperCAmelCase_			:      Optional[Any]     						=  reduce(__snake_case,			test_array[i : j + 1]   )
																							UpperCAmelCase_			:      str     						=  reduce(__snake_case,			test_array[i : j + 1]   )
																							UpperCAmelCase_			:      List[str]     						=  reduce(lambda SCREAMING_SNAKE_CASE__,			SCREAMING_SNAKE_CASE__   : a + b,			test_array[i : j + 1]   )
																							assert min_range == min_segment_tree.query(__snake_case,			__snake_case   )
																							assert max_range == max_segment_tree.query(__snake_case,			__snake_case   )
																							assert sum_range == sum_segment_tree.query(__snake_case,			__snake_case   )

					test_all_segments()

					for index, value in test_updates.items():
										snake_case_     :       Optional[Any]						=  value
										min_segment_tree.update(index, value)
										max_segment_tree.update(index, value)
										sum_segment_tree.update(index, value)
										test_all_segments()












'''simple docstring'''







import sys
import turtle





def        lowerCamelCase_      (  SCREAMING_SNAKE_CASE__      :			tuple[float, float],			SCREAMING_SNAKE_CASE__      :			tuple[float, float]   ) ->	tuple[float, float]:
						return (pa[0] + pa[0]) / 2, (pa[1] + pa[1]) / 2





def        lowerCamelCase_      (  SCREAMING_SNAKE_CASE__      :			tuple[float, float],			SCREAMING_SNAKE_CASE__      :			tuple[float, float],			SCREAMING_SNAKE_CASE__      :			tuple[float, float],			SCREAMING_SNAKE_CASE__      :			int,			) ->	None:
						my_pen.up()
						my_pen.goto(vertexa[0],			vertexa[1]   )
						my_pen.down()
						my_pen.goto(vertexa[0],			vertexa[1]   )
						my_pen.goto(vertexa[0],			vertexa[1]   )
						my_pen.goto(vertexa[0],			vertexa[1]   )

						if depth == 0:
												return

						triangle(SCREAMING_SNAKE_CASE__,			get_mid(SCREAMING_SNAKE_CASE__,			SCREAMING_SNAKE_CASE__   ),			get_mid(SCREAMING_SNAKE_CASE__,			SCREAMING_SNAKE_CASE__   ),			depth - 1   )
						triangle(SCREAMING_SNAKE_CASE__,			get_mid(SCREAMING_SNAKE_CASE__,			SCREAMING_SNAKE_CASE__   ),			get_mid(SCREAMING_SNAKE_CASE__,			SCREAMING_SNAKE_CASE__   ),			depth - 1   )
						triangle(SCREAMING_SNAKE_CASE__,			get_mid(SCREAMING_SNAKE_CASE__,			SCREAMING_SNAKE_CASE__   ),			get_mid(SCREAMING_SNAKE_CASE__,			SCREAMING_SNAKE_CASE__   ),			depth - 1   )


if __name__ == "__main__":
					if len(sys.argv) != 2:
										raise ValueError(
										    "Correct format for using this script: "
										    "python fractals.py <int:depth_for_fractal>"
										)
					snake_case_     :       Any						=  turtle.Turtle()
					my_pen.ht()
					my_pen.speed(5)
					my_pen.pencolor("red")

					snake_case_     :       Tuple						=  [(-1_75, -1_25), (0, 1_75), (1_75, -1_25)]  # vertices of triangle
					triangle(vertices[0], vertices[1], vertices[2], int(sys.argv[1]))





