Gates says military action against Iran and Syria would be costly