gets h=gets.split c=0 (h.size-2).times{|i|x,y,z=h[i,3] c+=(x