{"trustable":true,"sections":[{"title":"","value":{"format":"MD","content":"In Computer Science, Trie or prefix tree is a data structure which is usually used to store strings or numbers. Unlike binary trees, edges contain characters. And a node actually represents a string which is found by taking the characters from the edges, in the path from root to leaf. For example, for {abc, ae, bd, bb, bc, abd} we get the following trie:\n\n![Trie](CDN_BASE_URL/f02ff63a7ef237ee2f77aa324d32460c?v\u003d1715419294)\n\nNow you are given a set of strings and each string uses one of the **K** character symbols, and in any string (from the set) a symbol occurs at most once. Your task is to find the number of nodes required if we make a trie with the strings using the procedure described above. As you don\u0027t know the size of the set, your task is to find the worst case result. For example, if you have 2 character symbols, then you need 5 nodes in worst case as in the following trie (let the symbols be {a, b}):\n\n![Worst Trie with a,b](CDN_BASE_URL/c4230b028bdc8ecf51b7cdec66d334d7?v\u003d1715419294)"}},{"title":"Input","value":{"format":"MD","content":"Input starts with an integer **T (\u0026le; 10000)**, denoting the number of test cases.\n\nEach case starts with a line containing an integer **K (1 \u0026le; K \u0026le; 10\u003csup\u003e8\u003c/sup\u003e)**."}},{"title":"Output","value":{"format":"MD","content":"For each case, print the case number and the total number of nodes required in worst case. The result can be big, print the least 4 significant digits if result has 4 or more digits, otherwise, print the result."}},{"title":"Sample","value":{"format":"HTML","content":"\u003ctable class\u003d\u0027vjudge_sample\u0027\u003e\n\u003cthead\u003e\n \u003ctr\u003e\n \u003cth\u003eInput\u003c/th\u003e\n \u003cth\u003eOutput\u003c/th\u003e\n \u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd\u003e\u003cpre\u003e3\n1\n2\n3\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003eCase 1: 2\nCase 2: 5\nCase 3: 16\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}},{"title":"Note","value":{"format":"MD","content":"* The least 4 **significant digits** of 123456789 is 6789."}}]}