How to do LCD (lowest common denominator)?