A piece of land is in the shape of a square and its area is 1000 m2. This has to be fenced using barbed wire. The barbed wire is available only in integral lengths. What is the minimum length of the barbed wire that has to be bought for this purpose?