




'''simple docstring'''






from __future__ import annotations

import random
from collections.abc import Iterable
from typing import Any, Generic, TypeVar

A_ 			=		TypeVar("T", bound=bool)






class 					lowercase_			(	Generic[T]       ):





     def __init__(    self    :				Optional[int]    ,       __lowerCamelCase    :				T ):
           snake_case__					:      T  			=						value
           snake_case__					:      RandomizedHeapNode[T] | None  			=						None
           snake_case__					:      RandomizedHeapNode[T] | None  			=						None





     @property
     def  _lowerCAmelCase			(    self    :				Any ):
           return self._value





     @staticmethod
     def  _lowerCAmelCase			(    __lowerCamelCase    :				RandomizedHeapNode[T] | None    ,       __lowerCamelCase    :				RandomizedHeapNode[T] | None ):



           if not roota:
                 return roota

           if not roota:
                 return roota

           if roota.value > roota.value:
                 snake_case__					:      List[str]  			=						roota, roota

           if random.choice([True, False] ):
                 snake_case__					:      List[Any]  			=						roota.right, roota.left

           snake_case__					:      Optional[Any]  			=						RandomizedHeapNode.merge(roota.left    ,       __lowerCamelCase )

           return roota






class 					lowercase_			(	Generic[T]       ):





     def __init__(    self    :				Union[str, Any]    ,       __lowerCamelCase    :				Iterable[T] | None = () ):
           snake_case__					:      RandomizedHeapNode[T] | None  			=						None

           if data:
                 for item in data:
                       self.insert(__lowerCamelCase )





     def  _lowerCAmelCase			(    self    :				Dict    ,       __lowerCamelCase    :				T ):
           snake_case__					:      Optional[int]  			=						RandomizedHeapNode.merge(self._root    ,       RandomizedHeapNode(__lowerCamelCase ) )





     def  _lowerCAmelCase			(    self    :				List[str] ):
           snake_case__					:      Tuple  			=						self.top()

           if self._root is None:
                 return None

           snake_case__					:      Optional[Any]  			=						RandomizedHeapNode.merge(self._root.left    ,       self._root.right )

           return result





     def  _lowerCAmelCase			(    self    :				Optional[int] ):



           if not self._root:
                 raise IndexError('Can\'t get top element for the empty heap.' )
           return self._root.value





     def  _lowerCAmelCase			(    self    :				List[Any] ):
           snake_case__					:      Any  			=						None





     def  _lowerCAmelCase			(    self    :				Union[str, Any] ):
           snake_case__					:      List[str]  			=						[]
           while self:
                 result.append(self.pop() )

           return result





     def __bool__(    self    :				List[Any] ):
           return self._root is not None


if __name__ == "__main__":
      import doctest

      doctest.testmod()







'''simple docstring'''






def 		UpperCamelCase__			(		__SCREAMING_SNAKE_CASE = 1000		)						->      int:
      snake_case__					:      List[str]  			=						0
      snake_case__					:      int  			=						(n - 1) // 3
      total += ((terms) * (6 + (terms - 1) * 3)) // 2  # total of an A.P.
      snake_case__					:      Optional[Any]  			=						(n - 1) // 5
      total += ((terms) * (10 + (terms - 1) * 5)) // 2
      snake_case__					:      Tuple  			=						(n - 1) // 15
      total -= ((terms) * (30 + (terms - 1) * 15)) // 2
      return total


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