gets;p %w{S W E N}.map{|c|$_.count(c)*1i**$.+=1}.sum.abs