



"""simple docstring"""
from copy import deepcopy



class    SCREAMING_SNAKE_CASE__						:

   def __init__(     self   ,  _SCREAMING_SNAKE_CASE = None   ,  _SCREAMING_SNAKE_CASE = None		)						->   None:





    '''simple docstring'''




    if arr is None and size is not None:
     UpperCAmelCase			:      List[Any]			=			size
     UpperCAmelCase			:      List[Any]			=			[0] * size
    elif arr is not None:
     self.init(_SCREAMING_SNAKE_CASE		)
    else:
     raise ValueError("""Either arr or size must be specified"""		)

   def 			SCREAMING_SNAKE_CASE  (     self   ,  _SCREAMING_SNAKE_CASE		)						->   None:





    '''simple docstring'''




    UpperCAmelCase			:      List[Any]			=			len(_SCREAMING_SNAKE_CASE		)
    UpperCAmelCase			:      Union[str, Any]			=			deepcopy(_SCREAMING_SNAKE_CASE		)
    for i in range(1   ,  self.size		):
     UpperCAmelCase			:      Optional[Any]			=			self.next_(_SCREAMING_SNAKE_CASE		)
     if j < self.size:
      self.tree[j] += self.tree[i]

   def 			SCREAMING_SNAKE_CASE  (     self		)						->   list[int]:





    '''simple docstring'''




    UpperCAmelCase			:      Any			=			self.tree[:]
    for i in range(self.size - 1   ,  0   ,  -1		):
     UpperCAmelCase			:      int			=			self.next_(_SCREAMING_SNAKE_CASE		)
     if j < self.size:
      arr[j] -= arr[i]
    return arr

   @staticmethod
   def 			SCREAMING_SNAKE_CASE  (     _SCREAMING_SNAKE_CASE		)						->   int:





    '''simple docstring'''




    return index + (index & (-index))

   @staticmethod
   def 			SCREAMING_SNAKE_CASE  (     _SCREAMING_SNAKE_CASE		)						->   int:





    '''simple docstring'''




    return index - (index & (-index))

   def 			SCREAMING_SNAKE_CASE  (     self   ,  _SCREAMING_SNAKE_CASE   ,  _SCREAMING_SNAKE_CASE		)						->   None:





    '''simple docstring'''




    if index == 0:
     self.tree[0] += value
     return
    while index < self.size:
     self.tree[index] += value
     UpperCAmelCase			:      Dict			=			self.next_(_SCREAMING_SNAKE_CASE		)

   def 			SCREAMING_SNAKE_CASE  (     self   ,  _SCREAMING_SNAKE_CASE   ,  _SCREAMING_SNAKE_CASE		)						->   None:





    '''simple docstring'''




    self.add(_SCREAMING_SNAKE_CASE   ,  value - self.get(_SCREAMING_SNAKE_CASE		)		)

   def 			SCREAMING_SNAKE_CASE  (     self   ,  _SCREAMING_SNAKE_CASE		)						->   int:





    '''simple docstring'''




    if right == 0:
     return 0
    UpperCAmelCase			:      List[str]			=			self.tree[0]
    right -= 1  # make right inclusive
    while right > 0:
     result += self.tree[right]
     UpperCAmelCase			:      int			=			self.prev(_SCREAMING_SNAKE_CASE		)
    return result

   def 			SCREAMING_SNAKE_CASE  (     self   ,  _SCREAMING_SNAKE_CASE   ,  _SCREAMING_SNAKE_CASE		)						->   int:





    '''simple docstring'''




    return self.prefix(_SCREAMING_SNAKE_CASE		) - self.prefix(_SCREAMING_SNAKE_CASE		)

   def 			SCREAMING_SNAKE_CASE  (     self   ,  _SCREAMING_SNAKE_CASE		)						->   int:





    '''simple docstring'''




    return self.query(_SCREAMING_SNAKE_CASE   ,  index + 1		)




   def 			SCREAMING_SNAKE_CASE  (     self   ,  _SCREAMING_SNAKE_CASE		)						->   int:





    '''simple docstring'''




    value -= self.tree[0]
    if value < 0:
     return -1

    UpperCAmelCase			:      Union[str, Any]			=			1  # Largest power of 2 <= size
    while j * 2 < self.size:
     j *= 2

    UpperCAmelCase			:      int			=			0

    while j > 0:
     if i + j < self.size and self.tree[i + j] <= value:
      value -= self.tree[i + j]
      i += j
     j //= 2
    return i


if __name__ == "__main__":
      import doctest

      doctest.testmod()





"""simple docstring"""
from __future__ import annotations

from collections.abc import Generator

def    _snake_case		(		):
 UpperCAmelCase			:      dict[int, int]			=			{}
 UpperCAmelCase			:      str			=			2
 while True:
  UpperCAmelCase			:      List[str]			=			factor_map.pop(UpperCamelCase    ,	UpperCamelCase		)
  if factor:
   UpperCAmelCase			:      Dict			=			factor + prime
   while x in factor_map:
    x += factor
   UpperCAmelCase			:      Tuple			=			factor
  else:
   UpperCAmelCase			:      Optional[int]			=			prime
   yield prime
  prime += 1

def    _snake_case		(		UpperCamelCase		:	float = 1e1_0		):
 UpperCAmelCase			:      Tuple			=			sieve()

 UpperCAmelCase			:      Optional[Any]			=			1
 while True:
  UpperCAmelCase			:      List[str]			=			next(UpperCamelCase		)
  if (2 * prime * n) > limit:
   return n
  # Ignore the next prime as the reminder will be 2.
  next(UpperCamelCase		)
  n += 2


if __name__ == "__main__":
      print(solution())
