



import gc
import threading
import time

import psutil
import torch



class 	lowerCamelCase      :







					'''simple docstring'''







					def __init__(			self     ):
							UpperCAmelCase_						=				psutil.Process()
							UpperCAmelCase_						=				False



					def    A__		(			self     ):
							UpperCAmelCase_						=				-1

							while True:
									UpperCAmelCase_						=				max(self.process.memory_info().rss    ,	self.cpu_memory_peak     )

									# can't sleep or will not catch the peak right (this comment is here on purpose)
									if not self.peak_monitoring:
											break



					def    A__		(			self     ):
							UpperCAmelCase_						=				True
							UpperCAmelCase_						=				threading.Thread(target=self.peak_monitor     )
							UpperCAmelCase_						=				True
							self.thread.start()



					def    A__		(			self     ):
							UpperCAmelCase_						=				False
							self.thread.join()
							return self.cpu_memory_peak





SCREAMING_SNAKE_CASE     				=						PeakCPUMemory()







def snake_case__  (			)		->							List[Any]:
		# Time
		UpperCAmelCase_						=				{"time": time.time()}

		gc.collect()
		torch.cuda.empty_cache()

		# CPU mem
		UpperCAmelCase_						=				psutil.Process().memory_info().rss
		cpu_peak_tracker.start()

		# GPU mem
		for i in range(torch.cuda.device_count() ):
				UpperCAmelCase_						=				torch.cuda.memory_allocated(__SCREAMING_SNAKE_CASE )
		torch.cuda.reset_peak_memory_stats()

		return measures







def snake_case__  (			__SCREAMING_SNAKE_CASE )		->							int:
		# Time
		UpperCAmelCase_						=				{"time": time.time() - start_measures["time"]}

		gc.collect()
		torch.cuda.empty_cache()

		# CPU mem
		UpperCAmelCase_						=				(psutil.Process().memory_info().rss - start_measures["cpu"]) / 2**20
		UpperCAmelCase_						=				(cpu_peak_tracker.stop() - start_measures["cpu"]) / 2**20

		# GPU mem
		for i in range(torch.cuda.device_count() ):
				UpperCAmelCase_						=				(torch.cuda.memory_allocated(__SCREAMING_SNAKE_CASE ) - start_measures[str(__SCREAMING_SNAKE_CASE )]) / 2**20
				UpperCAmelCase_						=				(torch.cuda.max_memory_allocated(__SCREAMING_SNAKE_CASE ) - start_measures[str(__SCREAMING_SNAKE_CASE )]) / 2**20

		return measures







def snake_case__  (			__SCREAMING_SNAKE_CASE			,     __SCREAMING_SNAKE_CASE )		->							Optional[int]:
		print(f'''{description}:''' )
		print(f'''- Time: {measures['time']:.2f}s''' )
		for i in range(torch.cuda.device_count() ):
				print(f'''- GPU {i} allocated: {measures[str(__SCREAMING_SNAKE_CASE )]:.2f}MiB''' )
				UpperCAmelCase_						=				measures[f'''{i}-peak''']
				print(f'''- GPU {i} peak: {peak:.2f}MiB''' )
		print(f'''- CPU RAM allocated: {measures['cpu']:.2f}MiB''' )
		print(f'''- CPU RAM peak: {measures['cpu-peak']:.2f}MiB''' )






def snake_case__  (			__SCREAMING_SNAKE_CASE )		->							int:
		UpperCAmelCase_						=				1
		for i in range(1			,     num + 1 ):
				fact *= i
		return fact







def snake_case__  (			__SCREAMING_SNAKE_CASE )		->							int:
		UpperCAmelCase_						=				0
		while number > 0:
				UpperCAmelCase_						=				number % 10
				sum_of_digits += last_digit
				UpperCAmelCase_						=				number // 10  # Removing the last_digit from the given number
		return sum_of_digits







def snake_case__  (			__SCREAMING_SNAKE_CASE = 100 )		->							int:
		UpperCAmelCase_						=				factorial(__SCREAMING_SNAKE_CASE )
		UpperCAmelCase_						=				split_and_add(__SCREAMING_SNAKE_CASE )
		return result


if __name__ == "__main__":
			print(solution(int(input("Enter the Number: ").strip())))

