Pipes and cisterns questions look different from time and work, but the method is the same. A pipe that fills a tank in 12 hours fills 1/12 of the tank every hour. That hourly fraction is its rate, and rates are what you add.
The new element is direction. An inlet adds water, so its rate is positive. An outlet, a waste pipe or a leak removes water, so its rate is negative. Add all the rates, with signs, to get the net rate. The time to fill or empty the tank is the reciprocal of that net rate.
Net rate = sum of inlet rates − sum of outlet rates; time = 1 ÷ net rate. A negative net rate means the tank is emptying.