a = [] 10.times do a.push(rand(-15...16)) end print("#{a}\n") t = false r = 0 a.each do |i| if t r += i.abs else if i < 0 t = true end end end puts r