Under construction

Still being built. Things may change

PIN Code Possibilities

Interview

Time limit3sMemory limit256 MB

Summary
Count n-digit codes with leading zeros allowed whose digits add up to s for each test case.
Level

Easy3 of 10

Topics
Dynamic programming, Combinatorics
Solved
No attempts yet

Problem

A PIN (Personal Identification Number) is a secret code that only its owner knows. PINs are used for authentication in many places, such as ATMs and telephone call centers. A PIN usually has four digits or more, and the number of digits depends on the required level of security. The more digits a PIN has, the harder it is to guess.

The total number of PINs is easy to count. Each position holds one of the ten digits 0 to 9, so a PIN with nn digits has 10n10^n possibilities. If you know something about the PIN, for example the sum of all of its digits, the number of candidates drops.

For a 3-digit PIN whose digits sum to 1, only three codes work: 001, 010 and 100. If the sum is 2, there are six: 011, 101, 110, 002, 020 and 200.

Given the number of digits nn and the sum of all digits ss, write a program that counts the possible PINs. A leading zero is allowed.

Input

The input consists of several test cases. Each line contains the number of digits nn and the sum of all digits ss, separated by a space. (2≤n≤72 \le n \le 7, 0≤s≤1000 \le s \le 100)

There are at most 1000 test cases. Process the input until it ends.

Output

For each test case, print the number of PINs that satisfy the condition, one per line. If no PIN satisfies the condition, print 0.

Examples3

  1. Example 1

    Input
    3 1
    3 2
    3 3
    2 1
    2 17
    4 40
    5 0
    
    Expected output
    3
    6
    10
    2
    2
    0
    1
    
  2. Example 2

    Input
    2 0
    
    Expected output
    1
    
  3. Example 3

    Input
    7 63
    7 62
    7 0
    7 1
    
    Expected output
    1
    7
    1
    7