$<.each do |l|
  d = l.split(',').map(&:to_i)
  ls = d[0...10].inject(0){|s, n| s += n}
  h = ls.to_f/(d[10]+d[11])
  p d[0...10].inject([0, h*d[10]]){|arr, l| arr[1] > 0 ? [arr[0]+1, arr[1]-d[arr[0]]] : arr}[0]
end