






"""simple docstring"""





from math import ceil







def      lowerCamelCase__       (							_lowerCamelCase       :		int = 1001 )      ->				int:
  lowerCamelCase_         =						1

  for i in range(1		,				int(ceil(n / 2.0 ) ) ):
    lowerCamelCase_         =						2 * i + 1
    lowerCamelCase_         =						2 * i
    lowerCamelCase_         =						total + 4 * odd**2 - 6 * even

  return total


if __name__ == "__main__":
  import sys

  if len(sys.argv) == 1:
    print(solution())
  else:
    try:
      _SCREAMING_SNAKE_CASE					:				Dict					    =						int(sys.argv[1])
      print(solution(n))
    except ValueError:
      print('''Invalid entry - please enter a number''')












"""simple docstring"""





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


_SCREAMING_SNAKE_CASE					:				Union[str, Any]					    =						'''CompVis/stable-diffusion-v1-1'''
_SCREAMING_SNAKE_CASE					:				Optional[Any]					    =						'''CompVis/stable-diffusion-v1-2'''
_SCREAMING_SNAKE_CASE					:				int					    =						'''CompVis/stable-diffusion-v1-3'''
_SCREAMING_SNAKE_CASE					:				str					    =						'''CompVis/stable-diffusion-v1-4'''






class      a						(					__snake_case		):






    def __init__(       self     :							int       ,						__SCREAMING_SNAKE_CASE     :							AutoencoderKL       ,						__SCREAMING_SNAKE_CASE     :							CLIPTextModel       ,						__SCREAMING_SNAKE_CASE     :							CLIPTokenizer       ,						__SCREAMING_SNAKE_CASE     :							UNetaDConditionModel       ,						__SCREAMING_SNAKE_CASE     :							Union[DDIMScheduler, PNDMScheduler, LMSDiscreteScheduler]       ,						__SCREAMING_SNAKE_CASE     :							StableDiffusionSafetyChecker       ,						__SCREAMING_SNAKE_CASE     :							CLIPImageProcessor       ,						__SCREAMING_SNAKE_CASE     :							bool = True       ,						)     ->		List[str]:
      super()._init_()

      lowerCamelCase_         =						StableDiffusionPipeline.from_pretrained(__SCREAMING_SNAKE_CASE					)
      lowerCamelCase_         =						StableDiffusionPipeline.from_pretrained(__SCREAMING_SNAKE_CASE					)
      lowerCamelCase_         =						StableDiffusionPipeline.from_pretrained(__SCREAMING_SNAKE_CASE					)
      lowerCamelCase_         =						StableDiffusionPipeline(
          vae=__SCREAMING_SNAKE_CASE       ,						text_encoder=__SCREAMING_SNAKE_CASE       ,						tokenizer=__SCREAMING_SNAKE_CASE       ,						unet=__SCREAMING_SNAKE_CASE       ,						scheduler=__SCREAMING_SNAKE_CASE       ,						safety_checker=__SCREAMING_SNAKE_CASE       ,						feature_extractor=__SCREAMING_SNAKE_CASE       ,						requires_safety_checker=__SCREAMING_SNAKE_CASE       ,						)

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






    @property
    def    UpperCamelCase       (       self     :							List[str]					)     ->		Dict[str, Any]:
      return {k: getattr(self       ,						__SCREAMING_SNAKE_CASE					) for k in self.config.keys() if not k.startswith('_'					)}






    def    UpperCamelCase       (       self     :							int       ,						__SCREAMING_SNAKE_CASE     :							Optional[Union[str, int]] = "auto"					)     ->		Any:
      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(__SCREAMING_SNAKE_CASE					)






    def    UpperCamelCase       (       self     :							Any					)     ->		List[Any]:
      self.enable_attention_slicing(__SCREAMING_SNAKE_CASE					)






    @torch.no_grad()
    def    UpperCamelCase       (       self     :							Any       ,						__SCREAMING_SNAKE_CASE     :							Union[str, List[str]]       ,						__SCREAMING_SNAKE_CASE     :							int = 512       ,						__SCREAMING_SNAKE_CASE     :							int = 512       ,						__SCREAMING_SNAKE_CASE     :							int = 50       ,						__SCREAMING_SNAKE_CASE     :							float = 7.5       ,						__SCREAMING_SNAKE_CASE     :							Optional[Union[str, List[str]]] = None       ,						__SCREAMING_SNAKE_CASE     :							Optional[int] = 1       ,						__SCREAMING_SNAKE_CASE     :							float = 0.0       ,						__SCREAMING_SNAKE_CASE     :							Optional[torch.Generator] = None       ,						__SCREAMING_SNAKE_CASE     :							Optional[torch.FloatTensor] = None       ,						__SCREAMING_SNAKE_CASE     :							Optional[str] = "pil"       ,						__SCREAMING_SNAKE_CASE     :							bool = True       ,						__SCREAMING_SNAKE_CASE     :							Optional[Callable[[int, int, torch.FloatTensor], None]] = None       ,						__SCREAMING_SNAKE_CASE     :							int = 1       ,						**__SCREAMING_SNAKE_CASE     :							int       ,						)     ->		Tuple:
      return self.pipea(
          prompt=__SCREAMING_SNAKE_CASE       ,						height=__SCREAMING_SNAKE_CASE       ,						width=__SCREAMING_SNAKE_CASE       ,						num_inference_steps=__SCREAMING_SNAKE_CASE       ,						guidance_scale=__SCREAMING_SNAKE_CASE       ,						negative_prompt=__SCREAMING_SNAKE_CASE       ,						num_images_per_prompt=__SCREAMING_SNAKE_CASE       ,						eta=__SCREAMING_SNAKE_CASE       ,						generator=__SCREAMING_SNAKE_CASE       ,						latents=__SCREAMING_SNAKE_CASE       ,						output_type=__SCREAMING_SNAKE_CASE       ,						return_dict=__SCREAMING_SNAKE_CASE       ,						callback=__SCREAMING_SNAKE_CASE       ,						callback_steps=__SCREAMING_SNAKE_CASE       ,						**__SCREAMING_SNAKE_CASE       ,						)






    @torch.no_grad()
    def    UpperCamelCase       (       self     :							List[str]       ,						__SCREAMING_SNAKE_CASE     :							Union[str, List[str]]       ,						__SCREAMING_SNAKE_CASE     :							int = 512       ,						__SCREAMING_SNAKE_CASE     :							int = 512       ,						__SCREAMING_SNAKE_CASE     :							int = 50       ,						__SCREAMING_SNAKE_CASE     :							float = 7.5       ,						__SCREAMING_SNAKE_CASE     :							Optional[Union[str, List[str]]] = None       ,						__SCREAMING_SNAKE_CASE     :							Optional[int] = 1       ,						__SCREAMING_SNAKE_CASE     :							float = 0.0       ,						__SCREAMING_SNAKE_CASE     :							Optional[torch.Generator] = None       ,						__SCREAMING_SNAKE_CASE     :							Optional[torch.FloatTensor] = None       ,						__SCREAMING_SNAKE_CASE     :							Optional[str] = "pil"       ,						__SCREAMING_SNAKE_CASE     :							bool = True       ,						__SCREAMING_SNAKE_CASE     :							Optional[Callable[[int, int, torch.FloatTensor], None]] = None       ,						__SCREAMING_SNAKE_CASE     :							int = 1       ,						**__SCREAMING_SNAKE_CASE     :							List[str]       ,						)     ->		Optional[int]:
      return self.pipea(
          prompt=__SCREAMING_SNAKE_CASE       ,						height=__SCREAMING_SNAKE_CASE       ,						width=__SCREAMING_SNAKE_CASE       ,						num_inference_steps=__SCREAMING_SNAKE_CASE       ,						guidance_scale=__SCREAMING_SNAKE_CASE       ,						negative_prompt=__SCREAMING_SNAKE_CASE       ,						num_images_per_prompt=__SCREAMING_SNAKE_CASE       ,						eta=__SCREAMING_SNAKE_CASE       ,						generator=__SCREAMING_SNAKE_CASE       ,						latents=__SCREAMING_SNAKE_CASE       ,						output_type=__SCREAMING_SNAKE_CASE       ,						return_dict=__SCREAMING_SNAKE_CASE       ,						callback=__SCREAMING_SNAKE_CASE       ,						callback_steps=__SCREAMING_SNAKE_CASE       ,						**__SCREAMING_SNAKE_CASE       ,						)






    @torch.no_grad()
    def    UpperCamelCase       (       self     :							Optional[Any]       ,						__SCREAMING_SNAKE_CASE     :							Union[str, List[str]]       ,						__SCREAMING_SNAKE_CASE     :							int = 512       ,						__SCREAMING_SNAKE_CASE     :							int = 512       ,						__SCREAMING_SNAKE_CASE     :							int = 50       ,						__SCREAMING_SNAKE_CASE     :							float = 7.5       ,						__SCREAMING_SNAKE_CASE     :							Optional[Union[str, List[str]]] = None       ,						__SCREAMING_SNAKE_CASE     :							Optional[int] = 1       ,						__SCREAMING_SNAKE_CASE     :							float = 0.0       ,						__SCREAMING_SNAKE_CASE     :							Optional[torch.Generator] = None       ,						__SCREAMING_SNAKE_CASE     :							Optional[torch.FloatTensor] = None       ,						__SCREAMING_SNAKE_CASE     :							Optional[str] = "pil"       ,						__SCREAMING_SNAKE_CASE     :							bool = True       ,						__SCREAMING_SNAKE_CASE     :							Optional[Callable[[int, int, torch.FloatTensor], None]] = None       ,						__SCREAMING_SNAKE_CASE     :							int = 1       ,						**__SCREAMING_SNAKE_CASE     :							Optional[int]       ,						)     ->		Tuple:
      return self.pipea(
          prompt=__SCREAMING_SNAKE_CASE       ,						height=__SCREAMING_SNAKE_CASE       ,						width=__SCREAMING_SNAKE_CASE       ,						num_inference_steps=__SCREAMING_SNAKE_CASE       ,						guidance_scale=__SCREAMING_SNAKE_CASE       ,						negative_prompt=__SCREAMING_SNAKE_CASE       ,						num_images_per_prompt=__SCREAMING_SNAKE_CASE       ,						eta=__SCREAMING_SNAKE_CASE       ,						generator=__SCREAMING_SNAKE_CASE       ,						latents=__SCREAMING_SNAKE_CASE       ,						output_type=__SCREAMING_SNAKE_CASE       ,						return_dict=__SCREAMING_SNAKE_CASE       ,						callback=__SCREAMING_SNAKE_CASE       ,						callback_steps=__SCREAMING_SNAKE_CASE       ,						**__SCREAMING_SNAKE_CASE       ,						)






    @torch.no_grad()
    def    UpperCamelCase       (       self     :							Tuple       ,						__SCREAMING_SNAKE_CASE     :							Union[str, List[str]]       ,						__SCREAMING_SNAKE_CASE     :							int = 512       ,						__SCREAMING_SNAKE_CASE     :							int = 512       ,						__SCREAMING_SNAKE_CASE     :							int = 50       ,						__SCREAMING_SNAKE_CASE     :							float = 7.5       ,						__SCREAMING_SNAKE_CASE     :							Optional[Union[str, List[str]]] = None       ,						__SCREAMING_SNAKE_CASE     :							Optional[int] = 1       ,						__SCREAMING_SNAKE_CASE     :							float = 0.0       ,						__SCREAMING_SNAKE_CASE     :							Optional[torch.Generator] = None       ,						__SCREAMING_SNAKE_CASE     :							Optional[torch.FloatTensor] = None       ,						__SCREAMING_SNAKE_CASE     :							Optional[str] = "pil"       ,						__SCREAMING_SNAKE_CASE     :							bool = True       ,						__SCREAMING_SNAKE_CASE     :							Optional[Callable[[int, int, torch.FloatTensor], None]] = None       ,						__SCREAMING_SNAKE_CASE     :							int = 1       ,						**__SCREAMING_SNAKE_CASE     :							Tuple       ,						)     ->		Tuple:
      return self.pipea(
          prompt=__SCREAMING_SNAKE_CASE       ,						height=__SCREAMING_SNAKE_CASE       ,						width=__SCREAMING_SNAKE_CASE       ,						num_inference_steps=__SCREAMING_SNAKE_CASE       ,						guidance_scale=__SCREAMING_SNAKE_CASE       ,						negative_prompt=__SCREAMING_SNAKE_CASE       ,						num_images_per_prompt=__SCREAMING_SNAKE_CASE       ,						eta=__SCREAMING_SNAKE_CASE       ,						generator=__SCREAMING_SNAKE_CASE       ,						latents=__SCREAMING_SNAKE_CASE       ,						output_type=__SCREAMING_SNAKE_CASE       ,						return_dict=__SCREAMING_SNAKE_CASE       ,						callback=__SCREAMING_SNAKE_CASE       ,						callback_steps=__SCREAMING_SNAKE_CASE       ,						**__SCREAMING_SNAKE_CASE       ,						)






    @torch.no_grad()
    def    UpperCamelCase       (       self     :							Dict       ,						__SCREAMING_SNAKE_CASE     :							Union[str, List[str]]       ,						__SCREAMING_SNAKE_CASE     :							int = 512       ,						__SCREAMING_SNAKE_CASE     :							int = 512       ,						__SCREAMING_SNAKE_CASE     :							int = 50       ,						__SCREAMING_SNAKE_CASE     :							float = 7.5       ,						__SCREAMING_SNAKE_CASE     :							Optional[Union[str, List[str]]] = None       ,						__SCREAMING_SNAKE_CASE     :							Optional[int] = 1       ,						__SCREAMING_SNAKE_CASE     :							float = 0.0       ,						__SCREAMING_SNAKE_CASE     :							Optional[torch.Generator] = None       ,						__SCREAMING_SNAKE_CASE     :							Optional[torch.FloatTensor] = None       ,						__SCREAMING_SNAKE_CASE     :							Optional[str] = "pil"       ,						__SCREAMING_SNAKE_CASE     :							bool = True       ,						__SCREAMING_SNAKE_CASE     :							Optional[Callable[[int, int, torch.FloatTensor], None]] = None       ,						__SCREAMING_SNAKE_CASE     :							int = 1       ,						**__SCREAMING_SNAKE_CASE     :							int       ,						)     ->		str:
      lowerCamelCase_         =						'cuda' if torch.cuda.is_available() else 'cpu'
      self.to(__SCREAMING_SNAKE_CASE					)

      # 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=__SCREAMING_SNAKE_CASE       ,						height=__SCREAMING_SNAKE_CASE       ,						width=__SCREAMING_SNAKE_CASE       ,						num_inference_steps=__SCREAMING_SNAKE_CASE       ,						guidance_scale=__SCREAMING_SNAKE_CASE       ,						negative_prompt=__SCREAMING_SNAKE_CASE       ,						num_images_per_prompt=__SCREAMING_SNAKE_CASE       ,						eta=__SCREAMING_SNAKE_CASE       ,						generator=__SCREAMING_SNAKE_CASE       ,						latents=__SCREAMING_SNAKE_CASE       ,						output_type=__SCREAMING_SNAKE_CASE       ,						return_dict=__SCREAMING_SNAKE_CASE       ,						callback=__SCREAMING_SNAKE_CASE       ,						callback_steps=__SCREAMING_SNAKE_CASE       ,						**__SCREAMING_SNAKE_CASE       ,						)

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

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

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

      # 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]]					)




