UJ - Uncle Jack


Dear Uncle Jack is willing to give away some of his collectable CDs to his nephews. Among the titles you can find very rare albums of Hard Rock, Classical Music, Reggae and much more; each title is considered to be unique. Last week he was listening to one of his favorite songs, Nobody’s fool, and realized that it would be prudent to be aware of the many ways he can give away the CDs among some of his nephews.

So far he has not made up his mind about the total amount of CDs and the number of nephews. Indeed, a given nephew may receive no CDs at all.

Please help dear Uncle Jack, given the total number of CDs and the number of nephews, to calculate the number of different ways to distribute the CDs among the nephews.

Input

The input consists of several test cases. Each test case is given in a single line of the input by, space separated, integers N (1 <= N <= 1000) and D (0 <= D <= 2500), corresponding to the number of nephews and the number of CDs respectively. The end of the test cases is indicated with N = D = 0.

Output

The output consists of several lines, one per test case, following the order given by the input. Each line has the number of all possible ways to distribute D CDs among N nephews.

Example

Input:
1 20
3 10
0 0

Output:
1
59049

hide comments
ihg_2_26: 2018-08-19 08:53:34

Test Cases are loose

saurav52: 2017-08-20 17:52:44

This is the only option for c++ users.
#include <boost/multiprecision/cpp_int.hpp>

ayushgupta1997: 2017-05-26 20:59:41

can anyone tell why i am getting nzec in python3.I have used all ways to input

vineetpratik: 2017-04-02 14:16:13

c++ users can use <boost/multiprecision/cpp_int.hpp>
spoj supports it :)

cake_is_a_lie: 2017-02-22 15:01:21

Let's see, I *could* try really hard to fit this into 512B of c/c++ code. I *could* rage about how this will never work in Java. OR I could submit it in python. Thumbs down; useless problem is useless.

nonushikhar: 2016-06-07 12:38:34

i dont see the point of 512 bytes :|
ppl use python .....

vikas yadav: 2016-05-29 22:16:45

yes ! in c++ 0.05

Nallagatla Manikanta: 2015-10-22 20:27:57

4 lines in python :)

Lai Manh Tuan: 2015-08-12 12:08:09

lol 5 lines of code with Python

no name: 2015-03-04 21:05:42

Here comes my century with a single...:P


Added by:Camilo Andrés Varela León
Date:2006-10-25
Time limit:1s
Source limit:512B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: ERL JS-RHINO NODEJS PERL6 VB.NET
Resource:XX Colombian National Programming ACM 2006