I use great circle mapper. The result is typically only a few miles off from the system the airlines use (depending on the airline). I believe you need to count surface sectors.
BIO-LHR-YYZ-LAX-SYD-AKL-HKG-VVO-DME-LHR-MAD-BIO is above 29.000.
Great Circle Mapper
Could you turn AKL and SYD around? Or connect in Spain to go to YZ? Or end in MAD?