Embarrassingly easy when you have arbitrary precision integers!