Convert sum to long to avoid overflow.