South Korea to work with U.S. and North Korea after failed nuclear talks