






'''simple docstring'''






from typing import List, Optional, Union

import numpy as np
import torch
import torchaudio.compliance.kaldi as ta_kaldi

from ...feature_extraction_sequence_utils import SequenceFeatureExtractor
from ...feature_extraction_utils import BatchFeature
from ...utils import PaddingStrategy, TensorType, logging


__A    	=   logging.get_logger(__name__)




class a_    (    snake_case__							):
   _snake_case        =							["""input_features""", """attention_mask"""]







   def __init__(self					,   __a=8_0					,   __a=1_6_0_0_0					,   __a=8_0					,   __a=0.0					,   __a=True					,   __a=True					,   __a=True					,   **__a					,   )			->      Dict:
      """simple docstring"""






      super().__init__(feature_size=_SCREAMING_SNAKE_CASE					,   sampling_rate=_SCREAMING_SNAKE_CASE					,   padding_value=_SCREAMING_SNAKE_CASE					,   **_SCREAMING_SNAKE_CASE)
      __snake_case				:      Dict     							= num_mel_bins
      __snake_case				:      Any     							= do_ceptral_normalize
      __snake_case				:      Dict     							= normalize_means
      __snake_case				:      int     							= normalize_vars
      __snake_case				:      str     							= True







   def     SCREAMING_SNAKE_CASE__					(self					,   __a					,   )			->      np.ndarray:
      """simple docstring"""






      __snake_case				:      List[str]     							= waveform * (2**1_5)  # Kaldi compliance: 16-bit signed integers
      __snake_case				:      int     							= torch.from_numpy(_SCREAMING_SNAKE_CASE).unsqueeze(0)
      __snake_case				:      List[str]     							= ta_kaldi.fbank(_SCREAMING_SNAKE_CASE					,   num_mel_bins=self.num_mel_bins					,   sample_frequency=self.sampling_rate)
      return features.numpy()







   @staticmethod
   def     SCREAMING_SNAKE_CASE__					(__a					,   __a					,   __a = True					,   __a = True					,   __a = 0.0					,   )			->      np.ndarray:
      """simple docstring"""






      if normalize_means:
         __snake_case				:      Union[str, Any]     							= x[:input_length].mean(axis=0)
         __snake_case				:      Tuple     							= np.subtract(_SCREAMING_SNAKE_CASE					,   _SCREAMING_SNAKE_CASE)
      if normalize_vars:
         __snake_case				:      Optional[Any]     							= x[:input_length].std(axis=0)
         __snake_case				:      Optional[int]     							= np.divide(_SCREAMING_SNAKE_CASE					,   _SCREAMING_SNAKE_CASE)

      if input_length < x.shape[0]:
         __snake_case				:      List[str]     							= padding_value

      # make sure array is in float32
      __snake_case				:      Tuple     							= x.astype(np.floataa)

      return x







   def     SCREAMING_SNAKE_CASE__					(self					,   __a					,   __a = None)			->      List[np.ndarray]:
      """simple docstring"""






      __snake_case				:      int     							= attention_mask.sum(-1) if attention_mask is not None else [x.shape[0] for x in input_features]
      return [
          self.utterance_cmvn(_SCREAMING_SNAKE_CASE					,   _SCREAMING_SNAKE_CASE					,   self.normalize_means					,   self.normalize_vars					,   self.padding_value)
          for x, n in zip(_SCREAMING_SNAKE_CASE					,   _SCREAMING_SNAKE_CASE)
      ]







   def __call__(self					,   __a					,   __a = False					,   __a = None					,   __a = False					,   __a = None					,   __a = None					,   __a = None					,   __a = None					,   **__a					,   )			->      BatchFeature:
      """simple docstring"""






      if sampling_rate is not None:
         if sampling_rate != self.sampling_rate:
            raise ValueError(
                F"""The model corresponding to this feature extractor: {self} was trained using a sampling rate of"""
                F""" {self.sampling_rate}. Please make sure that the provided `raw_speech` input was sampled with"""
                F""" {self.sampling_rate} and not {sampling_rate}.""")
      else:
         logger.warning(
             'It is strongly recommended to pass the `sampling_rate` argument to this function. '
             'Failing to do so can result in silent errors that might be hard to debug.')

      __snake_case				:      Dict     							= isinstance(_SCREAMING_SNAKE_CASE					,   np.ndarray) and len(raw_speech.shape) > 1
      if is_batched_numpy and len(raw_speech.shape) > 2:
         raise ValueError(F"""Only mono-channel audio is supported for input to {self}""")
      __snake_case				:      Optional[int]     							= is_batched_numpy or (
          isinstance(_SCREAMING_SNAKE_CASE					,   (list, tuple)) and (isinstance(raw_speech[0]					,   (np.ndarray, tuple, list)))
      )

      if is_batched:
         __snake_case				:      Any     							= [np.asarray(_SCREAMING_SNAKE_CASE					,   dtype=np.floataa) for speech in raw_speech]
      elif not is_batched and not isinstance(_SCREAMING_SNAKE_CASE					,   np.ndarray):
         __snake_case				:      Tuple     							= np.asarray(_SCREAMING_SNAKE_CASE					,   dtype=np.floataa)
      elif isinstance(_SCREAMING_SNAKE_CASE					,   np.ndarray) and raw_speech.dtype is np.dtype(np.floataa):
         __snake_case				:      Union[str, Any]     							= raw_speech.astype(np.floataa)

      # always return batch
      if not is_batched:
         __snake_case				:      str     							= [raw_speech]

      # extract fbank features
      __snake_case				:      List[Any]     							= [self._extract_fbank_features(_SCREAMING_SNAKE_CASE) for waveform in raw_speech]

      # convert into correct format for padding
      __snake_case				:      str     							= BatchFeature({'input_features': features})

      __snake_case				:      Dict     							= self.pad(
          _SCREAMING_SNAKE_CASE					,   padding=_SCREAMING_SNAKE_CASE					,   max_length=_SCREAMING_SNAKE_CASE					,   truncation=_SCREAMING_SNAKE_CASE					,   pad_to_multiple_of=_SCREAMING_SNAKE_CASE					,   return_attention_mask=_SCREAMING_SNAKE_CASE					,   **_SCREAMING_SNAKE_CASE					,   )

      # make sure list is in array format
      __snake_case				:      List[str]     							= padded_inputs.get('input_features')
      if isinstance(input_features[0]					,   _SCREAMING_SNAKE_CASE):
         __snake_case				:      Union[str, Any]     							= [np.asarray(_SCREAMING_SNAKE_CASE					,   dtype=np.floataa) for feature in input_features]

      __snake_case				:      Optional[int]     							= padded_inputs.get('attention_mask')
      if attention_mask is not None:
         __snake_case				:      int     							= [np.asarray(_SCREAMING_SNAKE_CASE					,   dtype=np.intaa) for array in attention_mask]

      # Utterance-level cepstral mean and variance normalization
      if self.do_ceptral_normalize:
         __snake_case				:      Any     							= (
             np.array(_SCREAMING_SNAKE_CASE					,   dtype=np.intaa)
             if self._get_padding_strategies(_SCREAMING_SNAKE_CASE					,   max_length=_SCREAMING_SNAKE_CASE) is not PaddingStrategy.DO_NOT_PAD
             else None
         )
         __snake_case				:      Union[str, Any]     							= self.normalize(
             padded_inputs['input_features']					,   attention_mask=_SCREAMING_SNAKE_CASE)

      if return_tensors is not None:
         __snake_case				:      str     							= padded_inputs.convert_to_tensors(_SCREAMING_SNAKE_CASE)

      return padded_inputs







'''simple docstring'''






def        _SCREAMING_SNAKE_CASE  (				A  :       int  )    -> int:







   """simple docstring"""
   __snake_case				:      str     							= 1
   for i in range(1  ,		num + 1  ):
      fact *= i
   return fact




def        _SCREAMING_SNAKE_CASE  (				A  :       int  )    -> int:







   """simple docstring"""
   __snake_case				:      Union[str, Any]     							= 0
   while number > 0:
      __snake_case				:      Dict     							= number % 10
      sum_of_digits += last_digit
      __snake_case				:      Union[str, Any]     							= number // 10  # Removing the last_digit from the given number
   return sum_of_digits




def        _SCREAMING_SNAKE_CASE  (				A  :       int = 1_00  )    -> int:







   """simple docstring"""
   __snake_case				:      List[Any]     							= factorial(A  )
   __snake_case				:      Dict     							= split_and_add(A  )
   return result


if __name__ == "__main__":
      print(solution(int(input('''Enter the Number: ''').strip())))