This is a pipes and cisterns problem. The rates of filling and emptying are usually expressed as the fraction of the tank filled or emptied per unit of time (e.g., per hour). When a leak is present during filling, the effective filling rate is the tap rate minus the leak rate.