def linearCombo(c)
    sb = 
    c.each_with_index { |n, i|
        if n == 0 then
            next
        end
        if n < 0 then
            if sb.length == 0 then
                op = 
            else
                op = 
            end
        elsif n > 0 then
            if sb.length > 0 then
                op = 
            else
                op = 
            end
        else
            op = 
        end
        av = n.abs()
        if av!= 1 then
            coeff =  % [av]
        else
            coeff = 
        end
        sb = sb +  % [op, coeff, i + 1]
    }
    if sb.length == 0 then
        return 
    end
    return sb
end

def main
    combos = [
        [1, 2, 3],
        [0, 1, 2, 3],
        [1, 0, 3, 4],
        [1, 2, 0],
        [0, 0, 0],
        [0],
        [1, 1, 1],
        [-1, -1, -1],
        [-1, -2, 0, -3],
        [-1],
    ]

    for c in combos do
        print  % [c, linearCombo(c)]
    end
end

main()