





from __future__ import annotations

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

snake_case 				=       TypeVar("""T""")





class 				A_				(      Generic[T]	):







       """simple docstring"""





       def __init__(    self	:	Optional[Any]						,__A	:	list[T]						,__A	:	Callable[[T, T], T]  )						->					None:
         _lowercase							= None

         _lowercase							= len(__A  )
         _lowercase							= [any_type for _ in range(self.N  )] + arr
         _lowercase							= fnc
         self.build()







       def    __UpperCAmelCase (    self	:	Dict  )						->					None:
         for p in range(self.N - 1						,0						,-1  ):
           _lowercase							= self.fn(self.st[p * 2]						,self.st[p * 2 + 1]  )







       def    __UpperCAmelCase (    self	:	Dict						,__A	:	int						,__A	:	T  )						->					None:
         p += self.N
         _lowercase							= v
         while p > 1:
           _lowercase							= p // 2
           _lowercase							= self.fn(self.st[p * 2]						,self.st[p * 2 + 1]  )







       def    __UpperCAmelCase (    self	:	Optional[int]						,__A	:	int						,__A	:	int  )						->					T | None:  # noqa: E741
         _lowercase						,		_lowercase							= l + self.N, r + self.N

         _lowercase							= None
         while l <= r:
           if l % 2 == 1:
             _lowercase							= self.st[l] if res is None else self.fn(__A						,self.st[l]  )
           if r % 2 == 0:
             _lowercase							= self.st[r] if res is None else self.fn(__A						,self.st[r]  )
           _lowercase						,		_lowercase							= (l + 1) // 2, (r - 1) // 2
         return res


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

      snake_case 				=       [1, 1_0, -2, 9, -3, 8, 4, -7, 5, 6, 1_1, -1_2]

      snake_case 				=       {
          0: 7,
          1: 2,
          2: 6,
          3: -1_4,
          4: 5,
          5: 4,
          6: 7,
          7: -1_0,
          8: 9,
          9: 1_0,
          1_0: 1_2,
          1_1: 1,
      }

      snake_case 				=       SegmentTree(test_array, min)
      snake_case 				=       SegmentTree(test_array, max)
      snake_case 				=       SegmentTree(test_array, lambda a, b: a + b)

      def 							SCREAMING_SNAKE_CASE__       (  )      ->						None:
        for i in range(len(snake_case__     )     ):
          for j in range(snake_case__			,							len(snake_case__     )     ):
            _lowercase							= reduce(snake_case__			,							test_array[i : j + 1]     )
            _lowercase							= reduce(snake_case__			,							test_array[i : j + 1]     )
            _lowercase							= reduce(lambda snake_case__			,							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 				=       value
            min_segment_tree.update(index, value)
            max_segment_tree.update(index, value)
            sum_segment_tree.update(index, value)
            test_all_segments()






from itertools import count

def 							SCREAMING_SNAKE_CASE__       (  snake_case__  :int = 50     )      ->						int:
  _lowercase							= [1] * min_block_length

  for n in count(snake_case__     ):
    fill_count_functions.append(1     )

    for block_length in range(snake_case__			,							n + 1     ):
      for block_start in range(n - block_length     ):
        fill_count_functions[n] += fill_count_functions[
            n - block_start - block_length - 1
        ]

      fill_count_functions[n] += 1

    if fill_count_functions[n] > 100_0000:
      break

  return n


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