Reduces a fraction using GCD.