Sums of Distinct Natural Numbers

Interview

Time limit7sMemory limit128 MB

Summary
Count the partitions of each given N into distinct positive integers, including N itself, modulo 100999.
Level

Medium4 of 10

Topics
Dynamic programming, Combinatorics
Solved
No attempts yet

Problem

Count how many ways a positive integer NN (1≤N≤20001 \le N \le 2000) can be written as a sum of distinct natural numbers.

One way obeys all of the following.

  • Every natural number in the sum is different. No number may appear twice.
  • Two sums that differ only in the order of the terms count as one way.
  • The single-term sum NN itself counts as one way.

Given NN, write a program that counts the ways.

Input

The first line has the number of test cases TT (1≤T≤201 \le T \le 20). Each of the next TT lines has one NN.

Output

For each test case, print the number of ways to write NN as a sum of distinct natural numbers modulo 100999100999, one per line, in input order.

Examples1

  1. Example 1

    Input
    4
    5
    6
    10
    200
    
    Expected output
    3
    4
    10
    50568