gets l=$<.map{|i|eval i.split*'+4*'} s=0;p l.any?{|j|s+=l.max-j;s%2>0}?-1:s/2