"""simple docstring"""







def   __UpperCAmelCase				(    UpperCAmelCase_    :				list[int]  )							->			Dict:

	'''simple docstring'''





	__snake_case			:							Optional[Any]      		= []
	if len(__lowerCAmelCase  ) == 1:
		return [nums.copy()]
	for _ in range(len(__lowerCAmelCase  )  ):
		__snake_case			:							Dict      		= nums.pop(0  )
		__snake_case			:							List[str]      		= permute(__lowerCAmelCase  )
		for perm in permutations:
			perm.append(__lowerCAmelCase  )
		result.extend(__lowerCAmelCase  )
		nums.append(__lowerCAmelCase  )
	return result
def   __UpperCAmelCase				(    UpperCAmelCase_    :				Optional[int]  )							->			Optional[int]:

	'''simple docstring'''





	def backtrack(UpperCAmelCase_    :				Any  ):
		if start == len(__lowerCAmelCase  ) - 1:
			output.append(nums[:]  )
		else:
			for i in range(__lowerCAmelCase			,							len(__lowerCAmelCase  )  ):
				__snake_case		,				__snake_case			:							List[str]      		= nums[i], nums[start]
				backtrack(start + 1  )
				__snake_case		,				__snake_case			:							int      		= nums[i], nums[start]  # backtrack

	__snake_case			:							Optional[int]      		= []
	backtrack(0  )
	return output


if __name__ == "__main__":
	import doctest

	# use res to print the data in permute2 function
	_a     :     Optional[Any]= permutea([1, 2, 3])
	print(res)
	doctest.testmod()









import math






def 							__lowercase   ( __lowerCAmelCase							:				int   ):
							a__             =     [True] * n
							a__             =     False
							a__             =     False
							a__             =     True

							for i in range(3					,    int(n**0.5 + 1   )					,    2   ):
														a__             =     i * 2
														while index < n:
																					a__             =     False
																					a__             =     index + i

							a__             =     [2]

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

							return primes






def 							__lowercase   ( __lowerCAmelCase							:				int = 9_9_9_9_6_6_6_6_3_3_3_3   ):
							a__             =     math.floor(math.sqrt(__lowerCAmelCase   )   ) + 1_0_0
							a__             =     prime_sieve(__lowerCAmelCase   )

							a__             =     0
							a__             =     0
							a__             =     primes[prime_index]

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

														a__             =     last_prime**2
														a__             =     next_prime**2

														# Get numbers divisible by lps(current)
														a__             =     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)
														a__             =     upper_bound - next_prime
														while current > lower_bound:
																					matches_sum += current
																					current -= next_prime

														# Remove the numbers divisible by both ups and lps
														a__             =     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
														a__             =     next_prime
														prime_index += 1

							return matches_sum


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




