Setting sum equal to zero from beginning