I assume you are not actually trying to save money or energy this way, since the savings if any would be minuscule, but are doing a calculation for fun. In that case a simple rule of thumb is likely to give you all the savings you want, such as closing the door whenever the time is indeterminate and/or longer than, say, 10 seconds in expectation.
I assume you are not actually trying to save money or energy this way, since the savings if any would be minuscule, but are doing a calculation for fun. In that case a simple rule of thumb is likely to give you all the savings you want, such as closing the door whenever the time is indeterminate and/or longer than, say, 10 seconds in expectation.