
def 						SCREAMING_SNAKE_CASE__     (   __lowerCAmelCase     ,		__lowerCAmelCase				):

    # Check if the input is valid
    if not len(__lowerCAmelCase				) == len(__lowerCAmelCase				) == 3:
        raise ValueError("Please enter a valid equation."				)
    if equationa[0] == equationa[1] == equationa[0] == equationa[1] == 0:
        raise ValueError("Both a & b of two equations can't be zero."				)

    # Extract the coefficients
    snake_case__    ,       snake_case__    ,       snake_case__    =					equationa
    snake_case__    ,       snake_case__    ,       snake_case__    =					equationa

    # Calculate the determinants of the matrices
    snake_case__    =					aa * ba - aa * ba
    snake_case__    =					ca * ba - ca * ba
    snake_case__    =					aa * ca - aa * ca

    # Check if the system of linear equations has a solution (using Cramer's rule)
    if determinant == 0:
        if determinant_x == determinant_y == 0:
            raise ValueError("Infinite solutions. (Consistent system)"				)
        else:
            raise ValueError("No solution. (Inconsistent system)"				)
    else:
        if determinant_x == determinant_y == 0:
            # Trivial solution (Inconsistent system)
            return (0.0, 0.0)
        else:
            snake_case__    =					determinant_x / determinant
            snake_case__    =					determinant_y / determinant
            # Non-Trivial Solution (Consistent system)
            return (x, y)





def 						SCREAMING_SNAKE_CASE__     (   __lowerCAmelCase				):
    if any(not isinstance(__lowerCAmelCase     ,		__lowerCAmelCase				) or x < 0 for x in sequence				):
        raise TypeError("Sequence must be list of non-negative integers"				)
    for _ in range(len(__lowerCAmelCase				)				):
        for i, (rod_upper, rod_lower) in enumerate(zip(__lowerCAmelCase     ,		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]



