




def 	_a      (						SCREAMING_SNAKE_CASE_							:				list     ):
					if any(not isinstance(SCREAMING_SNAKE_CASE_      ,      SCREAMING_SNAKE_CASE_     ) or x < 0 for x in sequence     ):
										raise TypeError("Sequence must be list of non-negative integers"     )
					for _ in range(len(SCREAMING_SNAKE_CASE_     )     ):
										for i, (rod_upper, rod_lower) in enumerate(zip(SCREAMING_SNAKE_CASE_      ,      sequence[1:]     )     ):
															if rod_upper > rod_lower:
																				sequence[i] -= rod_upper - rod_lower
																				sequence[i + 1] += rod_upper - rod_lower
					return sequence


if __name__ == "__main__":
					assert bead_sort([5, 4, 3, 2, 1]) == [1, 2, 3, 4, 5]
					assert bead_sort([7, 9, 4, 3, 5]) == [3, 4, 5, 7, 9]









'''simple docstring'''





def        a_     (							_lowerCAmelCase       )      ->      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'       )
  __lowerCamelCase       :       int           = ''
  while len(_lowerCAmelCase       ) % 3 != 0:
    __lowerCamelCase       :       str           = '0' + bin_string
  __lowerCamelCase       :       Union[str, Any]           = [
      bin_string[index : index + 3]
      for index in range(len(_lowerCAmelCase       )       )
      if index % 3 == 0
  ]
  for bin_group in bin_string_in_3_list:
    __lowerCamelCase       :       Tuple           = 0
    for index, val in enumerate(_lowerCAmelCase       ):
      oct_val += int(2 ** (2 - index) * int(_lowerCAmelCase       )       )
    oct_string += str(_lowerCAmelCase       )
  return oct_string


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

   testmod()






