finding the perimeter of a polygon