




'''simple docstring'''




import unittest

from transformers import DebertaConfig, is_torch_available
from transformers.testing_utils import require_sentencepiece, require_tokenizers, require_torch, slow, torch_device

from ...test_configuration_common import ConfigTester
from ...test_modeling_common import ModelTesterMixin, ids_tensor
from ...test_pipeline_mixin import PipelineTesterMixin


if is_torch_available():
    import torch

    from transformers import (
        DebertaForMaskedLM,
        DebertaForQuestionAnswering,
        DebertaForSequenceClassification,
        DebertaForTokenClassification,
        DebertaModel,
    )
    from transformers.models.deberta.modeling_deberta import DEBERTA_PRETRAINED_MODEL_ARCHIVE_LIST

class   lowerCAmelCase_      (       _lowerCAmelCase      ):







  '''simple docstring'''







  def __init__(  self			:		Dict  ,						_UpperCAmelCase			:		Optional[Any]  ,						_UpperCAmelCase			:		Union[str, Any]=13  ,						_UpperCAmelCase			:		str=7  ,						_UpperCAmelCase			:		Any=True  ,						_UpperCAmelCase			:		Tuple=True  ,						_UpperCAmelCase			:		List[Any]=True  ,						_UpperCAmelCase			:		Any=True  ,						_UpperCAmelCase			:		Any=99  ,						_UpperCAmelCase			:		Dict=32  ,						_UpperCAmelCase			:		Dict=5  ,						_UpperCAmelCase			:		Union[str, Any]=4  ,						_UpperCAmelCase			:		Any=37  ,						_UpperCAmelCase			:		Any="gelu"  ,						_UpperCAmelCase			:		Union[str, Any]=0.1  ,						_UpperCAmelCase			:		Optional[Any]=0.1  ,						_UpperCAmelCase			:		str=5_12  ,						_UpperCAmelCase			:		str=16  ,						_UpperCAmelCase			:		Dict=2  ,						_UpperCAmelCase			:		Any=0.02  ,						_UpperCAmelCase			:		Optional[int]=False  ,						_UpperCAmelCase			:		int=True  ,						_UpperCAmelCase			:		Optional[int]="None"  ,						_UpperCAmelCase			:		int=3  ,						_UpperCAmelCase			:		str=4  ,						_UpperCAmelCase			:		Union[str, Any]=None  ,						):






   """simple docstring"""






   UpperCAmelCase__								=			parent
   UpperCAmelCase__								=			batch_size
   UpperCAmelCase__								=			seq_length
   UpperCAmelCase__								=			is_training
   UpperCAmelCase__								=			use_input_mask
   UpperCAmelCase__								=			use_token_type_ids
   UpperCAmelCase__								=			use_labels
   UpperCAmelCase__								=			vocab_size
   UpperCAmelCase__								=			hidden_size
   UpperCAmelCase__								=			num_hidden_layers
   UpperCAmelCase__								=			num_attention_heads
   UpperCAmelCase__								=			intermediate_size
   UpperCAmelCase__								=			hidden_act
   UpperCAmelCase__								=			hidden_dropout_prob
   UpperCAmelCase__								=			attention_probs_dropout_prob
   UpperCAmelCase__								=			max_position_embeddings
   UpperCAmelCase__								=			type_vocab_size
   UpperCAmelCase__								=			type_sequence_label_size
   UpperCAmelCase__								=			initializer_range
   UpperCAmelCase__								=			num_labels
   UpperCAmelCase__								=			num_choices
   UpperCAmelCase__								=			relative_attention
   UpperCAmelCase__								=			position_biased_input
   UpperCAmelCase__								=			pos_att_type
   UpperCAmelCase__								=			scope


  def 							SCREAMING_SNAKE_CASE__	(  self			:		Union[str, Any]       ):






   """simple docstring"""






   UpperCAmelCase__								=			ids_tensor([self.batch_size, self.seq_length]  ,						self.vocab_size       )

   UpperCAmelCase__								=			None
   if self.use_input_mask:
    UpperCAmelCase__								=			ids_tensor([self.batch_size, self.seq_length]  ,						vocab_size=2       )

   UpperCAmelCase__								=			None
   if self.use_token_type_ids:
    UpperCAmelCase__								=			ids_tensor([self.batch_size, self.seq_length]  ,						self.type_vocab_size       )

   UpperCAmelCase__								=			None
   UpperCAmelCase__								=			None
   UpperCAmelCase__								=			None
   if self.use_labels:
    UpperCAmelCase__								=			ids_tensor([self.batch_size]  ,						self.type_sequence_label_size       )
    UpperCAmelCase__								=			ids_tensor([self.batch_size, self.seq_length]  ,						self.num_labels       )
    UpperCAmelCase__								=			ids_tensor([self.batch_size]  ,						self.num_choices       )

   UpperCAmelCase__								=			self.get_config()

   return config, input_ids, token_type_ids, input_mask, sequence_labels, token_labels, choice_labels


  def 							SCREAMING_SNAKE_CASE__	(  self			:		Tuple       ):






   """simple docstring"""






   return DebertaConfig(
       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  ,						relative_attention=self.relative_attention  ,						position_biased_input=self.position_biased_input  ,						pos_att_type=self.pos_att_type  ,						)


  def 							SCREAMING_SNAKE_CASE__	(  self			:		Union[str, Any]       ):






   """simple docstring"""






   UpperCAmelCase__								=			self.get_config()
   UpperCAmelCase__								=			3_00
   return config


  def 							SCREAMING_SNAKE_CASE__	(  self			:		str  ,						_UpperCAmelCase			:		List[Any]       ):






   """simple docstring"""






   self.parent.assertListEqual(list(result.loss.size()       )  ,						[]       )


  def 							SCREAMING_SNAKE_CASE__	(  self			:		Dict  ,						_UpperCAmelCase			:		Any  ,						_UpperCAmelCase			:		Any  ,						_UpperCAmelCase			:		Union[str, Any]  ,						_UpperCAmelCase			:		Union[str, Any]  ,						_UpperCAmelCase			:		int  ,						_UpperCAmelCase			:		Optional[Any]  ,						_UpperCAmelCase			:		int       ):






   """simple docstring"""






   UpperCAmelCase__								=			DebertaModel(config=_UpperCAmelCase       )
   model.to(_UpperCAmelCase       )
   model.eval()
   UpperCAmelCase__								=			model(_UpperCAmelCase  ,						attention_mask=_UpperCAmelCase  ,						token_type_ids=_UpperCAmelCase       )[0]
   UpperCAmelCase__								=			model(_UpperCAmelCase  ,						token_type_ids=_UpperCAmelCase       )[0]
   UpperCAmelCase__								=			model(_UpperCAmelCase       )[0]

   self.parent.assertListEqual(list(sequence_output.size()       )  ,						[self.batch_size, self.seq_length, self.hidden_size]       )


  def 							SCREAMING_SNAKE_CASE__	(  self			:		Optional[int]  ,						_UpperCAmelCase			:		str  ,						_UpperCAmelCase			:		List[str]  ,						_UpperCAmelCase			:		Union[str, Any]  ,						_UpperCAmelCase			:		List[Any]  ,						_UpperCAmelCase			:		Dict  ,						_UpperCAmelCase			:		List[Any]  ,						_UpperCAmelCase			:		Optional[Any]       ):






   """simple docstring"""






   UpperCAmelCase__								=			DebertaForMaskedLM(config=_UpperCAmelCase       )
   model.to(_UpperCAmelCase       )
   model.eval()
   UpperCAmelCase__								=			model(_UpperCAmelCase  ,						attention_mask=_UpperCAmelCase  ,						token_type_ids=_UpperCAmelCase  ,						labels=_UpperCAmelCase       )

   self.parent.assertEqual(result.logits.shape  ,						(self.batch_size, self.seq_length, self.vocab_size)       )


  def 							SCREAMING_SNAKE_CASE__	(  self			:		List[Any]  ,						_UpperCAmelCase			:		Optional[int]  ,						_UpperCAmelCase			:		List[Any]  ,						_UpperCAmelCase			:		Dict  ,						_UpperCAmelCase			:		str  ,						_UpperCAmelCase			:		Tuple  ,						_UpperCAmelCase			:		Tuple  ,						_UpperCAmelCase			:		Optional[Any]       ):






   """simple docstring"""






   UpperCAmelCase__								=			self.num_labels
   UpperCAmelCase__								=			DebertaForSequenceClassification(_UpperCAmelCase       )
   model.to(_UpperCAmelCase       )
   model.eval()
   UpperCAmelCase__								=			model(_UpperCAmelCase  ,						attention_mask=_UpperCAmelCase  ,						token_type_ids=_UpperCAmelCase  ,						labels=_UpperCAmelCase       )
   self.parent.assertListEqual(list(result.logits.size()       )  ,						[self.batch_size, self.num_labels]       )
   self.check_loss_output(_UpperCAmelCase       )


  def 							SCREAMING_SNAKE_CASE__	(  self			:		Union[str, Any]  ,						_UpperCAmelCase			:		Dict  ,						_UpperCAmelCase			:		Union[str, Any]  ,						_UpperCAmelCase			:		Optional[Any]  ,						_UpperCAmelCase			:		Union[str, Any]  ,						_UpperCAmelCase			:		Dict  ,						_UpperCAmelCase			:		Optional[int]  ,						_UpperCAmelCase			:		List[Any]       ):






   """simple docstring"""






   UpperCAmelCase__								=			self.num_labels
   UpperCAmelCase__								=			DebertaForTokenClassification(config=_UpperCAmelCase       )
   model.to(_UpperCAmelCase       )
   model.eval()
   UpperCAmelCase__								=			model(_UpperCAmelCase  ,						attention_mask=_UpperCAmelCase  ,						token_type_ids=_UpperCAmelCase  ,						labels=_UpperCAmelCase       )
   self.parent.assertEqual(result.logits.shape  ,						(self.batch_size, self.seq_length, self.num_labels)       )


  def 							SCREAMING_SNAKE_CASE__	(  self			:		Tuple  ,						_UpperCAmelCase			:		List[Any]  ,						_UpperCAmelCase			:		Tuple  ,						_UpperCAmelCase			:		List[str]  ,						_UpperCAmelCase			:		int  ,						_UpperCAmelCase			:		int  ,						_UpperCAmelCase			:		Optional[Any]  ,						_UpperCAmelCase			:		List[Any]       ):






   """simple docstring"""






   UpperCAmelCase__								=			DebertaForQuestionAnswering(config=_UpperCAmelCase       )
   model.to(_UpperCAmelCase       )
   model.eval()
   UpperCAmelCase__								=			model(
       _UpperCAmelCase  ,						attention_mask=_UpperCAmelCase  ,						token_type_ids=_UpperCAmelCase  ,						start_positions=_UpperCAmelCase  ,						end_positions=_UpperCAmelCase  ,						)
   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			:		str       ):






   """simple docstring"""






   UpperCAmelCase__								=			self.prepare_config_and_inputs()
   (
       UpperCAmelCase__							
   )								=			config_and_inputs
   UpperCAmelCase__								=			{"input_ids": input_ids, "token_type_ids": token_type_ids, "attention_mask": input_mask}
   return config, inputs_dict

@require_torch
class   lowerCAmelCase_      (       _lowerCAmelCase	,     _lowerCAmelCase	,     unittest.TestCase      ):







  '''simple docstring'''







  lowerCAmelCase_ :    Tuple    =  (
      (
          DebertaModel,
          DebertaForMaskedLM,
          DebertaForSequenceClassification,
          DebertaForTokenClassification,
          DebertaForQuestionAnswering,
      )
      if is_torch_available()
      else ()
  )
  lowerCAmelCase_ :    List[Any]    =  (
      {
          """feature-extraction""": DebertaModel,
          """fill-mask""": DebertaForMaskedLM,
          """question-answering""": DebertaForQuestionAnswering,
          """text-classification""": DebertaForSequenceClassification,
          """token-classification""": DebertaForTokenClassification,
          """zero-shot""": DebertaForSequenceClassification,
      }
      if is_torch_available()
      else {}
  )

  lowerCAmelCase_ :    int    =  True
  lowerCAmelCase_ :    Union[str, Any]    =  False
  lowerCAmelCase_ :    Optional[Any]    =  False
  lowerCAmelCase_ :    List[str]    =  False
  lowerCAmelCase_ :    Optional[Any]    =  False


  def 							SCREAMING_SNAKE_CASE__	(  self			:		Optional[Any]       ):






   """simple docstring"""






   UpperCAmelCase__								=			DebertaModelTester(self       )
   UpperCAmelCase__								=			ConfigTester(self  ,						config_class=_UpperCAmelCase  ,						hidden_size=37       )


  def 							SCREAMING_SNAKE_CASE__	(  self			:		Optional[int]       ):






   """simple docstring"""






   self.config_tester.run_common_tests()


  def 							SCREAMING_SNAKE_CASE__	(  self			:		Optional[int]       ):






   """simple docstring"""






   UpperCAmelCase__								=			self.model_tester.prepare_config_and_inputs()
   self.model_tester.create_and_check_deberta_model(*_UpperCAmelCase       )


  def 							SCREAMING_SNAKE_CASE__	(  self			:		List[str]       ):






   """simple docstring"""






   UpperCAmelCase__								=			self.model_tester.prepare_config_and_inputs()
   self.model_tester.create_and_check_deberta_for_sequence_classification(*_UpperCAmelCase       )


  def 							SCREAMING_SNAKE_CASE__	(  self			:		Optional[Any]       ):






   """simple docstring"""






   UpperCAmelCase__								=			self.model_tester.prepare_config_and_inputs()
   self.model_tester.create_and_check_deberta_for_masked_lm(*_UpperCAmelCase       )


  def 							SCREAMING_SNAKE_CASE__	(  self			:		Dict       ):






   """simple docstring"""






   UpperCAmelCase__								=			self.model_tester.prepare_config_and_inputs()
   self.model_tester.create_and_check_deberta_for_question_answering(*_UpperCAmelCase       )


  def 							SCREAMING_SNAKE_CASE__	(  self			:		Union[str, Any]       ):






   """simple docstring"""






   UpperCAmelCase__								=			self.model_tester.prepare_config_and_inputs()
   self.model_tester.create_and_check_deberta_for_token_classification(*_UpperCAmelCase       )



  @slow
  def 							SCREAMING_SNAKE_CASE__	(  self			:		Any       ):






   """simple docstring"""






   for model_name in DEBERTA_PRETRAINED_MODEL_ARCHIVE_LIST[:1]:
    UpperCAmelCase__								=			DebertaModel.from_pretrained(_UpperCAmelCase       )
    self.assertIsNotNone(_UpperCAmelCase       )

@require_torch
@require_sentencepiece
@require_tokenizers
class   lowerCAmelCase_      (       unittest.TestCase      ):







  '''simple docstring'''







  @unittest.skip(reason="""Model not available yet"""       )
  def 							SCREAMING_SNAKE_CASE__	(  self			:		Union[str, Any]       ):






   """simple docstring"""






   pass



  @slow
  def 							SCREAMING_SNAKE_CASE__	(  self			:		Dict       ):






   """simple docstring"""






   UpperCAmelCase__								=			DebertaModel.from_pretrained("""microsoft/deberta-base"""       )

   UpperCAmelCase__								=			torch.tensor([[0, 3_14_14, 2_32, 3_28, 7_40, 11_40, 1_26_95, 69, 4_60_78, 15_88, 2]]       )
   UpperCAmelCase__								=			torch.tensor([[0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]]       )
   with torch.no_grad():
    UpperCAmelCase__								=			model(_UpperCAmelCase  ,						attention_mask=_UpperCAmelCase       )[0]
   # compare the actual values for a slice.
   UpperCAmelCase__								=			torch.tensor(
       [[[-0.5986, -0.8055, -0.8462], [1.4484, -0.9348, -0.8059], [0.3123, 0.0032, -1.4131]]]       )
   self.assertTrue(torch.allclose(output[:, 1:4, 1:4]  ,						_UpperCAmelCase  ,						atol=1E-4       )  ,						f'''{output[:, 1:4, 1:4]}'''       )







'''simple docstring'''


def 							UpperCAmelCase_  (						__lowerCamelCase					:					int = 10_00 ):
   lowercase_			,							lowercase_			:str    			= 1, 1
   lowercase_			:Any    			= 2
   while True:
      lowercase_			:str    			= 0
      lowercase_			:Tuple    			= fa + fa
      lowercase_			,							lowercase_			:Tuple    			= fa, f
      index += 1
      for _ in str(__lowerCamelCase ):
         i += 1
      if i == n:
         break
   return index


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


