



'''simple docstring'''

import unittest
from queue import Empty
from threading import Thread

from transformers import AutoTokenizer, TextIteratorStreamer, TextStreamer, is_torch_available
from transformers.testing_utils import CaptureStdout, require_torch, torch_device

from ..test_modeling_common import ids_tensor


if is_torch_available():
							import torch

							from transformers import AutoModelForCausalLM

@require_torch
class      __magic_name__						(   unittest.TestCase       ):







							def 							__lowercase      (							self :	int		):
									_a					:				List[str]				=							AutoTokenizer.from_pretrained('hf-internal-testing/tiny-random-gpt2'		)
									_a					:				Optional[int]				=							AutoModelForCausalLM.from_pretrained('hf-internal-testing/tiny-random-gpt2'		).to(_snake_case		)
									_a					:				Dict				=							-1

									_a					:				int				=							ids_tensor((1, 5)     ,vocab_size=model.config.vocab_size		).to(_snake_case		)
									_a					:				str				=							model.generate(_snake_case     ,max_new_tokens=10     ,do_sample=_snake_case		)
									_a					:				List[Any]				=							tokenizer.decode(greedy_ids[0]		)

									with CaptureStdout() as cs:
											_a					:				int				=							TextStreamer(_snake_case		)
											model.generate(_snake_case     ,max_new_tokens=10     ,do_sample=_snake_case     ,streamer=_snake_case		)
									# The greedy text should be printed to stdout, except for the final "\n" in the streamer
									_a					:				int				=							cs.out[:-1]

									self.assertEqual(_snake_case     ,_snake_case		)







							def 							__lowercase      (							self :	int		):
									_a					:				Tuple				=							AutoTokenizer.from_pretrained('hf-internal-testing/tiny-random-gpt2'		)
									_a					:				Optional[Any]				=							AutoModelForCausalLM.from_pretrained('hf-internal-testing/tiny-random-gpt2'		).to(_snake_case		)
									_a					:				int				=							-1

									_a					:				Union[str, Any]				=							ids_tensor((1, 5)     ,vocab_size=model.config.vocab_size		).to(_snake_case		)
									_a					:				Optional[int]				=							model.generate(_snake_case     ,max_new_tokens=10     ,do_sample=_snake_case		)
									_a					:				Optional[Any]				=							tokenizer.decode(greedy_ids[0]		)

									_a					:				Tuple				=							TextIteratorStreamer(_snake_case		)
									_a					:				Optional[Any]				=							{'input_ids': input_ids, 'max_new_tokens': 10, 'do_sample': False, 'streamer': streamer}
									_a					:				List[str]				=							Thread(target=model.generate     ,kwargs=_snake_case		)
									thread.start()
									_a					:				Tuple				=							''
									for new_text in streamer:
											streamer_text += new_text

									self.assertEqual(_snake_case     ,_snake_case		)







							def 							__lowercase      (							self :	str		):
									_a					:				List[str]				=							AutoTokenizer.from_pretrained('hf-internal-testing/tiny-random-gpt2'		)
									_a					:				Any				=							AutoModelForCausalLM.from_pretrained('hf-internal-testing/tiny-random-gpt2'		).to(_snake_case		)
									_a					:				str				=							-1

									_a					:				Optional[Any]				=							ids_tensor((1, 5)     ,vocab_size=model.config.vocab_size		).to(_snake_case		)
									_a					:				Tuple				=							model.generate(_snake_case     ,max_new_tokens=10     ,do_sample=_snake_case		)
									_a					:				List[str]				=							greedy_ids[:, input_ids.shape[1] :]
									_a					:				Tuple				=							tokenizer.decode(new_greedy_ids[0]		)

									with CaptureStdout() as cs:
											_a					:				Tuple				=							TextStreamer(_snake_case     ,skip_prompt=_snake_case		)
											model.generate(_snake_case     ,max_new_tokens=10     ,do_sample=_snake_case     ,streamer=_snake_case		)
									# The greedy text should be printed to stdout, except for the final "\n" in the streamer
									_a					:				Any				=							cs.out[:-1]

									self.assertEqual(_snake_case     ,_snake_case		)







							def 							__lowercase      (							self :	str		):
									_a					:				str				=							AutoTokenizer.from_pretrained('distilgpt2'		)
									_a					:				Tuple				=							AutoModelForCausalLM.from_pretrained('distilgpt2'		).to(_snake_case		)
									_a					:				int				=							-1

									_a					:				Tuple				=							torch.ones((1, 5)     ,device=_snake_case		).long() * model.config.bos_token_id
									with CaptureStdout() as cs:
											_a					:				int				=							TextStreamer(_snake_case     ,skip_special_tokens=_snake_case		)
											model.generate(_snake_case     ,max_new_tokens=1     ,do_sample=_snake_case     ,streamer=_snake_case		)

									# The prompt contains a special token, so the streamer should not print it. As such, the output text, when
									# re-tokenized, must only contain one token
									_a					:				int				=							cs.out[:-1]  # Remove the final "\n"
									_a					:				List[str]				=							tokenizer(_snake_case     ,return_tensors='pt'		)
									self.assertEqual(streamer_text_tokenized.input_ids.shape     ,(1, 1)		)







							def 							__lowercase      (							self :	List[str]		):
									_a					:				int				=							AutoTokenizer.from_pretrained('hf-internal-testing/tiny-random-gpt2'		)
									_a					:				Tuple				=							AutoModelForCausalLM.from_pretrained('hf-internal-testing/tiny-random-gpt2'		).to(_snake_case		)
									_a					:				List[Any]				=							-1

									_a					:				Optional[int]				=							ids_tensor((1, 5)     ,vocab_size=model.config.vocab_size		).to(_snake_case		)
									_a					:				Optional[Any]				=							TextIteratorStreamer(_snake_case     ,timeout=0.0_01		)
									_a					:				Optional[int]				=							{'input_ids': input_ids, 'max_new_tokens': 10, 'do_sample': False, 'streamer': streamer}
									_a					:				Any				=							Thread(target=model.generate     ,kwargs=_snake_case		)
									thread.start()

									# The streamer will timeout after 0.001 seconds, so an exception will be raised
									with self.assertRaises(_snake_case		):
											_a					:				Optional[Any]				=							''
											for new_text in streamer:
													streamer_text += new_text









'''simple docstring'''

from math import sqrt



def 					__lowerCamelCase					(				lowerCAmelCase_  )      ->				int:
		_a					:				Dict				=							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 					__lowerCamelCase					(				lowerCAmelCase_ = 10000  )      ->				int:
		_a					:				Union[str, Any]				=							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())))




