Exact evaluation of the effect of an arbitrary mean flow in kinematic dynamo theory