I think the latter is correct i.e total amount climbing, since if your did a loop ride, you would have zero net gain