Mikvaot, Chapter Four, Mishnah Four
1) Drawn water and rain water which were mixed together in a courtyard or in a cavity or on the steps of a cave:
a) If the greater part was valid, the whole is valid;
b) And if the greater part is invalid, the whole is invalid.
c) If they were equal in quantity, the whole is invalid.
2) When [does this apply]? When they were mingled together before they arrived at the mikveh.
3) If [the drawn water] flowed into the [rain] water: it was known that there fell in forty seahs of valid water before there came in three logs of drawn water, [the mikveh is] valid; otherwise it is invalid.
Section one: The “cavity” referred to here is a depression in the ground close to the mikveh, but not part of the mikveh. The steps of the cave are those that lead down into the mikveh (if you’re ever in an archaeological site in Israel you will see those all over the place). Thus in all three of these cases the waters that are mixed together have not yet arrived at the mikveh. This is important because if the drawn water had flowed directly into the mikveh and there were not forty seahs of valid water in the mikveh, the mikveh would be invalid.
In the cases listed here, as long as the majority is rain water, which is valid for use in the mikveh, the entire mikveh is valid.
Section two: The leniency in the above section applies only if they are mingling such that they cannot be recognized as coming from different sources before they get to the mikveh.
Section three: However, if the drawn water is recognizable as it flows into the rain water (for instance the drawn water has a different color), then for the mikveh to be valid we must be sure that there were forty seahs of valid water in the mikveh before three logs of drawn water got in. As a reminder, once forty seahs of valid water (not drawn water) are in the mikveh, it is not invalidated by the addition of drawn water.