#P2638. Password Storage Scheme

    ID: 15905 Type: Default 1000ms 256MiB

Password Storage Scheme

Password Storage Scheme

After Tesla's six‐digit password was easily cracked, doubts about the security of electric vehicles arose. In response, Li Hua designed his own password system. The system has \( n \) storage units, and each storage unit can store at most two different types of signals. There are two types of signals: \( 0 \) and \( 1 \). You are given \( a \) signals of type \( 0 \) and \( b \) signals of type \( 1 \). Note that a single \( 0 \) or \( 1 \) is counted as one signal, and you do not need to store all the signals.

In each storage unit, you may store any nonnegative number of \( 0 \)s and any nonnegative number of \( 1 \)s. A storage scheme is defined by assigning to each storage unit a pair \( (x_i, y_i) \) (where \( x_i \) is the number of \( 0 \)s and \( y_i \) is the number of \( 1 \)s stored in the \( i^{th} \) unit) such that:

[ \sum_{i=1}^n x_i \le a \quad \text{and} \quad \sum_{i=1}^n y_i \le b. ]

After processing, each different storage scheme becomes a different password. Your task is to determine the total number of possible storage schemes.

Hint: Note that the distributions for \( 0 \) signals and \( 1 \) signals are independent. The number of ways to distribute up to \( k \) identical items into \( n \) distinct bins is given by:

[ \sum_{i=0}^k \binom{n+i-1}{i} = \binom{n+k}{n}, ]

Thus, the answer is \( \binom{a+n}{n} \times \binom{b+n}{n} \).

inputFormat

The input consists of a single line with three integers \( n \), \( a \), and \( b \), separated by spaces.

outputFormat

Output a single integer, which is the total number of possible storage schemes.

sample

1 1 1
4