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