Exact and Optimal Length Calculator