#K70337. Dice Rolls Sum

    ID: 33286 Type: Default 1000ms 256MiB

Dice Rolls Sum

Dice Rolls Sum

You are given N dice, each with 6 faces numbered from 1 to 6. Your task is to determine the number of possible sequences of dice rolls that sum exactly to S.

Formally, if you roll N dice and let \(a_1, a_2, \dots, a_N\) be the outcomes (each \(1 \le a_i \le 6\)), you must count the number of sequences such that:

\[ a_1 + a_2 + \dots + a_N = S \]

You may assume that the order of dice rolls matters. Use dynamic programming to build up the solution.

inputFormat

The input is read from standard input and has the following format:

  • The first line contains a single integer T representing the number of test cases.
  • Each of the following T lines contains two space separated integers N and S, where N is the number of dice and S is the target sum.

outputFormat

For each test case, output a single line with one integer representing the number of sequences of dice rolls that sum up to S.

## sample
3
1 3
2 7
2 5
1

6 4

</p>