s=gets p Complex(*%w(N S E W).map{|c|s.count c}.each_slice(2).map{|i,j|(i-j).abs}).abs