




from typing import Dict, List, Optional, Union

import numpy as np

from transformers.utils import is_vision_available
from transformers.utils.generic import TensorType

from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict
from ...image_transforms import (
    center_crop,
    get_resize_output_image_size,
    normalize,
    rescale,
    resize,
    to_channel_dimension_format,
)
from ...image_utils import (
    IMAGENET_STANDARD_MEAN,
    IMAGENET_STANDARD_STD,
    ChannelDimension,
    ImageInput,
    PILImageResampling,
    is_valid_image,
    to_numpy_array,
    valid_images,
)
from ...utils import logging


if is_vision_available():
						import PIL

SCREAMING_SNAKE_CASE:     Tuple									= logging.get_logger(__name__)


def 					_a							(					lowerCAmelCase )->	List[List[ImageInput]]:
		if isinstance(lowerCAmelCase    ,						(list, tuple) ) and isinstance(videos[0]    ,						(list, tuple) ) and is_valid_image(videos[0][0] ):
				return videos

		elif isinstance(lowerCAmelCase    ,						(list, tuple) ) and is_valid_image(videos[0] ):
				return [videos]

		elif is_valid_image(lowerCAmelCase ):
				return [[videos]]

		raise ValueError(F'''Could not make batched video from {videos}''' )




class    lowercase_		(SCREAMING_SNAKE_CASE__ ):
						lowerCAmelCase__			      =["pixel_values"]



						def __init__(			self	:   Dict					,							snake_case__	:   bool = True					,							snake_case__	:   Dict[str, int] = None					,							snake_case__	:   PILImageResampling = PILImageResampling.BILINEAR					,							snake_case__	:   bool = True					,							snake_case__	:   Dict[str, int] = None					,							snake_case__	:   bool = True					,							snake_case__	:   Union[int, float] = 1 / 2_55					,							snake_case__	:   bool = True					,							snake_case__	:   bool = True					,							snake_case__	:   Optional[Union[float, List[float]]] = None					,							snake_case__	:   Optional[Union[float, List[float]]] = None					,							**snake_case__	:   List[str]					,							):

								"""simple docstring"""

								super().__init__(**snake_case__  )
								SCREAMING_SNAKE_CASE_					      =							size if size is not None else {'shortest_edge': 2_56}
								SCREAMING_SNAKE_CASE_					      =							get_size_dict(snake_case__					,							default_to_square=snake_case__  )
								SCREAMING_SNAKE_CASE_					      =							crop_size if crop_size is not None else {'height': 2_24, 'width': 2_24}
								SCREAMING_SNAKE_CASE_					      =							get_size_dict(snake_case__					,							param_name='crop_size'  )

								SCREAMING_SNAKE_CASE_					      =							do_resize
								SCREAMING_SNAKE_CASE_					      =							size
								SCREAMING_SNAKE_CASE_					      =							do_center_crop
								SCREAMING_SNAKE_CASE_					      =							crop_size
								SCREAMING_SNAKE_CASE_					      =							resample
								SCREAMING_SNAKE_CASE_					      =							do_rescale
								SCREAMING_SNAKE_CASE_					      =							rescale_factor
								SCREAMING_SNAKE_CASE_					      =							offset
								SCREAMING_SNAKE_CASE_					      =							do_normalize
								SCREAMING_SNAKE_CASE_					      =							image_mean if image_mean is not None else IMAGENET_STANDARD_MEAN
								SCREAMING_SNAKE_CASE_					      =							image_std if image_std is not None else IMAGENET_STANDARD_STD



						def 	__a					(			self	:   Tuple					,							snake_case__	:   np.ndarray					,							snake_case__	:   Dict[str, int]					,							snake_case__	:   PILImageResampling = PILImageResampling.BILINEAR					,							snake_case__	:   Optional[Union[str, ChannelDimension]] = None					,							**snake_case__	:   Optional[Any]					,							):

								"""simple docstring"""

								SCREAMING_SNAKE_CASE_					      =							get_size_dict(snake_case__					,							default_to_square=snake_case__  )
								if "shortest_edge" in size:
										SCREAMING_SNAKE_CASE_					      =							get_resize_output_image_size(snake_case__					,							size['shortest_edge']					,							default_to_square=snake_case__  )
								elif "height" in size and "width" in size:
										SCREAMING_SNAKE_CASE_					      =							(size['height'], size['width'])
								else:
										raise ValueError(f'''Size must have \'height\' and \'width\' or \'shortest_edge\' as keys. Got {size.keys()}'''  )
								return resize(snake_case__					,							size=snake_case__					,							resample=snake_case__					,							data_format=snake_case__					,							**snake_case__  )



						def 	__a					(			self	:   List[str]					,							snake_case__	:   np.ndarray					,							snake_case__	:   Dict[str, int]					,							snake_case__	:   Optional[Union[str, ChannelDimension]] = None					,							**snake_case__	:   Union[str, Any]					,							):

								"""simple docstring"""

								SCREAMING_SNAKE_CASE_					      =							get_size_dict(snake_case__  )
								if "height" not in size or "width" not in size:
										raise ValueError(f'''Size must have \'height\' and \'width\' as keys. Got {size.keys()}'''  )
								return center_crop(snake_case__					,							size=(size['height'], size['width'])					,							data_format=snake_case__					,							**snake_case__  )



						def 	__a					(			self	:   Tuple					,							snake_case__	:   np.ndarray					,							snake_case__	:   Union[int, float]					,							snake_case__	:   bool = True					,							snake_case__	:   Optional[Union[str, ChannelDimension]] = None					,							**snake_case__	:   Tuple					,							):

								"""simple docstring"""

								SCREAMING_SNAKE_CASE_					      =							image.astype(np.floataa  )
								if offset:
										SCREAMING_SNAKE_CASE_					      =							image - (scale / 2)
								return rescale(snake_case__					,							scale=snake_case__					,							data_format=snake_case__					,							**snake_case__  )



						def 	__a					(			self	:   Any					,							snake_case__	:   np.ndarray					,							snake_case__	:   Union[float, List[float]]					,							snake_case__	:   Union[float, List[float]]					,							snake_case__	:   Optional[Union[str, ChannelDimension]] = None					,							**snake_case__	:   Any					,							):

								"""simple docstring"""

								return normalize(snake_case__					,							mean=snake_case__					,							std=snake_case__					,							data_format=snake_case__					,							**snake_case__  )



						def 	__a					(			self	:   int					,							snake_case__	:   ImageInput					,							snake_case__	:   bool = None					,							snake_case__	:   Dict[str, int] = None					,							snake_case__	:   PILImageResampling = None					,							snake_case__	:   bool = None					,							snake_case__	:   Dict[str, int] = None					,							snake_case__	:   bool = None					,							snake_case__	:   float = None					,							snake_case__	:   bool = None					,							snake_case__	:   bool = None					,							snake_case__	:   Optional[Union[float, List[float]]] = None					,							snake_case__	:   Optional[Union[float, List[float]]] = None					,							snake_case__	:   Optional[ChannelDimension] = ChannelDimension.FIRST					,							):

								"""simple docstring"""

								if do_resize and size is None or resample is None:
										raise ValueError('Size and resample must be specified if do_resize is True.'  )

								if do_center_crop and crop_size is None:
										raise ValueError('Crop size must be specified if do_center_crop is True.'  )

								if do_rescale and rescale_factor is None:
										raise ValueError('Rescale factor must be specified if do_rescale is True.'  )

								if do_normalize and (image_mean is None or image_std is None):
										raise ValueError('Image mean and std must be specified if do_normalize is True.'  )

								if offset and not do_rescale:
										raise ValueError('For offset, do_rescale must also be set to True.'  )

								# All transformations expect numpy arrays.
								SCREAMING_SNAKE_CASE_					      =							to_numpy_array(snake_case__  )

								if do_resize:
										SCREAMING_SNAKE_CASE_					      =							self.resize(image=snake_case__					,							size=snake_case__					,							resample=snake_case__  )

								if do_center_crop:
										SCREAMING_SNAKE_CASE_					      =							self.center_crop(snake_case__					,							size=snake_case__  )

								if do_rescale:
										SCREAMING_SNAKE_CASE_					      =							self.rescale(image=snake_case__					,							scale=snake_case__					,							offset=snake_case__  )

								if do_normalize:
										SCREAMING_SNAKE_CASE_					      =							self.normalize(image=snake_case__					,							mean=snake_case__					,							std=snake_case__  )

								SCREAMING_SNAKE_CASE_					      =							to_channel_dimension_format(snake_case__					,							snake_case__  )
								return image






						def 	__a					(			self	:   Optional[int]					,							snake_case__	:   ImageInput					,							snake_case__	:   bool = None					,							snake_case__	:   Dict[str, int] = None					,							snake_case__	:   PILImageResampling = None					,							snake_case__	:   bool = None					,							snake_case__	:   Dict[str, int] = None					,							snake_case__	:   bool = None					,							snake_case__	:   float = None					,							snake_case__	:   bool = None					,							snake_case__	:   bool = None					,							snake_case__	:   Optional[Union[float, List[float]]] = None					,							snake_case__	:   Optional[Union[float, List[float]]] = None					,							snake_case__	:   Optional[Union[str, TensorType]] = None					,							snake_case__	:   ChannelDimension = ChannelDimension.FIRST					,							**snake_case__	:   List[Any]					,							):

								"""simple docstring"""

								SCREAMING_SNAKE_CASE_					      =							do_resize if do_resize is not None else self.do_resize
								SCREAMING_SNAKE_CASE_					      =							resample if resample is not None else self.resample
								SCREAMING_SNAKE_CASE_					      =							do_center_crop if do_center_crop is not None else self.do_center_crop
								SCREAMING_SNAKE_CASE_					      =							do_rescale if do_rescale is not None else self.do_rescale
								SCREAMING_SNAKE_CASE_					      =							rescale_factor if rescale_factor is not None else self.rescale_factor
								SCREAMING_SNAKE_CASE_					      =							offset if offset is not None else self.offset
								SCREAMING_SNAKE_CASE_					      =							do_normalize if do_normalize is not None else self.do_normalize
								SCREAMING_SNAKE_CASE_					      =							image_mean if image_mean is not None else self.image_mean
								SCREAMING_SNAKE_CASE_					      =							image_std if image_std is not None else self.image_std

								SCREAMING_SNAKE_CASE_					      =							size if size is not None else self.size
								SCREAMING_SNAKE_CASE_					      =							get_size_dict(snake_case__					,							default_to_square=snake_case__  )
								SCREAMING_SNAKE_CASE_					      =							crop_size if crop_size is not None else self.crop_size
								SCREAMING_SNAKE_CASE_					      =							get_size_dict(snake_case__					,							param_name='crop_size'  )

								if not valid_images(snake_case__  ):
										raise ValueError(
										    'Invalid image type. Must be of type PIL.Image.Image, numpy.ndarray, '
										    'torch.Tensor, tf.Tensor or jax.ndarray.'  )

								SCREAMING_SNAKE_CASE_					      =							make_batched(snake_case__  )

								SCREAMING_SNAKE_CASE_					      =							[
								    [
								        self._preprocess_image(
								            image=snake_case__					,							do_resize=snake_case__					,							size=snake_case__					,							resample=snake_case__					,							do_center_crop=snake_case__					,							crop_size=snake_case__					,							do_rescale=snake_case__					,							rescale_factor=snake_case__					,							offset=snake_case__					,							do_normalize=snake_case__					,							image_mean=snake_case__					,							image_std=snake_case__					,							data_format=snake_case__					,							)
								        for img in video
								    ]
								    for video in videos
								]

								SCREAMING_SNAKE_CASE_					      =							{'pixel_values': videos}
								return BatchFeature(data=snake_case__					,							tensor_type=snake_case__  )





SCREAMING_SNAKE_CASE:     Optional[int]									= {str(digit): digit**5 for digit in range(1_0)}


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


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


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