import math





def    __lowercase     (						lowerCamelCase					:     int	):
 UpperCamelCase_					:						Union[str, Any] =					[True] * n
 UpperCamelCase_					:						str =					False
 UpperCamelCase_					:						str =					False
 UpperCamelCase_					:						Any =					True

 for i in range(3  ,  int(n**0.5 + 1	)  ,  2	):
  UpperCamelCase_					:						Union[str, Any] =					i * 2
  while index < n:
   UpperCamelCase_					:						Tuple =					False
   UpperCamelCase_					:						Any =					index + i

 UpperCamelCase_					:						Optional[int] =					[2]

 for i in range(3  ,  lowerCamelCase  ,  2	):
  if is_prime[i]:
   primes.append(lowerCamelCase	)

 return primes





def    __lowercase     (						lowerCamelCase					:     int = 999966663333	):
 UpperCamelCase_					:						Union[str, Any] =					math.floor(math.sqrt(lowerCamelCase	)	) + 100
 UpperCamelCase_					:						str =					prime_sieve(lowerCamelCase	)

 UpperCamelCase_					:						Any =					0
 UpperCamelCase_					:						Dict =					0
 UpperCamelCase_					:						Optional[int] =					primes[prime_index]

 while (last_prime**2) <= limit:
  UpperCamelCase_					:						Tuple =					primes[prime_index + 1]

  UpperCamelCase_					:						Optional[Any] =					last_prime**2
  UpperCamelCase_					:						List[Any] =					next_prime**2

  # Get numbers divisible by lps(current)
  UpperCamelCase_					:						Tuple =					lower_bound + last_prime
  while upper_bound > current <= limit:
   matches_sum += current
   current += last_prime

  # Reset the upper_bound
  while (upper_bound - next_prime) > limit:
   upper_bound -= next_prime

  # Add the numbers divisible by ups(current)
  UpperCamelCase_					:						List[str] =					upper_bound - next_prime
  while current > lower_bound:
   matches_sum += current
   current -= next_prime

  # Remove the numbers divisible by both ups and lps
  UpperCamelCase_					:						Union[str, Any] =					0
  while upper_bound > current <= limit:
   if current <= lower_bound:
    # Increment the current number
    current += last_prime * next_prime
    continue

   if current > limit:
    break

   # Remove twice since it was added by both ups and lps
   matches_sum -= current * 2

   # Increment the current number
   current += last_prime * next_prime

  # Setup for next pair
  UpperCamelCase_					:						List[Any] =					next_prime
  prime_index += 1

 return matches_sum


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




from __future__ import annotations





def    __lowercase     (						lowerCamelCase					:     Optional[Any]  ,  lowerCamelCase					:     Dict  ,  lowerCamelCase					:     Union[str, Any]  ,  lowerCamelCase					:     List[str]	):  # noqa: E741
 while r - l > 1:
  UpperCamelCase_					:						Union[str, Any] =					(l + r) // 2
  if v[m] >= key:
   UpperCamelCase_					:						str =					m
  else:
   UpperCamelCase_					:						List[Any] =					m  # noqa: E741
 return r





def    __lowercase     (						lowerCamelCase					:     list[int]	):
 if len(lowerCamelCase	) == 0:
  return 0

 UpperCamelCase_					:						Tuple =					[0] * len(lowerCamelCase	)
 UpperCamelCase_					:						int =					1

 UpperCamelCase_					:						Dict =					v[0]

 for i in range(1  ,  len(lowerCamelCase	)	):
  if v[i] < tail[0]:
   UpperCamelCase_					:						Any =					v[i]
  elif v[i] > tail[length - 1]:
   UpperCamelCase_					:						Dict =					v[i]
   length += 1
  else:
   UpperCamelCase_					:						List[str] =					v[i]

 return length


if __name__ == "__main__":
   import doctest

   doctest.testmod()



