

import math


class 					A		:







    """simple docstring"""





    def __init__( self					:			str,lowercase_					:			Dict						)->       int:





        '''simple docstring'''







        A__        =  len(__SCREAMING_SNAKE_CASE						)
        A__        =  [0] * (
            4 * self.N
        )  # approximate the overall size of segment tree with array N
        self.build(1,0,self.N - 1						)


    def 		snake_case__	( self					:			Union[str, Any],lowercase_					:			Optional[Any]						)->       List[str]:





        '''simple docstring'''







        return idx * 2


    def 		snake_case__	( self					:			Optional[Any],lowercase_					:			str						)->       List[str]:





        '''simple docstring'''







        return idx * 2 + 1


    def 		snake_case__	( self					:			Optional[Any],lowercase_					:			Optional[Any],lowercase_					:			Optional[int],lowercase_					:			Any						)->       Tuple:  # noqa: E741





        '''simple docstring'''







        if l == r:
            A__        =  A[l]
        else:
            A__        =  (l + r) // 2
            self.build(self.left(__SCREAMING_SNAKE_CASE						),__SCREAMING_SNAKE_CASE,__SCREAMING_SNAKE_CASE						)
            self.build(self.right(__SCREAMING_SNAKE_CASE						),mid + 1,__SCREAMING_SNAKE_CASE						)
            A__        =  max(self.st[self.left(__SCREAMING_SNAKE_CASE						)],self.st[self.right(__SCREAMING_SNAKE_CASE						)]						)


    def 		snake_case__	( self					:			Any,lowercase_					:			Dict,lowercase_					:			Union[str, Any],lowercase_					:			List[str]						)->       str:





        '''simple docstring'''







        return self.update_recursive(1,0,self.N - 1,a - 1,b - 1,__SCREAMING_SNAKE_CASE						)


    def 		snake_case__	( self					:			Any,lowercase_					:			Union[str, Any],lowercase_					:			Dict,lowercase_					:			Dict,lowercase_					:			List[Any],lowercase_					:			Optional[int],lowercase_					:			Union[str, Any]						)->       Union[str, Any]:  # noqa: E741





        '''simple docstring'''







        if r < a or l > b:
            return True
        if l == r:
            A__        =  val
            return True
        A__        =  (l + r) // 2
        self.update_recursive(self.left(__SCREAMING_SNAKE_CASE						),__SCREAMING_SNAKE_CASE,__SCREAMING_SNAKE_CASE,__SCREAMING_SNAKE_CASE,__SCREAMING_SNAKE_CASE,__SCREAMING_SNAKE_CASE						)
        self.update_recursive(self.right(__SCREAMING_SNAKE_CASE						),mid + 1,__SCREAMING_SNAKE_CASE,__SCREAMING_SNAKE_CASE,__SCREAMING_SNAKE_CASE,__SCREAMING_SNAKE_CASE						)
        A__        =  max(self.st[self.left(__SCREAMING_SNAKE_CASE						)],self.st[self.right(__SCREAMING_SNAKE_CASE						)]						)
        return True


    def 		snake_case__	( self					:			int,lowercase_					:			Optional[Any],lowercase_					:			Union[str, Any]						)->       Union[str, Any]:





        '''simple docstring'''







        return self.query_recursive(1,0,self.N - 1,a - 1,b - 1						)


    def 		snake_case__	( self					:			List[Any],lowercase_					:			Any,lowercase_					:			Tuple,lowercase_					:			int,lowercase_					:			str,lowercase_					:			Union[str, Any]						)->       str:  # noqa: E741





        '''simple docstring'''







        if r < a or l > b:
            return -math.inf
        if l >= a and r <= b:
            return self.st[idx]
        A__        =  (l + r) // 2
        A__        =  self.query_recursive(self.left(__SCREAMING_SNAKE_CASE						),__SCREAMING_SNAKE_CASE,__SCREAMING_SNAKE_CASE,__SCREAMING_SNAKE_CASE,__SCREAMING_SNAKE_CASE						)
        A__        =  self.query_recursive(self.right(__SCREAMING_SNAKE_CASE						),mid + 1,__SCREAMING_SNAKE_CASE,__SCREAMING_SNAKE_CASE,__SCREAMING_SNAKE_CASE						)
        return max(__SCREAMING_SNAKE_CASE,__SCREAMING_SNAKE_CASE						)


    def 		snake_case__	( self					:			Union[str, Any]						)->       str:





        '''simple docstring'''







        A__        =  []
        for i in range(1,N + 1						):
            show_list += [self.query(__SCREAMING_SNAKE_CASE,__SCREAMING_SNAKE_CASE						)]
        print(__SCREAMING_SNAKE_CASE						)


if __name__ == "__main__":
     lowercase_									=    [1, 2, -4, 7, 3, -5, 6, 11, -20, 9, 14, 15, 5, 2, -8]
     lowercase_									=    15
     lowercase_									=    SegmentTree(A)
     print(segt.query(4, 6))
     print(segt.query(7, 11))
     print(segt.query(7, 12))
     segt.update(1, 3, 111)
     print(segt.query(1, 15))
     segt.update(7, 8, 235)
     segt.show_data()






def 	__snake_case      (     _UpperCAmelCase							):
    __a					=							1
    __a					=							0
    __a					=							1
    __a					=							1
    __a					=							3
    __a					=							3
    __a					=							limit
    __a					=							0

    __a					=							''''''
    while counter != decimal + 1:
        if 4 * q + r - t < n * t:
            result += str(_UpperCAmelCase							)
            if counter == 0:
                result += "."

            if decimal == counter:
                break

            counter += 1
            __a					=							10 * (r - n * t)
            __a					=							((10 * (3 * q + r)) // t) - 10 * n
            q *= 10
            __a					=							nr
        else:
            __a					=							(2 * q + r) * l
            __a					=							(q * (7 * k) + 2 + (r * l)) // (t * l)
            q *= k
            t *= l
            l += 2
            k += 1
            __a					=							nn
            __a					=							nr
    return result





def 	__snake_case      (     ):
    print(f'{calculate_pi(50							) = }'							)
    import doctest

    doctest.testmod()


if __name__ == "__main__":
 main()





