Solution 1: Recursive formula S (x, y) = S (x- 1, y) * y+s (x- 1, y- 1). Because putting the X ball in the Y box is equivalent to putting the X- 1 ball first, and then putting the last one. There are two ways to put the last one: put it in the box with the ball in front or monopolize a box. The former corresponds to S(x- 1, y)*y (putting it in different boxes is different because the original balls in the boxes are different), while the latter corresponds to S(x- 1, y- 1).
Scheme 2: 7 balls are put into 4 boxes, which is nothing more than 2+2+2+ 1 or 3+2+ 1 or 4+1. So solve them separately and add them up: c (7,1) * c (6,2) * c (4,2) * c (2,2)/p (3,3)+c (7 * 3) * c (4,2)+c (7,2).