Number of ways of selling 5 products for 4 customers A merchant has $4$ types of products. Let the number of these $4$ products are $p,q,r,s$ respectively. (p-times 1st product, q-times 2nd product, r-times 3rd product, s-times 4th product)  In how many distinct ways can he sell products to $5$ customers? Customers are undistinguishable. Species of the same product are also undistinguishable.
Each customer buys exactly one product (if it is not out of sell).
I have tried for $(p,q,r,s)$ = $(3,3,3,3)$ $=$ $40$ ways
$(p,q,r,s)$ = $(3,3,3,4)$ = $43$ ways
$(p,q,r,s)$ = $(5,5,5,5)$ = $56$ ways.
My question is: Exists general formula for number of ways for $4$ types of products and $5$  customers?
Harder task (optional): Exists general formula for number of ways for $m$ types of products and $n$ customers? 
Thanks for any help.
 A: One way to approach this problem is Burnside's lemma. Let $S_5$ be the group of permutations of the $5$ customers, and $X$ the set of all possible sales where the names of the customers matter. For $\sigma\in S_5$ let $X^\sigma$ be the subset of $X$ containing all sales that are not changed when $\sigma$ is applied to the customers involved. Burnside's lemma gives the number of orbits of $X$ under the action of $S_5,$ i.e., the number of classes of sales when the identity of the customers does not matter:
$$|X/S_5|=\frac1{|S_5|}\sum_{\sigma\in S_5}|X^\sigma|.$$
In order to count $|X^\sigma|$ we have to consider the decomposition of $\sigma$ in disjoint cycles. There are 7 possibilities:
1 cycle of length 5 (transitive permutation): a sale is invariant under $\sigma$ only if all 5 customers buy the same product. There are no such sales in your first two examples, and 4 such sales in the last example (one for each product). There are $4!=24$ such permutations.
1 cycle of length 4: a sale is invariant if 4 out of 5 customers buy the same product; there is no restriction on the 5th customer (she may also buy the same product or a different one). There are $5\times3!$ such permutations. In the last example each such permutation leaves $4\times 4$ sales invariant; but there are no such sales in your first example and only $4$ such sales in your second example.
1 cycle of length 3, 1 cycle of length 2: 20 permutations. In the last example each permutation leaves $4\times4$ sales invariant.
1 cycle of length 3, 2 fixed points: 20 permutations. In the last example each of them leaves $4^3$ sales invariant.
2 cycles of length 2: 15 permutations. In the last example each of them leaves $4^3$ sales invariant.
1 cycle of length 2, 3 fixed points (i.e., just swapping two customers): 10 permutations. In the last example each of them leaves $4^4$ sales invariant.
The identical permutation. It leaves all sales invariant (in the last example there are $4^5$ of those).
For the last example Burnside's lemma then gives
$$|X/S_5|=\frac1{120}(24.4+30.16+20.16+20.64+15.64+10.256+1024)=56.$$
In this example the number of sales left invariant is always a power of $4$ (the number of products) and the exponent is the number of disjoint cycles in the permutation. This is not always true in the other examples because there the supply of some or all products is less than the number of customers, e.g., the first of the seven categories leaves zero sales invariant because there is no way for all 5 customers to buy the same product.
