Approximating Disrete Distributions, with Applications