You start with {x, y, z=0, a, b=0} and then reversibly compute z+=x; z+=y, b+=z; b+=a to end up with {x, y, z=x+y, a, b=x+y+a} from which you could reversibly compute the starting state again with b-=a, etc.
1) Perform some reversible operation
2) Copy answer to another location (At some cost in heat)
3) Perform reverse operation, which rolls back memory to starting point
When you're done you have zeroed out memory, and the only costly operation was the copying of the answer.