
'''simple docstring'''

import unittest

import torch
from torch import nn

from accelerate.test_utils import require_cuda
from accelerate.utils.memory import find_executable_batch_size, release_memory







def 	A  (   )       ->							List[Any]:







			'''simple docstring'''



			raise RuntimeError("CUDA out of memory."   )






class  A  (						nn.Module     ):





	def __init__(       self      :							Dict				):


				"""simple docstring"""

				super().__init__()
				lowerCAmelCase__										=				nn.Linear(3   ,				4				)
				lowerCAmelCase__										=				nn.BatchNormad(4				)
				lowerCAmelCase__										=				nn.Linear(4   ,				5				)







	def 				__SCREAMING_SNAKE_CASE	(       self      :							List[Any]   ,				__magic_name__      :							int				):


				"""simple docstring"""

				return self.lineara(self.batchnorm(self.lineara(__magic_name__				)				)				)






class  A  (						unittest.TestCase     ):





	def 				__SCREAMING_SNAKE_CASE	(       self      :							Dict				):


				"""simple docstring"""

				lowerCAmelCase__										=				[]

				@find_executable_batch_size(starting_batch_size=128				)
				def mock_training_loop_function(__magic_name__      :							Optional[int]				):
							nonlocal batch_sizes
							batch_sizes.append(__magic_name__				)
							if batch_size != 8:
										raise_fake_out_of_memory()

				mock_training_loop_function()
				self.assertListEqual(__magic_name__   ,				[128, 64, 32, 16, 8]				)





	def 				__SCREAMING_SNAKE_CASE	(       self      :							Union[str, Any]				):


				"""simple docstring"""

				lowerCAmelCase__										=				[]

				@find_executable_batch_size(starting_batch_size=128				)
				def mock_training_loop_function(__magic_name__      :							Tuple   ,				__magic_name__      :							Tuple				):
							nonlocal batch_sizes
							batch_sizes.append(__magic_name__				)
							if batch_size != 8:
										raise_fake_out_of_memory()
							return batch_size, arga

				lowerCAmelCase__						,lowerCAmelCase__										=				mock_training_loop_function("hello"				)
				self.assertListEqual(__magic_name__   ,				[128, 64, 32, 16, 8]				)
				self.assertListEqual([bs, arga]   ,				[8, "hello"]				)





	def 				__SCREAMING_SNAKE_CASE	(       self      :							Dict				):


				"""simple docstring"""

				@find_executable_batch_size(starting_batch_size=0				)
				def mock_training_loop_function(__magic_name__      :							Optional[int]				):
							pass

				with self.assertRaises(__magic_name__				) as cm:
							mock_training_loop_function()
							self.assertIn("No executable batch size found, reached zero."   ,				cm.exception.args[0]				)





	def 				__SCREAMING_SNAKE_CASE	(       self      :							Any				):


				"""simple docstring"""

				@find_executable_batch_size(starting_batch_size=16				)
				def mock_training_loop_function(__magic_name__      :							Optional[Any]				):
							if batch_size > 0:
										raise_fake_out_of_memory()
							pass

				with self.assertRaises(__magic_name__				) as cm:
							mock_training_loop_function()
							self.assertIn("No executable batch size found, reached zero."   ,				cm.exception.args[0]				)





	def 				__SCREAMING_SNAKE_CASE	(       self      :							List[str]				):


				"""simple docstring"""

				@find_executable_batch_size(starting_batch_size=128				)
				def mock_training_loop_function(__magic_name__      :							Tuple   ,				__magic_name__      :							int   ,				__magic_name__      :							Union[str, Any]				):
							if batch_size != 8:
										raise raise_fake_out_of_memory()

				with self.assertRaises(__magic_name__				) as cm:
							mock_training_loop_function(128   ,				"hello"   ,				"world"				)
							self.assertIn("Batch size was passed into `f`"   ,				cm.exception.args[0]				)
							self.assertIn("`f(arg1='hello', arg2='world')"   ,				cm.exception.args[0]				)





	def 				__SCREAMING_SNAKE_CASE	(       self      :							Union[str, Any]				):


				"""simple docstring"""

				@find_executable_batch_size(starting_batch_size=16				)
				def mock_training_loop_function(__magic_name__      :							Optional[Any]				):
							raise ValueError("Oops, we had an error!"				)

				with self.assertRaises(__magic_name__				) as cm:
							mock_training_loop_function()
							self.assertIn("Oops, we had an error!"   ,				cm.exception.args[0]				)







	@require_cuda
	def 				__SCREAMING_SNAKE_CASE	(       self      :							List[str]				):


				"""simple docstring"""

				lowerCAmelCase__										=				torch.cuda.memory_allocated()
				lowerCAmelCase__										=				ModelForTest()
				model.cuda()
				self.assertGreater(torch.cuda.memory_allocated()   ,				__magic_name__				)
				lowerCAmelCase__										=				release_memory(__magic_name__				)
				self.assertEqual(torch.cuda.memory_allocated()   ,				__magic_name__				)












'''simple docstring'''




from math import sqrt



def 		__A		(  lowerCamelCase_	):


		"""simple docstring"""



		SCREAMING_SNAKE_CASE :				str		=			0
		for i in range(1			,			int(sqrt(lowerCamelCase_	) + 1	)	):
				if n % i == 0 and i != sqrt(lowerCamelCase_	):
						total += i + n // i
				elif i == sqrt(lowerCamelCase_	):
						total += i
		return total - n



def 		__A		(  lowerCamelCase_ = 1_00_00	):


		"""simple docstring"""



		SCREAMING_SNAKE_CASE :				str		=			sum(
		    i
		    for i in range(1			,			lowerCamelCase_	)
		    if sum_of_divisors(sum_of_divisors(lowerCamelCase_	)	) == i and sum_of_divisors(lowerCamelCase_	) != i	)
		return total


if __name__ == "__main__":
							print(solution(int(str(input()).strip())))



