Washington Post’s shares gain after TV units boost profit