SPOJ 26: Build the Fence