2820. How many different ways
Time Limit: 1.0 Seconds Memory Limit: 65536K
Total Runs: 288 Accepted Runs: 160
There is an easy math problem for you. Given you a positive integer K, indicating K different balls. The problem is to find out how many different ways to distribute all of the balls into some boxes (Of course, the box cannot be empty and all of the boxes are same). For example, if K = 3, so there are five different ways to distribute the balls:
The input will contain one or more test cases, one per line. Each test case contains a positive integer N. If N = 0 it signals the end of the input and isn't considered to be processed; otherwise, N will be a positive integer not more than 2000.
Output
For each test case, output a single line containing the number of different ways. Considering the answer may be very large, you should output the last four digits of the answer.