resource r (int i)
	write (i)

	final {
		write (-i)
	}
end

resource s      import r
body s (int i)
	cap r  c1,c2

	write (i*100)
	c1 = create r (i)
	c2 = create r (i*2)

	final {
		destroy c1
		destroy c2
		write (-i*100)
	}
end

resource t      import  s
body t ()
	int  i

	i = 1
	while (i <= 100) {
		write(i*1000)
		cap s  c
		c = create s (i)
		destroy c
		write(-i*1000)
		i = i+1
	}
end
