← RoseCode

ROSECODE 570

Balls in the boxes

C_K_Yang · Math ·

We have several blue balls and red balls and we want to put them into boxes.

The rules for placing the balls into boxes are described below.

  • Each box contains at least 2 balls and at most 6 balls.
  • Each box contains at least 1 red ball and at most 4 blue balls.
  • Balls are different from each other, even they have the same color.
  • The order of the box doesn't matter. The order of each ball in the box doesn't matter.

For example, if we have 3 blue balls and 2 red balls. There are 7 different ways to put them into boxes.

(1). {B1,R1}, {B2,B3,R2}
(2). {B1,R2}, {B2,B3,R1}
(3). {B2,R1}, {B1,B3,R2}
(4). {B2,R2}, {B1,B3,R1}
(5). {B3,R1}, {B1,B2,R2}
(6). {B3,R2}, {B1,B2,R1}
(7). {B1,B2,B3,R1,R2}

Let W(B,R) be the number of different ways to place B blue balls and R red balls into the boxes.

You are given W(3,2)=7, W(5,4)=1510 and W(31,27)336072473(mod1000000007)

Find W(3141,2718)mod1000000007