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