Time Limit:3000ms Memory Limit:65536KB

Description

There are k same bags and n distinct balls ,
in how many ways can we put the n balls into the k bags
without any ball left out of the bags , some bags may leave empty .

Input

Two integers per line , k (1<=k<=10) and n (1<=n<=10^5) ,

Output

One number per line , the number of different ways of putting n distinct balls into k same bags mod 512.

Sample Input

3 1
3 2
3 3
3 4

Sample Output

1
2
5
14

Source

Author

Cauchy