solve for all lengths