Section 29. The department shall determine, ad nearly as possible, the number of miles of such public ways in towns entitled to the benefits under section twenty-six, and shall inform the selectmen of such towns of the contributions required from them under said section.