Source: http://www.math.u-bordeaux1.fr/~mibonnef/cpp-proba/correction-DS-CPP_proba-2013.pdf