Calculating the perimeter of multiple shapes