how to calculate the sum of login