code: 
  
  
  
  
  
  def       lowerCAmelCase__(	lowercase       :    int = 1000				) ->    int:
    __snake_case   :				int        =       0
    __snake_case   :				Optional[int]        =       0
    while 1:
      num += 3
      if num >= n:
        break
      total += num
      num += 2
      if num >= n:
        break
      total += num
      num += 1
      if num >= n:
        break
      total += num
      num += 3
      if num >= n:
        break
      total += num
      num += 1
      if num >= n:
        break
      total += num
      num += 2
      if num >= n:
        break
      total += num
      num += 3
      if num >= n:
        break
      total += num
    return total
  
  
  if __name__ == "__main__":
       print(F'''{solution() = }''')
  
  
style_context: 
  
  
  
  
  
  import torch
  from torch import autograd
  
  
  
  
  class 				_lowerCamelCase (    autograd.Function    ):
  
  
  
        """simple docstring"""
  
  
  
  
  
  
        @staticmethod
        def 						UpperCAmelCase		( UpperCAmelCase				,						UpperCAmelCase				,						UpperCAmelCase				,						UpperCAmelCase   )       ->   str:
  
  
  
  
  
  
          '''simple docstring'''
  
  
  
  
  
  
          __snake_case   :				Dict        =       inputs.numel()
          __snake_case   :				Optional[int]        =       int(0.005 * nb_elems   ) + 1
          if sigmoid:
            __snake_case   :				Any        =       (torch.sigmoid(UpperCAmelCase   ) > threshold).type(inputs.type()   )
          else:
            __snake_case   :				Optional[int]        =       (inputs > threshold).type(inputs.type()   )
          if mask.sum() < nb_min:
            # We limit the pruning so that at least 0.5% (half a percent) of the weights are remaining
            __snake_case   :				List[str]        =       inputs.flatten().kthvalue(max(nb_elems - nb_min				,						1   )   ).values
            __snake_case   :				Union[str, Any]        =       (inputs > k_threshold).type(inputs.type()   )
          return mask
  
  
  
  
  
  
  
        @staticmethod
        def 						UpperCAmelCase		( UpperCAmelCase				,						UpperCAmelCase   )       ->   Optional[int]:
  
  
  
  
  
  
          '''simple docstring'''
  
  
  
  
  
  
          return gradOutput, None, None
  
  
  
  
  class 				_lowerCamelCase (    autograd.Function    ):
  
  
  
        """simple docstring"""
  
  
  
  
  
  
        @staticmethod
        def 						UpperCAmelCase		( UpperCAmelCase				,						UpperCAmelCase				,						UpperCAmelCase   )       ->   Optional[int]:
  
  
  
  
  
  
          '''simple docstring'''
  
  
  
  
  
  
          __snake_case   :				Optional[int]        =       inputs.clone()
          __snake_case    ,   __snake_case   :				int        =       inputs.flatten().sort(descending=UpperCAmelCase   )
          __snake_case   :				Tuple        =       int(threshold * inputs.numel()   )
  
          # flat_out and mask access the same memory.
          __snake_case   :				Optional[int]        =       mask.flatten()
          __snake_case   :				Union[str, Any]        =       0
          __snake_case   :				Any        =       1
          return mask
  
  
  
  
  
  
  
        @staticmethod
        def 						UpperCAmelCase		( UpperCAmelCase				,						UpperCAmelCase   )       ->   List[str]:
  
  
  
  
  
  
          '''simple docstring'''
  
  
  
  
  
  
          return gradOutput, None
  
  
  
  
  class 				_lowerCamelCase (    a    ):
  
  
  
        """simple docstring"""
  
  
  
  
  
  
        @staticmethod
        def 						UpperCAmelCase		( UpperCAmelCase				,						UpperCAmelCase   )       ->   Any:
  
  
  
  
  
  
          '''simple docstring'''
  
  
  
  
  
  
          __snake_case   :				Union[str, Any]        =       inputs.clone()
          __snake_case    ,   __snake_case   :				Optional[Any]        =       inputs.abs().flatten().sort(descending=UpperCAmelCase   )
          __snake_case   :				List[Any]        =       int(threshold * inputs.numel()   )
  
          # flat_out and mask access the same memory.
          __snake_case   :				Optional[Any]        =       mask.flatten()
          __snake_case   :				Tuple        =       0
          __snake_case   :				Any        =       1
          return mask
  
  