def SCREAMING_SNAKE_CASE					(  lowercase_:						int					):
       return n * (2 * n - 1)


def SCREAMING_SNAKE_CASE					(  lowercase_:						int					):
       _UpperCamelCase  :							str	    =	(1 + 24 * n) ** 0.5
       return ((1 + root) / 6) % 1 == 0


def SCREAMING_SNAKE_CASE					(  lowercase_:						int = 144					):
       _UpperCamelCase  :							Optional[Any]	    =	start
       _UpperCamelCase  :							List[str]	    =	hexagonal_num(lowercase_					)
       while not is_pentagonal(lowercase_					):
              n += 1
              _UpperCamelCase  :							Optional[int]	    =	hexagonal_num(lowercase_					)
       return num


if __name__ == "__main__":
 print(f'''{solution()} = ''')











import enum
import inspect
from typing import Iterable, List, Optional, Tuple, Union
class 							__snake_case(       enum.Enum   ):
 lowercase			:							List[str]		   =		'''timm'''
 lowercase			:							Any		   =		'''transformers'''
def    a__    (	A		,					A		,					A       ):
   if stage_names is None:
      raise ValueError("""Stage_names must be set for transformers backbones"""       )

   if out_features is not None:
      if not isinstance(A		,					(list,)       ):
         raise ValueError(F'''out_features must be a list {type(A       )}'''       )
      if any(feat not in stage_names for feat in out_features       ):
         raise ValueError(F'''out_features must be a subset of stage_names: {stage_names} got {out_features}'''       )

   if out_indices is not None:
      if not isinstance(A		,					(list, tuple)       ):
         raise ValueError(F'''out_indices must be a list or tuple, got {type(A       )}'''       )
      if any(idx >= len(A       ) for idx in out_indices       ):
         raise ValueError("""out_indices must be valid indices for stage_names {stage_names}, got {out_indices}"""       )

   if out_features is not None and out_indices is not None:
      if len(A       ) != len(A       ):
         raise ValueError("""out_features and out_indices should have the same length if both are set"""       )
      if out_features != [stage_names[idx] for idx in out_indices]:
         raise ValueError("""out_features and out_indices should correspond to the same stages if both are set"""       )
def    a__    (	A		,					A		,					A		,					):
   if out_indices is None and out_features is None:
      lowercase__    :						int       =			[len(A       ) - 1]
      lowercase__    :						Dict       =			[stage_names[-1]]
   elif out_indices is None and out_features is not None:
      lowercase__    :						Any       =			[stage_names.index(A       ) for layer in out_features]
   elif out_features is None and out_indices is not None:
      lowercase__    :						List[str]       =			[stage_names[idx] for idx in out_indices]
   return out_features, out_indices
def    a__    (	A		,					A		,					A		,					):
   verify_out_features_out_indices(out_features=A		,					out_indices=A		,					stage_names=A       )
   lowercase__  ,       lowercase__    :						Dict       =			_align_output_features_output_indices(
       out_features=A		,					out_indices=A		,					stage_names=A       )
   # Verify that the aligned out_features and out_indices are valid
   verify_out_features_out_indices(out_features=A		,					out_indices=A		,					stage_names=A       )
   return output_features, output_indices
class 							__snake_case:
 lowercase			:							Optional[BackboneType]		   =		None



 def     UpperCAmelCase     (						self : Dict			,		UpperCAmelCase__ : int						):

    """simple docstring"""






    if getattr(self			,		"""_backbone"""			,		UpperCAmelCase__						) is None:
       raise ValueError("""self._backbone must be set before calling _init_timm_backbone"""						)

    # These will diagree with the defaults for the transformers models e.g. for resnet50
    # the transformer model has out_features = ['stem', 'stage1', 'stage2', 'stage3', 'stage4']
    # the timm model has out_features = ['act', 'layer1', 'layer2', 'layer3', 'layer4']
    lowercase__    :						List[str]       =			[stage["""module"""] for stage in self._backbone.feature_info.info]
    lowercase__    :						int       =			[stage["""num_chs"""] for stage in self._backbone.feature_info.info]
    lowercase__    :						Optional[int]       =			self._backbone.feature_info.out_indices
    lowercase__    :						Optional[Any]       =			self._backbone.feature_info.module_name()

    # We verify the out indices and out features are valid
    verify_out_features_out_indices(
        out_features=UpperCAmelCase__			,		out_indices=UpperCAmelCase__			,		stage_names=self.stage_names						)
    lowercase__  ,       lowercase__    :						int       =			out_features, out_indices



 def     UpperCAmelCase     (						self : Optional[Any]			,		UpperCAmelCase__ : str						):

    """simple docstring"""






    lowercase__    :						List[str]       =			getattr(UpperCAmelCase__			,		"""stage_names"""						)
    lowercase__    :						Union[str, Any]       =			getattr(UpperCAmelCase__			,		"""out_features"""			,		UpperCAmelCase__						)
    lowercase__    :						List[str]       =			getattr(UpperCAmelCase__			,		"""out_indices"""			,		UpperCAmelCase__						)

    lowercase__    :						Tuple       =			stage_names
    lowercase__  ,       lowercase__    :						List[str]       =			get_aligned_output_features_output_indices(
        out_features=UpperCAmelCase__			,		out_indices=UpperCAmelCase__			,		stage_names=UpperCAmelCase__						)
    # Number of channels for each stage. This is set in the transformer backbone model init
    lowercase__    :						Optional[int]       =			None



 def     UpperCAmelCase     (						self : Tuple			,		UpperCAmelCase__ : Optional[Any]						):

    """simple docstring"""






    lowercase__    :						List[Any]       =			config

    lowercase__    :						Optional[Any]       =			getattr(UpperCAmelCase__			,		"""use_timm_backbone"""			,		UpperCAmelCase__						)
    lowercase__    :						Optional[int]       =			BackboneType.TIMM if self.use_timm_backbone else BackboneType.TRANSFORMERS

    if self.backbone_type == BackboneType.TIMM:
       self._init_timm_backbone(UpperCAmelCase__						)
    elif self.backbone_type == BackboneType.TRANSFORMERS:
       self._init_transformers_backbone(UpperCAmelCase__						)
    else:
       raise ValueError(f'''backbone_type {self.backbone_type} not supported.'''						)



 @property
 def     UpperCAmelCase     (						self : int						):

    """simple docstring"""






    return self._out_features



 @out_features.setter
 def     UpperCAmelCase     (						self : Dict			,		UpperCAmelCase__ : List[str]						):

    """simple docstring"""






    lowercase__  ,       lowercase__    :						Optional[Any]       =			get_aligned_output_features_output_indices(
        out_features=UpperCAmelCase__			,		out_indices=UpperCAmelCase__			,		stage_names=self.stage_names						)



 @property
 def     UpperCAmelCase     (						self : List[str]						):

    """simple docstring"""






    return self._out_indices



 @out_indices.setter
 def     UpperCAmelCase     (						self : Optional[Any]			,		UpperCAmelCase__ : Union[Tuple[int], List[int]]						):

    """simple docstring"""






    lowercase__  ,       lowercase__    :						Any       =			get_aligned_output_features_output_indices(
        out_features=UpperCAmelCase__			,		out_indices=UpperCAmelCase__			,		stage_names=self.stage_names						)



 @property
 def     UpperCAmelCase     (						self : int						):

    """simple docstring"""






    return {stage: self.num_features[i] for i, stage in enumerate(self.stage_names						)}



 @property
 def     UpperCAmelCase     (						self : Optional[Any]						):

    """simple docstring"""






    return [self.out_feature_channels[name] for name in self.out_features]



 def     UpperCAmelCase     (						self : Optional[Any]			,		*UpperCAmelCase__ : Tuple			,		**UpperCAmelCase__ : Dict						):

    """simple docstring"""






    lowercase__    :						Optional[Any]       =			dict(inspect.signature(self.forward						).parameters						)
    lowercase__    :						Tuple       =			{k: v for k, v in kwargs.items() if k in signature}
    return self(*UpperCAmelCase__			,		**UpperCAmelCase__						)



 def     UpperCAmelCase     (						self : int			,		UpperCAmelCase__ : List[str]			,		UpperCAmelCase__ : Optional[bool] = None			,		UpperCAmelCase__ : Optional[bool] = None			,		UpperCAmelCase__ : Optional[bool] = None			,		):

    """simple docstring"""






    raise NotImplementedError("""This method should be implemented by the derived class."""						)







 def     UpperCAmelCase     (						self : Any						):

    """simple docstring"""






    lowercase__    :						Union[str, Any]       =			super().to_dict()
    lowercase__    :						Tuple       =			output.pop("""_out_features"""						)
    lowercase__    :						Union[str, Any]       =			output.pop("""_out_indices"""						)
    return output
class 							__snake_case:



 @property
 def     UpperCAmelCase     (						self : str						):

    """simple docstring"""






    return self._out_features



 @out_features.setter
 def     UpperCAmelCase     (						self : Union[str, Any]			,		UpperCAmelCase__ : List[str]						):

    """simple docstring"""






    lowercase__  ,       lowercase__    :						Dict       =			get_aligned_output_features_output_indices(
        out_features=UpperCAmelCase__			,		out_indices=UpperCAmelCase__			,		stage_names=self.stage_names						)



 @property
 def     UpperCAmelCase     (						self : Tuple						):

    """simple docstring"""






    return self._out_indices



 @out_indices.setter
 def     UpperCAmelCase     (						self : int			,		UpperCAmelCase__ : Union[Tuple[int], List[int]]						):

    """simple docstring"""






    lowercase__  ,       lowercase__    :						Any       =			get_aligned_output_features_output_indices(
        out_features=UpperCAmelCase__			,		out_indices=UpperCAmelCase__			,		stage_names=self.stage_names						)







 def     UpperCAmelCase     (						self : List[Any]						):

    """simple docstring"""






    lowercase__    :						Dict       =			super().to_dict()
    lowercase__    :						Union[str, Any]       =			output.pop("""_out_features"""						)
    lowercase__    :						Dict       =			output.pop("""_out_indices"""						)
    return output


