# Probability of the sum of boxes that pick a number at random

I'm trying to figure out how to solve a probability problem. Imagine there is some number of boxes, let's say 5 boxes, each box can present one of 3 numbers, let's say 1,2, or 3, and each number has some probability of being picked, let's say, for box 1, 1 has a 50% chance of being picked, 2 has 30% and 3 has 20%.

Now, to throw a wrench into everything, each of the boxes have different probabilities for each of the numbers, let's say for box 2, 1 has a 40% chance, 2 has a 50% chance, and 3 has a 10% chance. Do the same for the other boxes, giving each of the numbers different probabilities for being picked.

Each box must pick one of the 3 numbers based on the probabilities given to each of the numbers.

Given these parameters, how would you calculate the probability that the sum of the 5 boxes would return some number. For example, each of the boxes pick some number, what is the probability that the sum of those numbers would be 7, let's say?

Essentially, I want to calculate the probability for each of the possible sums of these boxes.

Let $$p_i(n_k)$$ be the probability to pick the number $$n_k$$ from the $$i$$-th box. Then the probability in question will be sum of products $$\sum_{\sigma:\; n_i\to n_k}\prod_i p_i(n_k)$$ where the sum runs over all distinct permutations of $$(n_1,n_2,\dots, n_K)$$ with $$\sum_{k=1}^K n_k=N$$. If there are several availble partitions of the number $$N$$ into $$(n_1,n_2,\dots, n_K)$$ the above procedure should be repeated for each of them and the resulting probabilities added.