Calculating length from given information