





"""simple docstring"""
def      __lowerCamelCase   (							a_     :		str							)			->      str:
      if not all(char in '''01''' for char in bin_string							):
            raise ValueError('''Non-binary value was passed to the function'''							)
      if not bin_string:
            raise ValueError('''Empty string was passed to the function'''							)
      __SCREAMING_SNAKE_CASE   :Tuple						=  ''''''
      while len(a_							) % 3 != 0:
            __SCREAMING_SNAKE_CASE   :Optional[int]						=  '''0''' + bin_string
      __SCREAMING_SNAKE_CASE   :Dict						=  [
          bin_string[index : index + 3]
          for index in range(len(a_							)							)
          if index % 3 == 0
      ]
      for bin_group in bin_string_in_3_list:
            __SCREAMING_SNAKE_CASE   :Tuple						=  0
            for index, val in enumerate(a_							):
                  oct_val += int(2 ** (2 - index) * int(a_							)							)
            oct_string += str(a_							)
      return oct_string


if __name__ == "__main__":
  from doctest import testmod

  testmod()






"""simple docstring"""
def      __lowerCamelCase   (							a_     :		int ,   a_     :		str							)			->      Optional[int]:
      __SCREAMING_SNAKE_CASE   :Optional[int]						=  [1]
      for i in range(2 ,   a_							):
            factorials.append(factorials[-1] * i							)
      assert 0 <= k < factorials[-1] * n, "k out of bounds"

      __SCREAMING_SNAKE_CASE   :List[str]						=  []
      __SCREAMING_SNAKE_CASE   :Optional[Any]						=  list(range(a_							)							)

      # Find permutation
      while factorials:
            __SCREAMING_SNAKE_CASE   :Optional[int]						=  factorials.pop()
            __SCREAMING_SNAKE_CASE				,__SCREAMING_SNAKE_CASE   :Dict						=  divmod(a_ ,   a_							)
            permutation.append(elements[number]							)
            elements.remove(elements[number]							)
      permutation.append(elements[0]							)

      return permutation


if __name__ == "__main__":
  import doctest

  doctest.testmod()