That’s correct. Because total is an observed variable, sampling doesn’t propose new values for it. The sampler proposes values for the (unobserved) parameters (i.e., i and j) and then calculates the probability of the observed values. That’s why I separated the sum from the likelihood/observed variable.