Remember that "distance" in this problem means perimeter.