Claire bought just enough fencing to enclose either a rectangular garden or a triangular garden, as shown. The two gardens have the same perimeter. How many feet of fencing did she buy?