





'''simple docstring'''




import multiprocessing
import os
from typing import BinaryIO, Optional, Union

import fsspec

from .. import Dataset, Features, NamedSplit, config
from ..formatting import query_table
from ..packaged_modules.json.json import Json
from ..utils import logging
from ..utils.typing import NestedDataStructureLike, PathLike
from .abc import AbstractDatasetReader




class      UpperCamelCase__					(					lowercase_			):




					"""simple docstring"""


					def __init__(						self				:			str      ,						lowerCamelCase_				:			NestedDataStructureLike[PathLike]      ,						lowerCamelCase_				:			Optional[NamedSplit] = None      ,						lowerCamelCase_				:			Optional[Features] = None      ,						lowerCamelCase_				:			str = None      ,						lowerCamelCase_				:			bool = False      ,						lowerCamelCase_				:			bool = False      ,						lowerCamelCase_				:			Optional[str] = None      ,						lowerCamelCase_				:			Optional[int] = None      ,						**lowerCamelCase_				:			str      ,						):

							'''simple docstring'''



							super().__init__(
							    lowerCamelCase_      ,						split=lowerCamelCase_      ,						features=lowerCamelCase_      ,						cache_dir=lowerCamelCase_      ,						keep_in_memory=lowerCamelCase_      ,						streaming=lowerCamelCase_      ,						num_proc=lowerCamelCase_      ,						**lowerCamelCase_      ,						)
							SCREAMING_SNAKE_CASE :				int		=			field
							SCREAMING_SNAKE_CASE :				Optional[Any]		=			path_or_paths if isinstance(lowerCamelCase_      ,						lowerCamelCase_						) else {self.split: path_or_paths}
							SCREAMING_SNAKE_CASE :				str		=			Json(
							    cache_dir=lowerCamelCase_      ,						data_files=lowerCamelCase_      ,						features=lowerCamelCase_      ,						field=lowerCamelCase_      ,						**lowerCamelCase_      ,						)



					def lowerCamelCase_			(						self				:			Tuple						):

							'''simple docstring'''



							if self.streaming:
									SCREAMING_SNAKE_CASE :				str		=			self.builder.as_streaming_dataset(split=self.split						)
							# Build regular (map-style) dataset
							else:
									SCREAMING_SNAKE_CASE :				Union[str, Any]		=			None
									SCREAMING_SNAKE_CASE :				str		=			None
									SCREAMING_SNAKE_CASE :				Union[str, Any]		=			None
									SCREAMING_SNAKE_CASE :				List[str]		=			None

									self.builder.download_and_prepare(
									    download_config=lowerCamelCase_      ,						download_mode=lowerCamelCase_      ,						verification_mode=lowerCamelCase_      ,						base_path=lowerCamelCase_      ,						num_proc=self.num_proc      ,						)
									SCREAMING_SNAKE_CASE :				Any		=			self.builder.as_dataset(
									    split=self.split      ,						verification_mode=lowerCamelCase_      ,						in_memory=self.keep_in_memory						)
							return dataset







class      UpperCamelCase__					:




					"""simple docstring"""


					def __init__(						self				:			Optional[Any]      ,						lowerCamelCase_				:			Dataset      ,						lowerCamelCase_				:			Union[PathLike, BinaryIO]      ,						lowerCamelCase_				:			Optional[int] = None      ,						lowerCamelCase_				:			Optional[int] = None      ,						**lowerCamelCase_				:			Any      ,						):

							'''simple docstring'''



							if num_proc is not None and num_proc <= 0:
									raise ValueError(f'''num_proc {num_proc} must be an integer > 0.'''						)

							SCREAMING_SNAKE_CASE :				List[Any]		=			dataset
							SCREAMING_SNAKE_CASE :				Dict		=			path_or_buf
							SCREAMING_SNAKE_CASE :				List[str]		=			batch_size if batch_size else config.DEFAULT_MAX_BATCH_SIZE
							SCREAMING_SNAKE_CASE :				int		=			num_proc
							SCREAMING_SNAKE_CASE :				List[Any]		=			"""utf-8"""
							SCREAMING_SNAKE_CASE :				List[Any]		=			to_json_kwargs


					def lowerCamelCase_			(						self				:			Any						):

							'''simple docstring'''



							SCREAMING_SNAKE_CASE :				List[Any]		=			self.to_json_kwargs.pop("""path_or_buf"""      ,						lowerCamelCase_						)
							SCREAMING_SNAKE_CASE :				Optional[int]		=			self.to_json_kwargs.pop("""orient"""      ,						"""records"""						)
							SCREAMING_SNAKE_CASE :				Optional[Any]		=			self.to_json_kwargs.pop("""lines"""      ,						True if orient == """records""" else False						)
							SCREAMING_SNAKE_CASE :				Any		=			self.to_json_kwargs.pop("""index"""      ,						False if orient in ["""split""", """table"""] else True						)
							SCREAMING_SNAKE_CASE :				int		=			self.to_json_kwargs.pop("""compression"""      ,						lowerCamelCase_						)

							if compression not in [None, "infer", "gzip", "bz2", "xz"]:
									raise NotImplementedError(f'''`datasets` currently does not support {compression} compression'''						)

							if isinstance(self.path_or_buf      ,						(str, bytes, os.PathLike)						):
									with fsspec.open(self.path_or_buf      ,						"""wb"""      ,						compression=lowerCamelCase_						) as buffer:
											SCREAMING_SNAKE_CASE :				Any		=			self._write(file_obj=lowerCamelCase_      ,						orient=lowerCamelCase_      ,						lines=lowerCamelCase_      ,						index=lowerCamelCase_      ,						**self.to_json_kwargs						)
							else:
									if compression:
											raise NotImplementedError(
											    f'''The compression parameter is not supported when writing to a buffer, but compression={compression}'''
											    """ was passed. Please provide a local path instead."""						)
									SCREAMING_SNAKE_CASE :				List[Any]		=			self._write(
									    file_obj=self.path_or_buf      ,						orient=lowerCamelCase_      ,						lines=lowerCamelCase_      ,						index=lowerCamelCase_      ,						**self.to_json_kwargs						)
							return written


					def lowerCamelCase_			(						self				:			Any      ,						lowerCamelCase_				:			str						):

							'''simple docstring'''



							SCREAMING_SNAKE_CASE,							SCREAMING_SNAKE_CASE,							SCREAMING_SNAKE_CASE,							SCREAMING_SNAKE_CASE,							SCREAMING_SNAKE_CASE :				Tuple		=			args

							SCREAMING_SNAKE_CASE :				Union[str, Any]		=			query_table(
							    table=self.dataset.data      ,						key=slice(lowerCamelCase_      ,						offset + self.batch_size						)      ,						indices=self.dataset._indices      ,						)
							SCREAMING_SNAKE_CASE :				Dict		=			batch.to_pandas().to_json(
							    path_or_buf=lowerCamelCase_      ,						orient=lowerCamelCase_      ,						lines=lowerCamelCase_      ,						index=lowerCamelCase_      ,						**lowerCamelCase_						)
							if not json_str.endswith("""\n"""						):
									json_str += "\n"
							return json_str.encode(self.encoding						)



					def lowerCamelCase_			(						self				:			int      ,						lowerCamelCase_				:			BinaryIO      ,						lowerCamelCase_				:			Any      ,						lowerCamelCase_				:			Optional[Any]      ,						lowerCamelCase_				:			Any      ,						**lowerCamelCase_				:			Any      ,						):

							'''simple docstring'''



							SCREAMING_SNAKE_CASE :				int		=			0

							if self.num_proc is None or self.num_proc == 1:
									for offset in logging.tqdm(
									    range(0      ,						len(self.dataset						)      ,						self.batch_size						)      ,						unit="""ba"""      ,						disable=not logging.is_progress_bar_enabled()      ,						desc="""Creating json from Arrow format"""      ,						):
											SCREAMING_SNAKE_CASE :				Optional[Any]		=			self._batch_json((offset, orient, lines, index, to_json_kwargs)						)
											written += file_obj.write(lowerCamelCase_						)
							else:
									SCREAMING_SNAKE_CASE,							SCREAMING_SNAKE_CASE :				int		=			len(self.dataset						), self.batch_size
									with multiprocessing.Pool(self.num_proc						) as pool:
											for json_str in logging.tqdm(
											    pool.imap(
											        self._batch_json      ,						[(offset, orient, lines, index, to_json_kwargs) for offset in range(0      ,						lowerCamelCase_      ,						lowerCamelCase_						)]      ,						)      ,						total=(num_rows // batch_size) + 1 if num_rows % batch_size else num_rows // batch_size      ,						unit="""ba"""      ,						disable=not logging.is_progress_bar_enabled()      ,						desc="""Creating json from Arrow format"""      ,						):
													written += file_obj.write(lowerCamelCase_						)

							return written










'''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())))



