Remove duplicates in nominator and denominator.