






'''simple docstring'''






from __future__ import annotations

import copy
import inspect
import unittest

import numpy as np

from transformers import is_tf_available, is_vision_available
from transformers.models.auto import get_values
from transformers.testing_utils import require_tf, slow
from transformers.utils import cached_property

from ...test_configuration_common import ConfigTester
from ...test_modeling_tf_common import TFModelTesterMixin, floats_tensor, ids_tensor, random_attention_mask
from ...test_pipeline_mixin import PipelineTesterMixin


if is_tf_available():
						import tensorflow as tf

						from transformers import (
						    TF_LAYOUTLMV3_PRETRAINED_MODEL_ARCHIVE_LIST,
						    TF_MODEL_FOR_MULTIPLE_CHOICE_MAPPING,
						    TF_MODEL_FOR_QUESTION_ANSWERING_MAPPING,
						    TF_MODEL_FOR_SEQUENCE_CLASSIFICATION_MAPPING,
						    TF_MODEL_FOR_TOKEN_CLASSIFICATION_MAPPING,
						    LayoutLMvaConfig,
						    TFLayoutLMvaForQuestionAnswering,
						    TFLayoutLMvaForSequenceClassification,
						    TFLayoutLMvaForTokenClassification,
						    TFLayoutLMvaModel,
						)

if is_vision_available():
						from PIL import Image

						from transformers import LayoutLMvaImageProcessor




class a_    :







			def __init__(self					,   __a					,   __a=2					,   __a=3					,   __a=4					,   __a=2					,   __a=7					,   __a=True					,   __a=True					,   __a=True					,   __a=True					,   __a=9_9					,   __a=3_6					,   __a=2					,   __a=4					,   __a=3_7					,   __a="gelu"					,   __a=0.1					,   __a=0.1					,   __a=5_1_2					,   __a=1_6					,   __a=2					,   __a=0.02					,   __a=6					,   __a=6					,   __a=3					,   __a=4					,   __a=None					,   __a=1_0_0_0					,   )			->      Any:
						"""simple docstring"""






						__snake_case				:      Dict     							= parent
						__snake_case				:      int     							= batch_size
						__snake_case				:      List[Any]     							= num_channels
						__snake_case				:      Optional[int]     							= image_size
						__snake_case				:      Optional[int]     							= patch_size
						__snake_case				:      Tuple     							= is_training
						__snake_case				:      Optional[int]     							= use_input_mask
						__snake_case				:      int     							= use_token_type_ids
						__snake_case				:      str     							= use_labels
						__snake_case				:      Dict     							= vocab_size
						__snake_case				:      int     							= hidden_size
						__snake_case				:      List[str]     							= num_hidden_layers
						__snake_case				:      List[Any]     							= num_attention_heads
						__snake_case				:      Optional[Any]     							= intermediate_size
						__snake_case				:      Dict     							= hidden_act
						__snake_case				:      Any     							= hidden_dropout_prob
						__snake_case				:      str     							= attention_probs_dropout_prob
						__snake_case				:      str     							= max_position_embeddings
						__snake_case				:      List[Any]     							= type_vocab_size
						__snake_case				:      Tuple     							= type_sequence_label_size
						__snake_case				:      Optional[int]     							= initializer_range
						__snake_case				:      str     							= coordinate_size
						__snake_case				:      Tuple     							= shape_size
						__snake_case				:      Any     							= num_labels
						__snake_case				:      List[str]     							= num_choices
						__snake_case				:      Tuple     							= scope
						__snake_case				:      List[str]     							= range_bbox

						# LayoutLMv3's sequence length equals the number of text tokens + number of patches + 1 (we add 1 for the CLS token)
						__snake_case				:      Union[str, Any]     							= text_seq_length
						__snake_case				:      Optional[int]     							= (image_size // patch_size) ** 2 + 1
						__snake_case				:      Optional[Any]     							= self.text_seq_length + self.image_seq_length







			def     SCREAMING_SNAKE_CASE__					(self)			->      Dict:
						"""simple docstring"""






						__snake_case				:      List[str]     							= ids_tensor([self.batch_size, self.text_seq_length]					,   self.vocab_size)

						__snake_case				:      Any     							= ids_tensor([self.batch_size, self.text_seq_length, 4]					,   self.range_bbox)
						__snake_case				:      Union[str, Any]     							= bbox.numpy()
						# Ensure that bbox is legal
						for i in range(bbox.shape[0]):
									for j in range(bbox.shape[1]):
												if bbox[i, j, 3] < bbox[i, j, 1]:
															__snake_case				:      int     							= bbox[i, j, 3]
															__snake_case				:      int     							= bbox[i, j, 1]
															__snake_case				:      Optional[Any]     							= tmp_coordinate
												if bbox[i, j, 2] < bbox[i, j, 0]:
															__snake_case				:      int     							= bbox[i, j, 2]
															__snake_case				:      str     							= bbox[i, j, 0]
															__snake_case				:      Union[str, Any]     							= tmp_coordinate
						__snake_case				:      Any     							= tf.constant(lowerCAmelCase_)

						__snake_case				:      Dict     							= floats_tensor([self.batch_size, self.num_channels, self.image_size, self.image_size])

						__snake_case				:      Optional[Any]     							= None
						if self.use_input_mask:
									__snake_case				:      int     							= random_attention_mask([self.batch_size, self.text_seq_length])

						__snake_case				:      Tuple     							= None
						if self.use_token_type_ids:
									__snake_case				:      List[Any]     							= ids_tensor([self.batch_size, self.text_seq_length]					,   self.type_vocab_size)

						__snake_case				:      Tuple     							= None
						__snake_case				:      int     							= None
						if self.use_labels:
									__snake_case				:      Tuple     							= ids_tensor([self.batch_size]					,   self.type_sequence_label_size)
									__snake_case				:      Any     							= ids_tensor([self.batch_size, self.text_seq_length]					,   self.num_labels)

						__snake_case				:      str     							= LayoutLMvaConfig(
						    vocab_size=self.vocab_size					,   hidden_size=self.hidden_size					,   num_hidden_layers=self.num_hidden_layers					,   num_attention_heads=self.num_attention_heads					,   intermediate_size=self.intermediate_size					,   hidden_act=self.hidden_act					,   hidden_dropout_prob=self.hidden_dropout_prob					,   attention_probs_dropout_prob=self.attention_probs_dropout_prob					,   max_position_embeddings=self.max_position_embeddings					,   type_vocab_size=self.type_vocab_size					,   initializer_range=self.initializer_range					,   coordinate_size=self.coordinate_size					,   shape_size=self.shape_size					,   input_size=self.image_size					,   patch_size=self.patch_size					,   )

						return config, input_ids, bbox, pixel_values, token_type_ids, input_mask, sequence_labels, token_labels







			def     SCREAMING_SNAKE_CASE__					(self					,   __a					,   __a					,   __a					,   __a					,   __a					,   __a)			->      Any:
						"""simple docstring"""






						__snake_case				:      List[Any]     							= TFLayoutLMvaModel(config=lowerCAmelCase_)

						# text + image
						__snake_case				:      str     							= model(lowerCAmelCase_					,   pixel_values=lowerCAmelCase_					,   training=lowerCAmelCase_)
						__snake_case				:      str     							= model(
						    lowerCAmelCase_					,   bbox=lowerCAmelCase_					,   pixel_values=lowerCAmelCase_					,   attention_mask=lowerCAmelCase_					,   token_type_ids=lowerCAmelCase_					,   training=lowerCAmelCase_					,   )
						__snake_case				:      List[Any]     							= model(lowerCAmelCase_					,   bbox=lowerCAmelCase_					,   pixel_values=lowerCAmelCase_					,   training=lowerCAmelCase_)

						self.parent.assertEqual(result.last_hidden_state.shape					,   (self.batch_size, self.seq_length, self.hidden_size))

						# text only
						__snake_case				:      Dict     							= model(lowerCAmelCase_					,   training=lowerCAmelCase_)
						self.parent.assertEqual(
						    result.last_hidden_state.shape					,   (self.batch_size, self.text_seq_length, self.hidden_size))

						# image only
						__snake_case				:      Dict     							= model({'pixel_values': pixel_values}					,   training=lowerCAmelCase_)
						self.parent.assertEqual(
						    result.last_hidden_state.shape					,   (self.batch_size, self.image_seq_length, self.hidden_size))







			def     SCREAMING_SNAKE_CASE__					(self					,   __a					,   __a					,   __a					,   __a					,   __a					,   __a					,   __a)			->      List[str]:
						"""simple docstring"""






						__snake_case				:      Any     							= self.num_labels
						__snake_case				:      Union[str, Any]     							= TFLayoutLMvaForSequenceClassification(config=lowerCAmelCase_)
						__snake_case				:      List[str]     							= model(
						    lowerCAmelCase_					,   bbox=lowerCAmelCase_					,   pixel_values=lowerCAmelCase_					,   attention_mask=lowerCAmelCase_					,   token_type_ids=lowerCAmelCase_					,   labels=lowerCAmelCase_					,   training=lowerCAmelCase_					,   )
						self.parent.assertEqual(result.logits.shape					,   (self.batch_size, self.num_labels))







			def     SCREAMING_SNAKE_CASE__					(self					,   __a					,   __a					,   __a					,   __a					,   __a					,   __a					,   __a)			->      Union[str, Any]:
						"""simple docstring"""






						__snake_case				:      Any     							= self.num_labels
						__snake_case				:      Any     							= TFLayoutLMvaForTokenClassification(config=lowerCAmelCase_)
						__snake_case				:      Tuple     							= model(
						    lowerCAmelCase_					,   bbox=lowerCAmelCase_					,   pixel_values=lowerCAmelCase_					,   attention_mask=lowerCAmelCase_					,   token_type_ids=lowerCAmelCase_					,   labels=lowerCAmelCase_					,   training=lowerCAmelCase_					,   )
						self.parent.assertEqual(result.logits.shape					,   (self.batch_size, self.text_seq_length, self.num_labels))







			def     SCREAMING_SNAKE_CASE__					(self					,   __a					,   __a					,   __a					,   __a					,   __a					,   __a					,   __a)			->      int:
						"""simple docstring"""






						__snake_case				:      Union[str, Any]     							= 2
						__snake_case				:      int     							= TFLayoutLMvaForQuestionAnswering(config=lowerCAmelCase_)
						__snake_case				:      Optional[Any]     							= model(
						    lowerCAmelCase_					,   bbox=lowerCAmelCase_					,   pixel_values=lowerCAmelCase_					,   attention_mask=lowerCAmelCase_					,   token_type_ids=lowerCAmelCase_					,   start_positions=lowerCAmelCase_					,   end_positions=lowerCAmelCase_					,   training=lowerCAmelCase_					,   )
						self.parent.assertEqual(result.start_logits.shape					,   (self.batch_size, self.seq_length))
						self.parent.assertEqual(result.end_logits.shape					,   (self.batch_size, self.seq_length))







			def     SCREAMING_SNAKE_CASE__					(self)			->      Optional[Any]:
						"""simple docstring"""






						__snake_case				:      Tuple     							= self.prepare_config_and_inputs()
						((__snake_case)							,(__snake_case)							,(__snake_case)							,(__snake_case)							,(__snake_case)							,(__snake_case)							,(__snake_case)							,(__snake_case))				:      Any     							= config_and_inputs
						__snake_case				:      Tuple     							= {
						    'input_ids': input_ids,
						    'bbox': bbox,
						    'pixel_values': pixel_values,
						    'token_type_ids': token_type_ids,
						    'attention_mask': input_mask,
						}
						return config, inputs_dict




@require_tf
class a_    (    __lowerCAmelCase		,      __lowerCAmelCase		,      unittest.TestCase							):
			_snake_case        =							(
			    (
			        TFLayoutLMvaModel,
			        TFLayoutLMvaForQuestionAnswering,
			        TFLayoutLMvaForSequenceClassification,
			        TFLayoutLMvaForTokenClassification,
			    )
			    if is_tf_available()
			    else ()
			)
			_snake_case        =							(
			    {'''document-question-answering''': TFLayoutLMvaForQuestionAnswering, '''feature-extraction''': TFLayoutLMvaModel}
			    if is_tf_available()
			    else {}
			)

			_snake_case        =							False
			_snake_case        =							False
			_snake_case        =							False







			def     SCREAMING_SNAKE_CASE__					(self					,   __a					,   __a					,   __a					,   __a					,   __a)			->      Any:
						"""simple docstring"""






						return True







			def     SCREAMING_SNAKE_CASE__					(self					,   __a					,   __a					,   __a=False)			->      dict:
						"""simple docstring"""






						__snake_case				:      Tuple     							= copy.deepcopy(lowerCAmelCase_)

						if model_class in get_values(lowerCAmelCase_):
									__snake_case				:      str     							= {
									    k: tf.tile(tf.expand_dims(lowerCAmelCase_					,   1)					,   (1, self.model_tester.num_choices) + (1,) * (v.ndim - 1))
									    if isinstance(lowerCAmelCase_					,   tf.Tensor) and v.ndim > 0
									    else v
									    for k, v in inputs_dict.items()
									}

						if return_labels:
									if model_class in get_values(lowerCAmelCase_):
												__snake_case				:      Union[str, Any]     							= tf.ones(self.model_tester.batch_size					,   dtype=tf.intaa)
									elif model_class in get_values(lowerCAmelCase_):
												__snake_case				:      List[str]     							= tf.zeros(self.model_tester.batch_size					,   dtype=tf.intaa)
												__snake_case				:      List[Any]     							= tf.zeros(self.model_tester.batch_size					,   dtype=tf.intaa)
									elif model_class in get_values(lowerCAmelCase_):
												__snake_case				:      str     							= tf.zeros(self.model_tester.batch_size					,   dtype=tf.intaa)
									elif model_class in get_values(lowerCAmelCase_):
												__snake_case				:      Any     							= tf.zeros(
												    (self.model_tester.batch_size, self.model_tester.text_seq_length)					,   dtype=tf.intaa)

						return inputs_dict







			def     SCREAMING_SNAKE_CASE__					(self)			->      List[str]:
						"""simple docstring"""






						__snake_case				:      Tuple     							= TFLayoutLMvaModelTester(self)
						__snake_case				:      List[Any]     							= ConfigTester(self					,   config_class=lowerCAmelCase_					,   hidden_size=3_7)







			def     SCREAMING_SNAKE_CASE__					(self)			->      List[Any]:
						"""simple docstring"""






						self.config_tester.run_common_tests()







			def     SCREAMING_SNAKE_CASE__					(self)			->      Tuple:
						"""simple docstring"""






						__snake_case							,__snake_case				:      Dict     							= self.model_tester.prepare_config_and_inputs_for_common()
						for model_class in self.all_model_classes:
									__snake_case				:      Optional[Any]     							= model_class(lowerCAmelCase_)
									if getattr(lowerCAmelCase_					,   'hf_compute_loss'					,   lowerCAmelCase_):
												# The number of elements in the loss should be the same as the number of elements in the label
												__snake_case				:      List[Any]     							= self._prepare_for_class(inputs_dict.copy()					,   lowerCAmelCase_					,   return_labels=lowerCAmelCase_)
												__snake_case				:      Union[str, Any]     							= prepared_for_class[
												    sorted(prepared_for_class.keys() - inputs_dict.keys()					,   reverse=lowerCAmelCase_)[0]
												]
												__snake_case				:      Tuple     							= added_label.shape.as_list()[:1]

												# Test that model correctly compute the loss with kwargs
												__snake_case				:      Tuple     							= self._prepare_for_class(inputs_dict.copy()					,   lowerCAmelCase_					,   return_labels=lowerCAmelCase_)
												__snake_case				:      Tuple     							= prepared_for_class.pop('input_ids')

												__snake_case				:      Dict     							= model(lowerCAmelCase_					,   **lowerCAmelCase_)[0]
												self.assertTrue(loss.shape.as_list() == expected_loss_size or loss.shape.as_list() == [1])

												# Test that model correctly compute the loss when we mask some positions
												__snake_case				:      List[Any]     							= self._prepare_for_class(inputs_dict.copy()					,   lowerCAmelCase_					,   return_labels=lowerCAmelCase_)
												__snake_case				:      Optional[Any]     							= prepared_for_class.pop('input_ids')
												if "labels" in prepared_for_class:
															__snake_case				:      Optional[Any]     							= prepared_for_class['labels'].numpy()
															if len(labels.shape) > 1 and labels.shape[1] != 1:
																		__snake_case				:      Any     							= -1_0_0
																		__snake_case				:      int     							= tf.convert_to_tensor(lowerCAmelCase_)
																		__snake_case				:      Optional[int]     							= model(lowerCAmelCase_					,   **lowerCAmelCase_)[0]
																		self.assertTrue(loss.shape.as_list() == expected_loss_size or loss.shape.as_list() == [1])
																		self.assertTrue(not np.any(np.isnan(loss.numpy())))

                # Test that model correctly compute the loss with a dict
												__snake_case				:      Dict     							= self._prepare_for_class(inputs_dict.copy()					,   lowerCAmelCase_					,   return_labels=lowerCAmelCase_)
												__snake_case				:      List[str]     							= model(lowerCAmelCase_)[0]
												self.assertTrue(loss.shape.as_list() == expected_loss_size or loss.shape.as_list() == [1])

												# Test that model correctly compute the loss with a tuple
												__snake_case				:      Optional[int]     							= self._prepare_for_class(inputs_dict.copy()					,   lowerCAmelCase_					,   return_labels=lowerCAmelCase_)

												# Get keys that were added with the _prepare_for_class function
												__snake_case				:      Optional[int]     							= prepared_for_class.keys() - inputs_dict.keys()
												__snake_case				:      str     							= inspect.signature(model.call).parameters
												__snake_case				:      int     							= list(signature.keys())

												# Create a dictionary holding the location of the tensors in the tuple
												__snake_case				:      Any     							= {0: 'input_ids'}
												for label_key in label_keys:
															__snake_case				:      Optional[int]     							= signature_names.index(lowerCAmelCase_)
															__snake_case				:      List[Any]     							= label_key
												__snake_case				:      Optional[Any]     							= sorted(tuple_index_mapping.items())
												# Initialize a list with their default values, update the values and convert to a tuple
												__snake_case				:      Optional[Any]     							= []

												for name in signature_names:
															if name != "kwargs":
																		list_input.append(signature[name].default)

												for index, value in sorted_tuple_index_mapping:
															__snake_case				:      Tuple     							= prepared_for_class[value]

												__snake_case				:      Optional[int]     							= tuple(lowerCAmelCase_)

												# Send to model
												__snake_case				:      Tuple     							= model(tuple_input[:-1])[0]

												self.assertTrue(loss.shape.as_list() == expected_loss_size or loss.shape.as_list() == [1])







			def     SCREAMING_SNAKE_CASE__					(self)			->      Dict:
						"""simple docstring"""






						(
						    (
						    __snake_case						
						)							,(
						    __snake_case						
						)							,(
						    __snake_case						
						)							,(
						    __snake_case						
						)							,(
						    __snake_case						
						)							,(
						    __snake_case						
						)							,(
						    __snake_case						
						)							,(
						    __snake_case						
						)							,						
						)				:      Optional[Any]     							= self.model_tester.prepare_config_and_inputs()
						self.model_tester.create_and_check_model(lowerCAmelCase_					,   lowerCAmelCase_					,   lowerCAmelCase_					,   lowerCAmelCase_					,   lowerCAmelCase_					,   lowerCAmelCase_)







			def     SCREAMING_SNAKE_CASE__					(self)			->      Optional[Any]:
						"""simple docstring"""






						(
						    (
						    __snake_case						
						)							,(
						    __snake_case						
						)							,(
						    __snake_case						
						)							,(
						    __snake_case						
						)							,(
						    __snake_case						
						)							,(
						    __snake_case						
						)							,(
						    __snake_case						
						)							,(
						    __snake_case						
						)							,						
						)				:      Any     							= self.model_tester.prepare_config_and_inputs()
						for type in ["absolute", "relative_key", "relative_key_query"]:
									__snake_case				:      List[str]     							= type
									self.model_tester.create_and_check_model(lowerCAmelCase_					,   lowerCAmelCase_					,   lowerCAmelCase_					,   lowerCAmelCase_					,   lowerCAmelCase_					,   lowerCAmelCase_)







			def     SCREAMING_SNAKE_CASE__					(self)			->      Any:
						"""simple docstring"""






						(
						    (
						    __snake_case						
						)							,(
						    __snake_case						
						)							,(
						    __snake_case						
						)							,(
						    __snake_case						
						)							,(
						    __snake_case						
						)							,(
						    __snake_case						
						)							,(
						    __snake_case						
						)							,(
						    __snake_case						
						)							,						
						)				:      Tuple     							= self.model_tester.prepare_config_and_inputs()
						self.model_tester.create_and_check_for_sequence_classification(
						    lowerCAmelCase_					,   lowerCAmelCase_					,   lowerCAmelCase_					,   lowerCAmelCase_					,   lowerCAmelCase_					,   lowerCAmelCase_					,   lowerCAmelCase_)







			def     SCREAMING_SNAKE_CASE__					(self)			->      Dict:
						"""simple docstring"""






						(
						    (
						    __snake_case						
						)							,(
						    __snake_case						
						)							,(
						    __snake_case						
						)							,(
						    __snake_case						
						)							,(
						    __snake_case						
						)							,(
						    __snake_case						
						)							,(
						    __snake_case						
						)							,(
						    __snake_case						
						)							,						
						)				:      Tuple     							= self.model_tester.prepare_config_and_inputs()
						self.model_tester.create_and_check_for_token_classification(
						    lowerCAmelCase_					,   lowerCAmelCase_					,   lowerCAmelCase_					,   lowerCAmelCase_					,   lowerCAmelCase_					,   lowerCAmelCase_					,   lowerCAmelCase_)







			def     SCREAMING_SNAKE_CASE__					(self)			->      str:
						"""simple docstring"""






						(
						    (
						    __snake_case						
						)							,(
						    __snake_case						
						)							,(
						    __snake_case						
						)							,(
						    __snake_case						
						)							,(
						    __snake_case						
						)							,(
						    __snake_case						
						)							,(
						    __snake_case						
						)							,(
						    __snake_case						
						)							,						
						)				:      Tuple     							= self.model_tester.prepare_config_and_inputs()
						self.model_tester.create_and_check_for_question_answering(
						    lowerCAmelCase_					,   lowerCAmelCase_					,   lowerCAmelCase_					,   lowerCAmelCase_					,   lowerCAmelCase_					,   lowerCAmelCase_					,   lowerCAmelCase_)







			@slow
			def     SCREAMING_SNAKE_CASE__					(self)			->      List[Any]:
						"""simple docstring"""






						for model_name in TF_LAYOUTLMV3_PRETRAINED_MODEL_ARCHIVE_LIST[:1]:
									__snake_case				:      int     							= TFLayoutLMvaModel.from_pretrained(lowerCAmelCase_)
									self.assertIsNotNone(lowerCAmelCase_)




def        _SCREAMING_SNAKE_CASE  (				)    -> str:







			"""simple docstring"""
			__snake_case				:      Any     							= Image.open('./tests/fixtures/tests_samples/COCO/000000039769.png'  )
			return image





@require_tf
class a_    (    unittest.TestCase							):







			@cached_property
			def     SCREAMING_SNAKE_CASE__					(self)			->      List[Any]:
						"""simple docstring"""






						return LayoutLMvaImageProcessor(apply_ocr=lowerCAmelCase_) if is_vision_available() else None







			@slow
			def     SCREAMING_SNAKE_CASE__					(self)			->      Tuple:
						"""simple docstring"""






						__snake_case				:      Tuple     							= TFLayoutLMvaModel.from_pretrained('microsoft/layoutlmv3-base')

						__snake_case				:      Dict     							= self.default_image_processor
						__snake_case				:      str     							= prepare_img()
						__snake_case				:      int     							= image_processor(images=lowerCAmelCase_					,   return_tensors='tf').pixel_values

						__snake_case				:      str     							= tf.constant([[1, 2]])
						__snake_case				:      Optional[int]     							= tf.expand_dims(tf.constant([[1, 2, 3, 4], [5, 6, 7, 8]])					,   axis=0)

						# forward pass
						__snake_case				:      str     							= model(input_ids=lowerCAmelCase_					,   bbox=lowerCAmelCase_					,   pixel_values=lowerCAmelCase_					,   training=lowerCAmelCase_)

						# verify the logits
						__snake_case				:      List[str]     							= (1, 1_9_9, 7_6_8)
						self.assertEqual(outputs.last_hidden_state.shape					,   lowerCAmelCase_)

						__snake_case				:      Any     							= tf.constant(
						    [[-0.0_529, 0.3_618, 0.1_632], [-0.1_587, -0.1_667, -0.0_400], [-0.1_557, -0.1_671, -0.0_505]])

						self.assertTrue(np.allclose(outputs.last_hidden_state[0, :3, :3]					,   lowerCAmelCase_					,   atol=1E-4))







'''simple docstring'''






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




def        _SCREAMING_SNAKE_CASE  (				A  :       int  )    -> int:







   """simple docstring"""
   return sum(DIGITS_FIFTH_POWER[digit] for digit in str(A  )  )




def        _SCREAMING_SNAKE_CASE  (				)    -> int:







   """simple docstring"""
   return sum(
       number
       for number in range(10_00  ,		1_00_00_00  )
       if number == digits_fifth_powers_sum(A  )  )


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