calculating cable lengths