Since the area equals length x width, and perimeter equals twice length plus twice width, let the length of the barn wall (b) be length:
A = (b)(w)
w = A/b
w = 1680/b
P = 2(b) + 2(1680/b)
Fence = P - b = b + 3360/b
This will work for whatever the size of the barn wall is.