





from typing import Any, Callable, Dict, List, Optional, Union

import torch
from transformers import CLIPImageProcessor, CLIPTextModel, CLIPTokenizer

from diffusers import (
    AutoencoderKL,
    DDIMScheduler,
    DiffusionPipeline,
    LMSDiscreteScheduler,
    PNDMScheduler,
    StableDiffusionPipeline,
    UNetaDConditionModel,
)
from diffusers.pipelines.stable_diffusion import StableDiffusionPipelineOutput
from diffusers.pipelines.stable_diffusion.safety_checker import StableDiffusionSafetyChecker


A_												=     "CompVis/stable-diffusion-v1-1"
A_												=     "CompVis/stable-diffusion-v1-2"
A_												=     "CompVis/stable-diffusion-v1-3"
A_												=     "CompVis/stable-diffusion-v1-4"

class SCREAMING_SNAKE_CASE_ (					lowercase_   ):





					"""simple docstring"""


					def __init__( self	,  _lowerCAmelCase	,  _lowerCAmelCase	,  _lowerCAmelCase	,  _lowerCAmelCase	,  _lowerCAmelCase	,  _lowerCAmelCase	,  _lowerCAmelCase	,  _lowerCAmelCase = True	,  ):
										super()._init_()

										lowerCamelCase__       =       StableDiffusionPipeline.from_pretrained(_lowerCAmelCase	)
										lowerCamelCase__       =       StableDiffusionPipeline.from_pretrained(_lowerCAmelCase	)
										lowerCamelCase__       =       StableDiffusionPipeline.from_pretrained(_lowerCAmelCase	)
										lowerCamelCase__       =       StableDiffusionPipeline(
										    vae=_lowerCAmelCase	,  text_encoder=_lowerCAmelCase	,  tokenizer=_lowerCAmelCase	,  unet=_lowerCAmelCase	,  scheduler=_lowerCAmelCase	,  safety_checker=_lowerCAmelCase	,  feature_extractor=_lowerCAmelCase	,  requires_safety_checker=_lowerCAmelCase	,  )

										self.register_modules(pipelinea=self.pipea	,  pipelinea=self.pipea	,  pipelinea=self.pipea	,  pipelinea=self.pipea	)





					@property
					def 					__magic_name__ ( self	):
										return {k: getattr(self	,  _lowerCAmelCase	) for k in self.config.keys() if not k.startswith("_"	)}





					def 					__magic_name__ ( self	,  _lowerCAmelCase = "auto"	):
										if slice_size == "auto":
															# half the attention head size is usually a good trade-off between
															# speed and memory
															lowerCamelCase__       =       self.unet.config.attention_head_dim // 2
										self.unet.set_attention_slice(_lowerCAmelCase	)





					def 					__magic_name__ ( self	):
										self.enable_attention_slicing(_lowerCAmelCase	)





					@torch.no_grad()
					def 					__magic_name__ ( self	,  _lowerCAmelCase	,  _lowerCAmelCase = 512	,  _lowerCAmelCase = 512	,  _lowerCAmelCase = 50	,  _lowerCAmelCase = 7.5	,  _lowerCAmelCase = None	,  _lowerCAmelCase = 1	,  _lowerCAmelCase = 0.0	,  _lowerCAmelCase = None	,  _lowerCAmelCase = None	,  _lowerCAmelCase = "pil"	,  _lowerCAmelCase = True	,  _lowerCAmelCase = None	,  _lowerCAmelCase = 1	,  **_lowerCAmelCase	,  ):
										return self.pipea(
										    prompt=_lowerCAmelCase	,  height=_lowerCAmelCase	,  width=_lowerCAmelCase	,  num_inference_steps=_lowerCAmelCase	,  guidance_scale=_lowerCAmelCase	,  negative_prompt=_lowerCAmelCase	,  num_images_per_prompt=_lowerCAmelCase	,  eta=_lowerCAmelCase	,  generator=_lowerCAmelCase	,  latents=_lowerCAmelCase	,  output_type=_lowerCAmelCase	,  return_dict=_lowerCAmelCase	,  callback=_lowerCAmelCase	,  callback_steps=_lowerCAmelCase	,  **_lowerCAmelCase	,  )





					@torch.no_grad()
					def 					__magic_name__ ( self	,  _lowerCAmelCase	,  _lowerCAmelCase = 512	,  _lowerCAmelCase = 512	,  _lowerCAmelCase = 50	,  _lowerCAmelCase = 7.5	,  _lowerCAmelCase = None	,  _lowerCAmelCase = 1	,  _lowerCAmelCase = 0.0	,  _lowerCAmelCase = None	,  _lowerCAmelCase = None	,  _lowerCAmelCase = "pil"	,  _lowerCAmelCase = True	,  _lowerCAmelCase = None	,  _lowerCAmelCase = 1	,  **_lowerCAmelCase	,  ):
										return self.pipea(
										    prompt=_lowerCAmelCase	,  height=_lowerCAmelCase	,  width=_lowerCAmelCase	,  num_inference_steps=_lowerCAmelCase	,  guidance_scale=_lowerCAmelCase	,  negative_prompt=_lowerCAmelCase	,  num_images_per_prompt=_lowerCAmelCase	,  eta=_lowerCAmelCase	,  generator=_lowerCAmelCase	,  latents=_lowerCAmelCase	,  output_type=_lowerCAmelCase	,  return_dict=_lowerCAmelCase	,  callback=_lowerCAmelCase	,  callback_steps=_lowerCAmelCase	,  **_lowerCAmelCase	,  )





					@torch.no_grad()
					def 					__magic_name__ ( self	,  _lowerCAmelCase	,  _lowerCAmelCase = 512	,  _lowerCAmelCase = 512	,  _lowerCAmelCase = 50	,  _lowerCAmelCase = 7.5	,  _lowerCAmelCase = None	,  _lowerCAmelCase = 1	,  _lowerCAmelCase = 0.0	,  _lowerCAmelCase = None	,  _lowerCAmelCase = None	,  _lowerCAmelCase = "pil"	,  _lowerCAmelCase = True	,  _lowerCAmelCase = None	,  _lowerCAmelCase = 1	,  **_lowerCAmelCase	,  ):
										return self.pipea(
										    prompt=_lowerCAmelCase	,  height=_lowerCAmelCase	,  width=_lowerCAmelCase	,  num_inference_steps=_lowerCAmelCase	,  guidance_scale=_lowerCAmelCase	,  negative_prompt=_lowerCAmelCase	,  num_images_per_prompt=_lowerCAmelCase	,  eta=_lowerCAmelCase	,  generator=_lowerCAmelCase	,  latents=_lowerCAmelCase	,  output_type=_lowerCAmelCase	,  return_dict=_lowerCAmelCase	,  callback=_lowerCAmelCase	,  callback_steps=_lowerCAmelCase	,  **_lowerCAmelCase	,  )





					@torch.no_grad()
					def 					__magic_name__ ( self	,  _lowerCAmelCase	,  _lowerCAmelCase = 512	,  _lowerCAmelCase = 512	,  _lowerCAmelCase = 50	,  _lowerCAmelCase = 7.5	,  _lowerCAmelCase = None	,  _lowerCAmelCase = 1	,  _lowerCAmelCase = 0.0	,  _lowerCAmelCase = None	,  _lowerCAmelCase = None	,  _lowerCAmelCase = "pil"	,  _lowerCAmelCase = True	,  _lowerCAmelCase = None	,  _lowerCAmelCase = 1	,  **_lowerCAmelCase	,  ):
										return self.pipea(
										    prompt=_lowerCAmelCase	,  height=_lowerCAmelCase	,  width=_lowerCAmelCase	,  num_inference_steps=_lowerCAmelCase	,  guidance_scale=_lowerCAmelCase	,  negative_prompt=_lowerCAmelCase	,  num_images_per_prompt=_lowerCAmelCase	,  eta=_lowerCAmelCase	,  generator=_lowerCAmelCase	,  latents=_lowerCAmelCase	,  output_type=_lowerCAmelCase	,  return_dict=_lowerCAmelCase	,  callback=_lowerCAmelCase	,  callback_steps=_lowerCAmelCase	,  **_lowerCAmelCase	,  )






					@torch.no_grad()
					def 					__magic_name__ ( self	,  _lowerCAmelCase	,  _lowerCAmelCase = 512	,  _lowerCAmelCase = 512	,  _lowerCAmelCase = 50	,  _lowerCAmelCase = 7.5	,  _lowerCAmelCase = None	,  _lowerCAmelCase = 1	,  _lowerCAmelCase = 0.0	,  _lowerCAmelCase = None	,  _lowerCAmelCase = None	,  _lowerCAmelCase = "pil"	,  _lowerCAmelCase = True	,  _lowerCAmelCase = None	,  _lowerCAmelCase = 1	,  **_lowerCAmelCase	,  ):
										lowerCamelCase__       =       "cuda" if torch.cuda.is_available() else "cpu"
										self.to(_lowerCAmelCase	)

										# Checks if the height and width are divisible by 8 or not
										if height % 8 != 0 or width % 8 != 0:
															raise ValueError(F"`height` and `width` must be divisible by 8 but are {height} and {width}."	)

										# Get first result from Stable Diffusion Checkpoint v1.1
										lowerCamelCase__       =       self.textaimg_sda_a(
										    prompt=_lowerCAmelCase	,  height=_lowerCAmelCase	,  width=_lowerCAmelCase	,  num_inference_steps=_lowerCAmelCase	,  guidance_scale=_lowerCAmelCase	,  negative_prompt=_lowerCAmelCase	,  num_images_per_prompt=_lowerCAmelCase	,  eta=_lowerCAmelCase	,  generator=_lowerCAmelCase	,  latents=_lowerCAmelCase	,  output_type=_lowerCAmelCase	,  return_dict=_lowerCAmelCase	,  callback=_lowerCAmelCase	,  callback_steps=_lowerCAmelCase	,  **_lowerCAmelCase	,  )

										# Get first result from Stable Diffusion Checkpoint v1.2
										lowerCamelCase__       =       self.textaimg_sda_a(
										    prompt=_lowerCAmelCase	,  height=_lowerCAmelCase	,  width=_lowerCAmelCase	,  num_inference_steps=_lowerCAmelCase	,  guidance_scale=_lowerCAmelCase	,  negative_prompt=_lowerCAmelCase	,  num_images_per_prompt=_lowerCAmelCase	,  eta=_lowerCAmelCase	,  generator=_lowerCAmelCase	,  latents=_lowerCAmelCase	,  output_type=_lowerCAmelCase	,  return_dict=_lowerCAmelCase	,  callback=_lowerCAmelCase	,  callback_steps=_lowerCAmelCase	,  **_lowerCAmelCase	,  )

										# Get first result from Stable Diffusion Checkpoint v1.3
										lowerCamelCase__       =       self.textaimg_sda_a(
										    prompt=_lowerCAmelCase	,  height=_lowerCAmelCase	,  width=_lowerCAmelCase	,  num_inference_steps=_lowerCAmelCase	,  guidance_scale=_lowerCAmelCase	,  negative_prompt=_lowerCAmelCase	,  num_images_per_prompt=_lowerCAmelCase	,  eta=_lowerCAmelCase	,  generator=_lowerCAmelCase	,  latents=_lowerCAmelCase	,  output_type=_lowerCAmelCase	,  return_dict=_lowerCAmelCase	,  callback=_lowerCAmelCase	,  callback_steps=_lowerCAmelCase	,  **_lowerCAmelCase	,  )

										# Get first result from Stable Diffusion Checkpoint v1.4
										lowerCamelCase__       =       self.textaimg_sda_a(
										    prompt=_lowerCAmelCase	,  height=_lowerCAmelCase	,  width=_lowerCAmelCase	,  num_inference_steps=_lowerCAmelCase	,  guidance_scale=_lowerCAmelCase	,  negative_prompt=_lowerCAmelCase	,  num_images_per_prompt=_lowerCAmelCase	,  eta=_lowerCAmelCase	,  generator=_lowerCAmelCase	,  latents=_lowerCAmelCase	,  output_type=_lowerCAmelCase	,  return_dict=_lowerCAmelCase	,  callback=_lowerCAmelCase	,  callback_steps=_lowerCAmelCase	,  **_lowerCAmelCase	,  )

										# Get all result images into a single list and pass it via StableDiffusionPipelineOutput for final result
										return StableDiffusionPipelineOutput([resa[0], resa[0], resa[0], resa[0]]	)








A_												=     {str(digit): digit**5 for digit in range(1_0)}





def    __UpperCamelCase      (    a) ->int:
					return sum(DIGITS_FIFTH_POWER[digit] for digit in str(a))





def    __UpperCamelCase      (    ) ->int:
					return sum(
					    number
					    for number in range(1000,     1000000)
					    if number == digits_fifth_powers_sum(a))


if __name__ == "__main__":
						print(solution())

