
'''simple docstring'''
import gc
import unittest

from diffusers import FlaxControlNetModel, FlaxStableDiffusionControlNetPipeline
from diffusers.utils import is_flax_available, load_image, slow
from diffusers.utils.testing_utils import require_flax


if is_flax_available():
    import jax
    import jax.numpy as jnp
    from flax.jax_utils import replicate
    from flax.training.common_utils import shard


@slow
@require_flax
class       _lowerCAmelCase   (   unittest.TestCase				):







       '''simple docstring'''

       def 	lowercase							(self  )					->       Optional[int]:
              # clean up the VRAM after each test
              super().tearDown()
              gc.collect()

       def 	lowercase							(self  )					->       Dict:
              _snake_case,							_snake_case       =  FlaxControlNetModel.from_pretrained(
                  """lllyasviel/sd-controlnet-canny"""  ,  from_pt=UpperCAmelCase  ,  dtype=jnp.bfloataa  )
              _snake_case,							_snake_case       =  FlaxStableDiffusionControlNetPipeline.from_pretrained(
                  """runwayml/stable-diffusion-v1-5"""  ,  controlnet=UpperCAmelCase  ,  from_pt=UpperCAmelCase  ,  dtype=jnp.bfloataa  )
              _snake_case       =  controlnet_params

              _snake_case       =  """bird"""
              _snake_case       =  jax.device_count()
              _snake_case       =  pipe.prepare_text_inputs([prompts] * num_samples  )

              _snake_case       =  load_image(
                  """https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main/sd_controlnet/bird_canny.png"""  )
              _snake_case       =  pipe.prepare_image_inputs([canny_image] * num_samples  )

              _snake_case       =  jax.random.PRNGKey(0  )
              _snake_case       =  jax.random.split(UpperCAmelCase  ,  jax.device_count()  )

              _snake_case       =  replicate(UpperCAmelCase  )
              _snake_case       =  shard(UpperCAmelCase  )
              _snake_case       =  shard(UpperCAmelCase  )

              _snake_case       =  pipe(
                  prompt_ids=UpperCAmelCase  ,  image=UpperCAmelCase  ,  params=UpperCAmelCase  ,  prng_seed=UpperCAmelCase  ,  num_inference_steps=50  ,  jit=UpperCAmelCase  ,  ).images
              assert images.shape == (jax.device_count(), 1, 768, 512, 3)

              _snake_case       =  images.reshape((images.shape[0] * images.shape[1],) + images.shape[-3:]  )
              _snake_case       =  images[0, 253:256, 253:256, -1]

              _snake_case       =  jnp.asarray(jax.device_get(image_slice.flatten()  )  )
              _snake_case       =  jnp.array(
                  [0.16_7969, 0.11_6699, 0.08_1543, 0.15_4297, 0.13_2812, 0.10_8887, 0.16_9922, 0.16_9922, 0.20_5078]  )
              print(f"""output_slice: {output_slice}"""  )
              assert jnp.abs(output_slice - expected_slice  ).max() < 1e-2





       def 	lowercase							(self  )					->       Optional[int]:
              _snake_case,							_snake_case       =  FlaxControlNetModel.from_pretrained(
                  """lllyasviel/sd-controlnet-openpose"""  ,  from_pt=UpperCAmelCase  ,  dtype=jnp.bfloataa  )
              _snake_case,							_snake_case       =  FlaxStableDiffusionControlNetPipeline.from_pretrained(
                  """runwayml/stable-diffusion-v1-5"""  ,  controlnet=UpperCAmelCase  ,  from_pt=UpperCAmelCase  ,  dtype=jnp.bfloataa  )
              _snake_case       =  controlnet_params

              _snake_case       =  """Chef in the kitchen"""
              _snake_case       =  jax.device_count()
              _snake_case       =  pipe.prepare_text_inputs([prompts] * num_samples  )

              _snake_case       =  load_image(
                  """https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main/sd_controlnet/pose.png"""  )
              _snake_case       =  pipe.prepare_image_inputs([pose_image] * num_samples  )

              _snake_case       =  jax.random.PRNGKey(0  )
              _snake_case       =  jax.random.split(UpperCAmelCase  ,  jax.device_count()  )

              _snake_case       =  replicate(UpperCAmelCase  )
              _snake_case       =  shard(UpperCAmelCase  )
              _snake_case       =  shard(UpperCAmelCase  )

              _snake_case       =  pipe(
                  prompt_ids=UpperCAmelCase  ,  image=UpperCAmelCase  ,  params=UpperCAmelCase  ,  prng_seed=UpperCAmelCase  ,  num_inference_steps=50  ,  jit=UpperCAmelCase  ,  ).images
              assert images.shape == (jax.device_count(), 1, 768, 512, 3)

              _snake_case       =  images.reshape((images.shape[0] * images.shape[1],) + images.shape[-3:]  )
              _snake_case       =  images[0, 253:256, 253:256, -1]

              _snake_case       =  jnp.asarray(jax.device_get(image_slice.flatten()  )  )
              _snake_case       =  jnp.array(
                  [[0.27_1484, 0.26_1719, 0.27_5391, 0.27_7344, 0.27_9297, 0.29_1016, 0.29_4922, 0.30_2734, 0.30_2734]]  )
              print(f"""output_slice: {output_slice}"""  )
              assert jnp.abs(output_slice - expected_slice  ).max() < 1e-2

'''simple docstring'''
from math import sqrt






def  __SCREAMING_SNAKE_CASE				(  _SCREAMING_SNAKE_CASE				):
							_snake_case       =  0
							for i in range(1							, int(sqrt(_SCREAMING_SNAKE_CASE				) + 1				)				):
														if n % i == 0 and i != sqrt(_SCREAMING_SNAKE_CASE				):
																					total += i + n // i
														elif i == sqrt(_SCREAMING_SNAKE_CASE				):
																					total += i
							return total - n






def  __SCREAMING_SNAKE_CASE				(  _SCREAMING_SNAKE_CASE = 1_0000				):
							_snake_case       =  sum(
							    i
							    for i in range(1							, _SCREAMING_SNAKE_CASE				)
							    if sum_of_divisors(sum_of_divisors(_SCREAMING_SNAKE_CASE				)				) == i and sum_of_divisors(_SCREAMING_SNAKE_CASE				) != i				)
							return total


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