detect summation of loop var