Your Rank is Pure (Large)

Count the subsets of 2 to n that contain n and whose repeated rank mapping from n reaches 1.

Medium7Dynamic programmingCombinatoricsNo attempts yetTime limit5sMemory limit512 MB

Problem

Pontius likes the number 127, and Woland explains why. 127 is the 31st prime. 31 is itself a prime, the 11th one. 11 is the 5th prime, 5 is the 3rd, 3 is the 2nd, and 2 is the 1st. Following the chain lands on 1, and 1 is not a prime.

This problem is about that chain. Fix a set SS of positive integers. The rank of an element xx of SS is the position of xx when the elements of SS are sorted in increasing order, counted from 1. Start at an element xx of SS and repeatedly replace the current number by its rank in SS. If this reaches 1 after finitely many steps, then xx is pure with respect to SS. Every number that appears before 1 has to belong to SS so that the next rank is defined, and 1 does not belong to SS.

Given nn, count the sets S{2,3,,n}S \subseteq \{2, 3, \dots, n\} for which nn is pure with respect to SS. A number outside SS has no rank, so nn itself belongs to SS. The count can be very large, so print it modulo 100003100003.

Input

The first line contains the number of test cases TT. Each of the following TT lines contains one integer nn.

Limits

  • T100T \le 100
  • 2n5002 \le n \le 500

Output

For each test case, print one line of the form "Case #x: y". Here x is the case number starting from 1, and y is the count described above taken modulo 100003100003.