





from __future__ import annotations

from sys import maxsize
from typing import Generic, TypeVar

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



def A_      (						A__							)    ->						Tuple:
       return (position - 1) // 2



def A_      (						A__							)    ->						Union[str, Any]:
       return (2 * position) + 1



def A_      (						A__							)    ->						int:
       return (2 * position) + 2





class 					A__       (				Generic[T]      ):




   """simple docstring"""



   def __init__(   self)     ->		None:







          '''simple docstring'''

          a__		:      list[tuple[T, int]]					=							[]
          a__		:      dict[T, int]					=							{}
          a__		:      int					=							0

   def __len__(   self)     ->		int:







          '''simple docstring'''

          return self.elements

   def __repr__(   self)     ->		str:







          '''simple docstring'''

          return str(self.heap)

   def 				__lowercase						(   self)     ->		bool:







          '''simple docstring'''

          return self.elements == 0

   def 				__lowercase						(   self   ,    lowercase   ,    lowercase)     ->		None:







          '''simple docstring'''

          self.heap.append((elem, weight))
          a__		:      Any					=							self.elements
          self.elements += 1
          self._bubble_up(lowercase)

   def 				__lowercase						(   self)     ->		T:







          '''simple docstring'''

          if self.elements > 1:
                 self._swap_nodes(0   ,    self.elements - 1)
          a__		:      Dict					=							self.heap.pop()
          del self.position_map[elem]
          self.elements -= 1
          if self.elements > 0:
                 a__		:      Tuple					=							self.heap[0]
                 self._bubble_down(lowercase)
          return elem

   def 				__lowercase						(   self   ,    lowercase   ,    lowercase)     ->		None:







          '''simple docstring'''

          a__		:      List[Any]					=							self.position_map[elem]
          a__		:      Tuple					=							(elem, weight)
          if position > 0:
                 a__		:      List[str]					=							get_parent_position(lowercase)
                 a__		:      int					=							self.heap[parent_position]
                 if parent_weight > weight:
                        self._bubble_up(lowercase)
                 else:
                        self._bubble_down(lowercase)
          else:
                 self._bubble_down(lowercase)

   def 				__lowercase						(   self   ,    lowercase)     ->		None:







          '''simple docstring'''

          a__		:      int					=							self.position_map[elem]
          if curr_pos == 0:
                 return None
          a__		:      List[Any]					=							get_parent_position(lowercase)
          a__		:      Dict					=							self.heap[curr_pos]
          a__		:      List[Any]					=							self.heap[parent_position]
          if parent_weight > weight:
                 self._swap_nodes(lowercase   ,    lowercase)
                 return self._bubble_up(lowercase)
          return None

   def 				__lowercase						(   self   ,    lowercase)     ->		None:







          '''simple docstring'''

          a__		:      int					=							self.position_map[elem]
          a__		:      Dict					=							self.heap[curr_pos]
          a__		:      str					=							get_child_left_position(lowercase)
          a__		:      int					=							get_child_right_position(lowercase)
          if child_left_position < self.elements and child_right_position < self.elements:
                 a__		:      Optional[Any]					=							self.heap[child_left_position]
                 a__		:      Dict					=							self.heap[child_right_position]
                 if child_right_weight < child_left_weight and child_right_weight < weight:
                        self._swap_nodes(lowercase   ,    lowercase)
                        return self._bubble_down(lowercase)
          if child_left_position < self.elements:
                 a__		:      Dict					=							self.heap[child_left_position]
                 if child_left_weight < weight:
                        self._swap_nodes(lowercase   ,    lowercase)
                        return self._bubble_down(lowercase)
          else:
                 return None
          if child_right_position < self.elements:
                 a__		:      int					=							self.heap[child_right_position]
                 if child_right_weight < weight:
                        self._swap_nodes(lowercase   ,    lowercase)
                        return self._bubble_down(lowercase)
          return None

   def 				__lowercase						(   self   ,    lowercase   ,    lowercase)     ->		None:







          '''simple docstring'''

          a__		:      List[str]					=							self.heap[nodea_pos][0]
          a__		:      Dict					=							self.heap[nodea_pos][0]
          a__		:      List[Any]					=							(
              self.heap[nodea_pos],
              self.heap[nodea_pos],
          )
          a__		:      Optional[Any]					=							nodea_pos
          a__		:      int					=							nodea_pos





class 					A__       (				Generic[T]      ):




   """simple docstring"""



   def __init__(   self)     ->		None:







          '''simple docstring'''

          a__		:      dict[T, dict[T, int]]					=							{}
          a__		:      int					=							0

   def __repr__(   self)     ->		str:







          '''simple docstring'''

          return str(self.connections)

   def __len__(   self)     ->		int:







          '''simple docstring'''

          return self.nodes

   def 				__lowercase						(   self   ,    lowercase)     ->		None:







          '''simple docstring'''

          if node not in self.connections:
                 a__		:      int					=							{}
                 self.nodes += 1

   def 				__lowercase						(   self   ,    lowercase   ,    lowercase   ,    lowercase)     ->		None:







          '''simple docstring'''

          self.add_node(lowercase)
          self.add_node(lowercase)
          a__		:      List[Any]					=							weight
          a__		:      int					=							weight



def A_      (						A__						, )    ->						Optional[int]:
       a__		:      dict[T, int]					=							{node: maxsize for node in graph.connections}
       a__		:      dict[T, T | None]					=							{node: None for node in graph.connections}

       a__		:      MinPriorityQueue[T]					=							MinPriorityQueue()
       for node, weight in dist.items():
              priority_queue.push(__snake_case						, __snake_case							)

       if priority_queue.is_empty():
              return dist, parent

       # initialization
       a__		:      List[str]					=							priority_queue.extract_min()
       a__		:      str					=							0
       for neighbour in graph.connections[node]:
              if dist[neighbour] > dist[node] + graph.connections[node][neighbour]:
                     a__		:      List[Any]					=							dist[node] + graph.connections[node][neighbour]
                     priority_queue.update_key(__snake_case						, dist[neighbour]							)
                     a__		:      Tuple					=							node

    # running prim's algorithm
       while not priority_queue.is_empty():
              a__		:      List[Any]					=							priority_queue.extract_min()
              for neighbour in graph.connections[node]:
                     if dist[neighbour] > dist[node] + graph.connections[node][neighbour]:
                            a__		:      Tuple					=							dist[node] + graph.connections[node][neighbour]
                            priority_queue.update_key(__snake_case						, dist[neighbour]							)
                            a__		:      List[str]					=							node
       return dist, parent






"""simple docstring"""
from math import isqrt, loga

def 				_snake_case      (   __snake_case							:      int   ):




   """simple docstring"""







   _lowerCamelCase	:					List[str]   =		[True] * max_number
   for i in range(2						, isqrt(max_number - 1   ) + 1   ):
      if is_prime[i]:
         for j in range(i**2						, __snake_case						, __snake_case   ):
            _lowerCamelCase	:					Optional[int]   =		False

   return [i for i in range(2						, __snake_case   ) if is_prime[i]]

def 				_snake_case      (   __snake_case							:      int = 800800						, __snake_case							:      int = 800800   ):




   """simple docstring"""







   _lowerCamelCase	:					Union[str, Any]   =		degree * loga(__snake_case   )
   _lowerCamelCase	:					Union[str, Any]   =		int(__snake_case   )
   _lowerCamelCase	:					Dict   =		calculate_prime_numbers(__snake_case   )

   _lowerCamelCase	:					Optional[int]   =		0
   _lowerCamelCase	:					Any   =		0
   _lowerCamelCase	:					Any   =		len(__snake_case   ) - 1
   while left < right:
      while (
          prime_numbers[right] * loga(prime_numbers[left]   )
          + prime_numbers[left] * loga(prime_numbers[right]   )
          > upper_bound
      ):
         right -= 1
      hybrid_integers_count += right - left
      left += 1

   return hybrid_integers_count


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

