dataset
stringclasses
1 value
solutions
null
task_id
int64
0
467
exe_method
stringclasses
1 value
example_input
sequencelengths
1
5
example_output
sequencelengths
1
5
test_input
sequencelengths
1
20
test_output
sequencelengths
1
20
question
stringlengths
474
5.27k
test_time_limit
int64
1
1
Codeforces_test
null
401
stdin
[ "8\n3 9 2\n4 9 1\n7 9 2\n2 10 2\n154 220 2\n147 294 2\n998 24435 3\n1 1000000000 2\n" ]
[ "2\n6\n0\n4\n0\n1\n7148\n500000000\n" ]
[ "8\n3 9 2\n4 9 1\n7 9 2\n2 10 2\n154 220 2\n147 294 2\n998 24435 3\n1 1000000000 2\n" ]
[ "2\n6\n0\n4\n0\n1\n7148\n500000000\n" ]
You are given a positive integer $$$k$$$ and a set $$$S$$$ of all integers from $$$l$$$ to $$$r$$$ (inclusive). You can perform the following two-step operation any number of times (possibly zero): 1. First, choose a number $$$x$$$ from the set $$$S$$$, such that there are at least $$$k$$$ multiples of $$$x$$$ in $$$S$$$ (including $$$x$$$ itself); 2. Then, remove $$$x$$$ from $$$S$$$ (note that nothing else is removed). Find the maximum possible number of operations that can be performed. Input format: Each test contains multiple test cases. The first line of the input contains a single integer $$$t$$$ ($$$1\le t\le 10^4$$$) — the number of test cases. The description of test cases follows. The only line of each test case contains three integers $$$l$$$, $$$r$$$, and $$$k$$$ ($$$1\le l\le r\leq 10^9$$$, $$$1\leq k\le r-l+1$$$) — the minimum integer in $$$S$$$, the maximum integer in $$$S$$$, and the parameter $$$k$$$. Output format: For each test case, output a single integer — the maximum possible number of operations that can be performed. Example Input 0: 8 3 9 2 4 9 1 7 9 2 2 10 2 154 220 2 147 294 2 998 24435 3 1 1000000000 2 Example Output 0: 2 6 0 4 0 1 7148 500000000 Notes: In the first test case, initially, $$$S = \{3,4,5,6,7,8,9\}$$$. One possible optimal sequence of operations is: 1. Choose $$$x = 4$$$ for the first operation, since there are two multiples of $$$4$$$ in $$$S$$$: $$$4$$$ and $$$8$$$. $$$S$$$ becomes equal to $$$\{3,5,6,7,8,9\}$$$; 2. Choose $$$x = 3$$$ for the second operation, since there are three multiples of $$$3$$$ in $$$S$$$: $$$3$$$, $$$6$$$, and $$$9$$$. $$$S$$$ becomes equal to $$$\{5,6,7,8,9\}$$$. In the second test case, initially, $$$S=\{4,5,6,7,8,9\}$$$. One possible optimal sequence of operations is: 1. Choose $$$x = 5$$$, $$$S$$$ becomes equal to $$$\{4,6,7,8,9\}$$$; 2. Choose $$$x = 6$$$, $$$S$$$ becomes equal to $$$\{4,7,8,9\}$$$; 3. Choose $$$x = 4$$$, $$$S$$$ becomes equal to $$$\{7,8,9\}$$$; 4. Choose $$$x = 8$$$, $$$S$$$ becomes equal to $$$\{7,9\}$$$; 5. Choose $$$x = 7$$$, $$$S$$$ becomes equal to $$$\{9\}$$$; 6. Choose $$$x = 9$$$, $$$S$$$ becomes equal to $$$\{\}$$$. In the third test case, initially, $$$S=\{7,8,9\}$$$. For each $$$x$$$ in $$$S$$$, no multiple of $$$x$$$ other than $$$x$$$ itself can be found in $$$S$$$. Since $$$k = 2$$$, you can perform no operations. In the fourth test case, initially, $$$S=\{2,3,4,5,6,7,8,9,10\}$$$. One possible optimal sequence of operations is: 1. Choose $$$x = 2$$$, $$$S$$$ becomes equal to $$$\{3,4,5,6,7,8,9,10\}$$$; 2. Choose $$$x = 4$$$, $$$S$$$ becomes equal to $$$\{3,5,6,7,8,9,10\}$$$; 3. Choose $$$x = 3$$$, $$$S$$$ becomes equal to $$$\{5,6,7,8,9,10\}$$$; 4. Choose $$$x = 5$$$, $$$S$$$ becomes equal to $$$\{6,7,8,9,10\}$$$.
1
Codeforces_test
null
402
stdin
[ "3\n6 1 1\n1 3 3\n10 1 2\n" ]
[ "14\n1\n53\n" ]
[ "3\n6 1 1\n1 3 3\n10 1 2\n", "1\n1 1 1\n", "1\n437300461 96625 34833\n", "1\n910351181 78173 15387\n", "1\n793467309 94313 52836\n", "1\n971550733 43158 33390\n", "1\n854666861 92002 38136\n", "10\n33854166 29066 49060\n32759898 53835 75905\n78083558 64545 62296\n47722624 64272 48425\n3707310 69455 39398\n54203928 38467 3960\n31571982 10075 68047\n65568487 56019 35649\n66022256 60400 12229\n46632160 43622 10345\n", "10\n11937590 77910 62317\n63422079 46192 21977\n12888245 48533 96451\n24994103 24712 75464\n41507401 63185 42425\n31651845 43085 84222\n10035408 50123 55987\n85716265 63529 10033\n93368817 70608 6450\n32089725 90638 86023\n", "10\n95053718 26754 67063\n89051557 28150 24946\n87884420 32521 63311\n7298285 85151 35208\n79307491 65426 80044\n14132466 90808 31780\n78433426 47068 52440\n60639851 3742 75904\n20715378 80817 67968\n57738778 72247 85893\n", "10\n68104438 42895 47617\n19713738 53211 3723\n12623700 16509 97466\n94635171 78295 70760\n71883389 59155 74559\n91580383 38530 36234\n51864148 11309 16189\n80787628 87059 50287\n43029235 23729 62189\n38163639 62367 20356\n", "10\n51220566 24443 85066\n90567408 2465 49796\n47428387 497 31622\n76939354 38735 30503\n14716183 61396 44882\n14252492 43149 83792\n20262166 84062 4129\n935406 61864 24670\n65343092 9745 56410\n18588500 43975 20226\n", "1\n665120731 50406 87091\n", "1\n843204155 99251 24540\n", "1\n21287579 48095 5094\n", "1\n199371003 72747 85648\n", "1\n82487131 21592 23097\n", "1\n260570555 37732 36355\n", "1\n438653979 86577 41101\n", "1\n1000000000 100000 100000\n" ]
[ "14\n1\n53\n", "1\n", "49488359\n", "400820889\n", "782606669\n", "69892732\n", "228818698\n", "709113841\n853853654\n191196773\n702907510\n397887101\n320084139\n818836875\n661913564\n916869136\n216310942\n", "725044695\n564214506\n974277617\n939267073\n206169492\n792733781\n432236563\n484626689\n916449219\n657450118\n", "695688191\n770056423\n606377588\n872214590\n843944293\n626155071\n707563713\n692599575\n190797559\n305057518\n", "147112248\n912938221\n132963514\n80861124\n242654962\n771240444\n625522388\n713215583\n357663073\n944127626\n", "739004279\n39067574\n124576989\n396021404\n357521528\n838157718\n233645370\n372466701\n757096460\n988887997\n", "566793373\n", "604828018\n", "732697221\n", "150837339\n", "715887445\n", "283581242\n", "576188257\n", "388462163\n" ]
Let $$$n$$$ and $$$d$$$ be positive integers. We build the the divisor tree $$$T_{n,d}$$$ as follows: - The root of the tree is a node marked with number $$$n$$$. This is the $$$0$$$-th layer of the tree. - For each $$$i$$$ from $$$0$$$ to $$$d - 1$$$, for each vertex of the $$$i$$$-th layer, do the following. If the current vertex is marked with $$$x$$$, create its children and mark them with all possible distinct divisors$$$^\dagger$$$ of $$$x$$$. These children will be in the $$$(i+1)$$$-st layer. - The vertices on the $$$d$$$-th layer are the leaves of the tree. For example, $$$T_{6,2}$$$ (the divisor tree for $$$n = 6$$$ and $$$d = 2$$$) looks like this: Define $$$f(n,d)$$$ as the number of leaves in $$$T_{n,d}$$$. Given integers $$$n$$$, $$$k$$$, and $$$d$$$, please compute $$$\sum\limits_{i=1}^{n} f(i^k,d)$$$, modulo $$$10^9+7$$$. $$$^\dagger$$$ In this problem, we say that an integer $$$y$$$ is a divisor of $$$x$$$ if $$$y \ge 1$$$ and there exists an integer $$$z$$$ such that $$$x = y \cdot z$$$. Input format: Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). The description of the test cases follows. The only line of each test case contains three integers $$$n$$$, $$$k$$$, and $$$d$$$ ($$$1 \le n \le 10^9$$$, $$$1 \le k,d \le 10^5$$$). It is guaranteed that the sum of $$$n$$$ over all test cases does not exceed $$$10^9$$$. Output format: For each test case, output $$$\sum\limits_{i=1}^{n} f(i^k,d)$$$, modulo $$$10^9+7$$$. Example Input 0: 3 6 1 1 1 3 3 10 1 2 Example Output 0: 14 1 53 Notes: In the first test case, $$$n = 6$$$, $$$k = 1$$$, and $$$d = 1$$$. Thus, we need to find the total number of leaves in the divisor trees $$$T_{1,1}$$$, $$$T_{2,1}$$$, $$$T_{3,1}$$$, $$$T_{4,1}$$$, $$$T_{5,1}$$$, $$$T_{6,1}$$$. - $$$T_{1,1}$$$ has only one leaf, which is marked with $$$1$$$. - $$$T_{2,1}$$$ has two leaves, marked with $$$1$$$ and $$$2$$$. - $$$T_{3,1}$$$ has two leaves, marked with $$$1$$$ and $$$3$$$. - $$$T_{4,1}$$$ has three leaves, marked with $$$1$$$, $$$2$$$, and $$$4$$$. - $$$T_{5,1}$$$ has two leaves, marked with $$$1$$$ and $$$5$$$. - $$$T_{6,1}$$$ has four leaves, marked with $$$1$$$, $$$2$$$, $$$3$$$, and $$$6$$$. The total number of leaves is $$$1 + 2 + 2 + 3 + 2 + 4 = 14$$$. In the second test case, $$$n = 1$$$, $$$k = 3$$$, $$$d = 3$$$. Thus, we need to find the number of leaves in $$$T_{1,3}$$$, because $$$1^3 = 1$$$. This tree has only one leaf, so the answer is $$$1$$$.
1
Codeforces_test
null
403
stdin
[ "3\n4 2 2\n1 2 3 4\n1 1\n1 2\n1 1\n3 6 2\n1 2 3\n1 1 2 3 3 2\n3 3\n2 2\n4 6 2\n3 1 4 2\n3 1 1 2 3 4\n3 4\n4 2\n" ]
[ "YA\nTIDAK\nYA\nYA\nTIDAK\nYA\nTIDAK\nYA\nYA\n" ]
[ "3\n4 2 2\n1 2 3 4\n1 1\n1 2\n1 1\n3 6 2\n1 2 3\n1 1 2 3 3 2\n3 3\n2 2\n4 6 2\n3 1 4 2\n3 1 1 2 3 4\n3 4\n4 2\n" ]
[ "YA\nTIDAK\nYA\nYA\nTIDAK\nYA\nTIDAK\nYA\nYA\n" ]
This is the hard version of the problem. In the two versions, the constraints on $$$q$$$ and the time limit are different. In this version, $$$0 \leq q \leq 2 \cdot 10^5$$$. You can make hacks only if all the versions of the problem are solved. A team consisting of $$$n$$$ members, numbered from $$$1$$$ to $$$n$$$, is set to present a slide show at a large meeting. The slide show contains $$$m$$$ slides. There is an array $$$a$$$ of length $$$n$$$. Initially, the members are standing in a line in the order of $$$a_1, a_2, \ldots, a_n$$$ from front to back. The slide show will be presented in order from slide $$$1$$$ to slide $$$m$$$. Each section will be presented by the member at the front of the line. After each slide is presented, you can move the member at the front of the line to any position in the lineup (without changing the order of the rest of the members). For example, suppose the line of members is $$$[\color{red}{3},1,2,4]$$$. After member $$$3$$$ presents the current slide, you can change the line of members into either $$$[\color{red}{3},1,2,4]$$$, $$$[1,\color{red}{3},2,4]$$$, $$$[1,2,\color{red}{3},4]$$$ or $$$[1,2,4,\color{red}{3}]$$$. There is also an array $$$b$$$ of length $$$m$$$. The slide show is considered good if it is possible to make member $$$b_i$$$ present slide $$$i$$$ for all $$$i$$$ from $$$1$$$ to $$$m$$$ under these constraints. However, your annoying boss wants to make $$$q$$$ updates to the array $$$b$$$. In the $$$i$$$-th update, he will choose a slide $$$s_i$$$ and a member $$$t_i$$$ and set $$$b_{s_i} := t_i$$$. Note that these updates are persistent, that is changes made to the array $$$b$$$ will apply when processing future updates. For each of the $$$q+1$$$ states of array $$$b$$$, the initial state and after each of the $$$q$$$ updates, determine if the slideshow is good. Input format: Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). The description of the test cases follows. The first line of each test case contains three integers $$$n$$$, $$$m$$$ and $$$q$$$ ($$$1 \le n, m \le 2 \cdot 10^5$$$; $$$0 \leq q \leq 2 \cdot 10^5$$$) — the number of members and the number of sections. The second line of each test case contains $$$n$$$ integers $$$a_1,a_2,\ldots,a_n$$$ ($$$1 \le a_i \le n$$$) — the initial order of the members from front to back. It is guaranteed that each integer from $$$1$$$ to $$$n$$$ appears exactly once in $$$a$$$. The third line of each test case contains $$$m$$$ integers $$$b_1, b_2, \ldots, b_m$$$ ($$$1 \le b_i \le n$$$) — the members who should present each section. Each of the next $$$q$$$ lines contains two integers $$$s_i$$$ and $$$t_i$$$ ($$$1 \le s_i \le m$$$, $$$1 \le t_i \le n$$$) — parameters of an update. It is guaranteed that the sum of $$$n$$$, the sum of $$$m$$$ and the sum of $$$q$$$ over all test cases do not exceed $$$2 \cdot 10^5$$$ respectively. Output format: For each test case, output $$$q+1$$$ lines corresponding to the $$$q+1$$$ states of the array $$$b$$$. Output "YA" if the slide show is good, and "TIDAK" otherwise. You can output the answer in any case (upper or lower). For example, the strings "yA", "Ya", "ya", and "YA" will be recognized as positive responses. Example Input 0: 3 4 2 2 1 2 3 4 1 1 1 2 1 1 3 6 2 1 2 3 1 1 2 3 3 2 3 3 2 2 4 6 2 3 1 4 2 3 1 1 2 3 4 3 4 4 2 Example Output 0: YA TIDAK YA YA TIDAK YA TIDAK YA YA Notes: For the first test case, you do not need to move the members as both slides are presented by member $$$1$$$, who is already at the front of the line. After that, set $$$b_1 := 2$$$, now slide $$$1$$$ must be presented by member $$$2$$$ which is impossible as member $$$1$$$ will present slide $$$1$$$ first. Then, set $$$b_1 = 1$$$, the $$$b$$$ is the same as the initial $$$b$$$, making a good presentation possible.
1
Codeforces_test
null
404
stdin
[ "2\n6\n\n0\n\n2\n\n3\n\n5\n\n3\n" ]
[ "xor 1 1\n\nxor 2 2\n\nxor 3 3\n\nxor 4 6\n\nans 2 3 5\n\nans 1 2 3\n" ]
[ "2\n6 2 3 5\n3 1 2 3\n", "7\n1000000000000000000 1000000000000000000 1 2\n1000000000000000000 2 1 1000000000000000000\n1000000000000000000 2 1000000000000000000 1\n1000000000000000000 4096 2048 6144\n1000000000000000000 864691128455135232 576460752303423488 288230376151711744\n864691128455135232 864691128455135232 576460752303423488 288230376151711744\n12288 8191 12287 12288\n", "1\n19 17 18 19\n", "1\n114514 114 514 1919\n" ]
[ "1\n1\n", "1\n1\n1\n1\n1\n1\n1\n", "1\n", "1\n" ]
This is an interactive problem. The Department of Supernatural Phenomena at the Oxenfurt Academy has opened the Library of Magic, which contains the works of the greatest sorcerers of Redania — $$$n$$$ ($$$3 \leq n \leq 10^{18}$$$) types of books, numbered from $$$1$$$ to $$$n$$$. Each book's type number is indicated on its spine. Moreover, each type of book is stored in the library in exactly two copies! And you have been appointed as the librarian. One night, you wake up to a strange noise and see a creature leaving the building through a window. Three thick tomes of different colors were sticking out of the mysterious thief's backpack. Before you start searching for them, you decide to compute the numbers $$$a$$$, $$$b$$$, and $$$c$$$ written on the spines of these books. All three numbers are distinct. So, you have an unordered set of tomes, which includes one tome with each of the pairwise distinct numbers $$$a$$$, $$$b$$$, and $$$c$$$, and two tomes for all numbers from $$$1$$$ to $$$n$$$, except for $$$a$$$, $$$b$$$, and $$$c$$$. You want to find these values $$$a$$$, $$$b$$$, and $$$c$$$. Since you are not working in a simple library, but in the Library of Magic, you can only use one spell in the form of a query to check the presence of books in their place: - "xor l r" — Bitwise XOR query with parameters $$$l$$$ and $$$r$$$. Let $$$k$$$ be the number of such tomes in the library whose numbers are greater than or equal to $$$l$$$ and less than or equal to $$$r$$$. You will receive the result of the computation $$$v_1 \oplus v_2 \oplus ... \oplus v_k$$$, where $$$v_1 ... v_k$$$ are the numbers on the spines of these tomes, and $$$\oplus$$$ denotes the operation of bitwise exclusive OR. Since your magical abilities as a librarian are severely limited, you can make no more than $$$150$$$ queries. Input format: The first line of input contains an integer $$$t$$$ ($$$1 \le t \le 300$$$) — the number of test cases. The first line of each test case contains a single integer $$$n$$$ ($$$3 \leq n \leq 10^{18}$$$) — the number of types of tomes. Example Input 0: 2 6 0 2 3 5 3 Example Output 0: xor 1 1 xor 2 2 xor 3 3 xor 4 6 ans 2 3 5 ans 1 2 3 Notes: In the first test case, the books in the library after the theft look like this: Now consider the answers to the queries: - For the query "xor 1 1", you receive the result $$$1 \oplus 1 = 0$$$. Two tomes satisfy the condition specified in the query — both with the number $$$1$$$. - For the query "xor 2 2", you receive the result $$$2$$$, as only one tome satisfies the specified condition. - For the query "xor 3 3", you receive the result $$$3$$$. - For the query "xor 4 6", you receive the result $$$4 \oplus 6 \oplus 4 \oplus 5 \oplus 6 = 5$$$. In the second test case, there are only $$$3$$$ types of books, and it is easy to guess that the missing ones have the numbers $$$1$$$, $$$2$$$, and $$$3$$$.
1
Codeforces_test
null
405
stdin
[ "5\n4\n4 2 1 3\n2\n1 2\n6\n5 4 1 3 2 6\n7\n5 6 1 3 7 2 4\n5\n3 1 2 5 4\n" ]
[ "1 1 2\n1\n1 1 2 1 3\n1 1 1 2 1 2\n1 1 2 1\n" ]
[ "5\n4\n4 2 1 3\n2\n1 2\n6\n5 4 1 3 2 6\n7\n5 6 1 3 7 2 4\n5\n3 1 2 5 4\n" ]
[ "1 1 2\n1\n1 1 2 1 3\n1 1 1 2 1 2\n1 1 2 1\n" ]
You are given a permutation $$$p$$$ of length $$$n$$$. You can perform operations of two types: - mark all positions $$$i$$$ such that $$$1 \le i < n$$$ and $$$p_i < p_{i + 1}$$$, and simultaneously remove the elements at these positions; - mark all positions $$$i$$$ such that $$$2 \le i \le n$$$ and $$$p_{i - 1} > p_i$$$, and simultaneously remove the elements at these positions. For each integer from $$$1$$$ to $$$(n-1)$$$, calculate the minimum number of operations required to remove that integer from the permutation. Input format: The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. The first line of each test case contains a single integer $$$n$$$ ($$$2 \le n \le 250\,000$$$). The second line of each test case contains $$$n$$$ integers $$$p_1, p_2, \dots, p_n$$$ ($$$1 \le p_i \le n$$$). The array $$$p$$$ is a permutation. Additional constraints on the input: the sum of $$$n$$$ over all test cases does not exceed $$$250\,000$$$. Output format: For each test case, print $$$(n-1)$$$ integers. The $$$i$$$-th of them should be equal to the minimum number of operations required to remove $$$i$$$ from the permutation. Example Input 0: 5 4 4 2 1 3 2 1 2 6 5 4 1 3 2 6 7 5 6 1 3 7 2 4 5 3 1 2 5 4 Example Output 0: 1 1 2 1 1 1 2 1 3 1 1 1 2 1 2 1 1 2 1
1
Codeforces_test
null
406
stdin
[ "5\n1\n000\n1001\n10101\n01100101011101\n" ]
[ "1\n0\n2\n3\n8\n" ]
[ "5\n1\n000\n1001\n10101\n01100101011101\n", "1\n00000000000000000000000000000000000000000000000000\n" ]
[ "1\n0\n2\n3\n8\n", "0\n" ]
You are given a string $$$s$$$ of length $$$n$$$ consisting of $$$\mathtt{0}$$$ and/or $$$\mathtt{1}$$$. In one operation, you can select a non-empty subsequence $$$t$$$ from $$$s$$$ such that any two adjacent characters in $$$t$$$ are different. Then, you flip each character of $$$t$$$ ($$$\mathtt{0}$$$ becomes $$$\mathtt{1}$$$ and $$$\mathtt{1}$$$ becomes $$$\mathtt{0}$$$). For example, if $$$s=\mathtt{\underline{0}0\underline{101}}$$$ and $$$t=s_1s_3s_4s_5=\mathtt{0101}$$$, after the operation, $$$s$$$ becomes $$$\mathtt{\underline{1}0\underline{010}}$$$. Calculate the minimum number of operations required to change all characters in $$$s$$$ to $$$\mathtt{0}$$$. Recall that for a string $$$s = s_1s_2\ldots s_n$$$, any string $$$t=s_{i_1}s_{i_2}\ldots s_{i_k}$$$ ($$$k\ge 1$$$) where $$$1\leq i_1 < i_2 < \ldots <i_k\leq n$$$ is a subsequence of $$$s$$$. Input format: The first line of input contains a single integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of input test cases. The only line of each test case contains the string $$$s$$$ ($$$1\le |s|\le 50$$$), where $$$|s|$$$ represents the length of $$$s$$$. Output format: For each test case, output the minimum number of operations required to change all characters in $$$s$$$ to $$$\mathtt{0}$$$. Example Input 0: 5 1 000 1001 10101 01100101011101 Example Output 0: 1 0 2 3 8 Notes: In the first test case, you can flip $$$s_1$$$. Then $$$s$$$ becomes $$$\mathtt{0}$$$, so the answer is $$$1$$$. In the fourth test case, you can perform the following three operations in order: 1. Flip $$$s_1s_2s_3s_4s_5$$$. Then $$$s$$$ becomes $$$\mathtt{\underline{01010}}$$$. 2. Flip $$$s_2s_3s_4$$$. Then $$$s$$$ becomes $$$\mathtt{0\underline{010}0}$$$. 3. Flip $$$s_3$$$. Then $$$s$$$ becomes $$$\mathtt{00\underline{0}00}$$$. It can be shown that you can not change all characters in $$$s$$$ to $$$\mathtt{0}$$$ in less than three operations, so the answer is $$$3$$$.
1
Codeforces_test
null
407
stdin
[ "3\n4 4 2\n1 2 2\n2 4 2\n1 3 4\n3 4 1\n1 4 2\n2 3 1\n6 7 3\n1 2 10\n2 3 3\n3 4 9\n4 5 2\n5 6 1\n2 4 10\n4 6 10\n1 6 3\n1 6 2\n2 4 1\n11 17 10\n1 4 5\n1 3 19\n1 2 10\n3 2 13\n4 5 1\n4 6 11\n3 5 9\n3 6 18\n2 7 17\n5 8 15\n5 10 8\n6 9 4\n7 10 20\n7 8 16\n8 11 3\n9 11 6\n10 11 14\n3 11 1\n3 11 3\n1 11 1\n1 11 4\n1 11 3\n8 2 2\n10 4 1\n3 9 2\n3 9 1\n6 7 3\n" ]
[ "1 2\n2 9 9\n11 3 11 1 3 10 8 4 11 4\n" ]
[ "3\n4 4 2\n1 2 2\n2 4 2\n1 3 4\n3 4 1\n1 4 2\n2 3 1\n6 7 3\n1 2 10\n2 3 3\n3 4 9\n4 5 2\n5 6 1\n2 4 10\n4 6 10\n1 6 3\n1 6 2\n2 4 1\n11 17 10\n1 4 5\n1 3 19\n1 2 10\n3 2 13\n4 5 1\n4 6 11\n3 5 9\n3 6 18\n2 7 17\n5 8 15\n5 10 8\n6 9 4\n7 10 20\n7 8 16\n8 11 3\n9 11 6\n10 11 14\n3 11 1\n3 11 3\n1 11 1\n1 11 4\n1 11 3\n8 2 2\n10 4 1\n3 9 2\n3 9 1\n6 7 3\n", "1\n3 2 2\n1 2 1000000000\n1 3 1\n1 2 1\n1 3 1\n" ]
[ "1 2\n2 9 9\n11 3 11 1 3 10 8 4 11 4\n", "1000000000 1\n" ]
This is the hard version of the problem. The difference between the versions is that in this version, there is no additional constraint on $$$m$$$. You can hack only if you solved all versions of this problem. Recently, the instructors of "T-generation" needed to create a training contest. They were missing one problem, and there was not a single problem on graphs in the contest, so they came up with the following problem. You are given a connected weighted undirected graph with $$$n$$$ vertices and $$$m$$$ edges, which does not contain self-loops or multiple edges. There are $$$q$$$ queries of the form $$$(a, b, k)$$$: among all paths from vertex $$$a$$$ to vertex $$$b$$$, find the smallest $$$k$$$-th maximum weight of edges on the path$$$^{\dagger}$$$. The instructors thought that the problem sounded very interesting, but there is one catch. They do not know how to solve it. Help them and solve the problem, as there are only a few hours left until the contest starts. $$$^{\dagger}$$$ Let $$$w_1 \ge w_2 \ge \ldots \ge w_{h}$$$ be the weights of all edges in a path, in non-increasing order. The $$$k$$$-th maximum weight of the edges on this path is $$$w_{k}$$$. Input format: Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. The description of the test cases follows. The first line of each set of test case contains three integers $$$n, m$$$ and $$$q$$$ ($$$2 \le n \le 400$$$, $$$n - 1 \le m \le \frac{n \cdot (n - 1)}{2}$$$, $$$1 \le q \le 3 \cdot 10^5$$$) — the number of vertices, the number of edges, and the number of questions, respectively. Each of the following $$$m$$$ lines of each set of test case contains three integers $$$v, u$$$ and $$$w$$$ ($$$1 \le v, u \le n$$$, $$$1 \le w \le 10^9$$$) — the ends of the next edge of the graph and its weight, respectively. It is guaranteed that the graph does not contain self-loops and multiple edges. Each of the following $$$q$$$ lines of each set of test case contains three integers $$$a, b$$$ and $$$k$$$ ($$$1 \le a, b \le n$$$, $$$k \ge 1$$$) — the next question. It is guaranteed that any path from vertex $$$a$$$ to vertex $$$b$$$ contains at least $$$k$$$ edges. It is guaranteed that the sum of the values of $$$n$$$ across all sets of test cases does not exceed $$$400$$$. It is guaranteed that the sum of the values of $$$q$$$ across all sets of test cases does not exceed $$$3 \cdot 10^5$$$. Output format: For each set of test case, output the answers to all questions. Example Input 0: 3 4 4 2 1 2 2 2 4 2 1 3 4 3 4 1 1 4 2 2 3 1 6 7 3 1 2 10 2 3 3 3 4 9 4 5 2 5 6 1 2 4 10 4 6 10 1 6 3 1 6 2 2 4 1 11 17 10 1 4 5 1 3 19 1 2 10 3 2 13 4 5 1 4 6 11 3 5 9 3 6 18 2 7 17 5 8 15 5 10 8 6 9 4 7 10 20 7 8 16 8 11 3 9 11 6 10 11 14 3 11 1 3 11 3 1 11 1 1 11 4 1 11 3 8 2 2 10 4 1 3 9 2 3 9 1 6 7 3 Example Output 0: 1 2 2 9 9 11 3 11 1 3 10 8 4 11 4 Notes: In the first set of test cases, one of the optimal paths in the first query is the path $$$1 \rightarrow 3 \rightarrow 4$$$; the $$$2$$$-nd maximum weight of the edges on this path is $$$1$$$. In the second query, one of the optimal paths is $$$2 \rightarrow 4 \rightarrow 3$$$; $$$1$$$-st maximum weight of the edges is $$$2$$$. In the second set of input data, one of the optimal paths in the first query is the path $$$1 \rightarrow 2 \rightarrow 4 \rightarrow 5 \rightarrow 6$$$; the $$$3$$$-rd maximum weight of the edges on this path is $$$2$$$.
1
Codeforces_test
null
408
stdin
[ "3\n4\n#...\n.#..\n..#.\n...#\n2\n.#..\n.#..\n1\n...#\n" ]
[ "4 3 2 1 \n2 2 \n4\n" ]
[ "3\n4\n#...\n.#..\n..#.\n...#\n2\n.#..\n.#..\n1\n...#\n" ]
[ "4 3 2 1 \n2 2 \n4 \n" ]
You are playing your favorite rhythm game, osu!mania. The layout of your beatmap consists of $$$n$$$ rows and $$$4$$$ columns. Because notes at the bottom are closer, you will process the bottommost row first and the topmost row last. Each row will contain exactly one note, represented as a '#'. For each note $$$1, 2, \dots, n$$$, in the order of processing, output the column in which the note appears. Input format: The first line contains $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. For each test case, the first line contains $$$n$$$ ($$$1 \leq n \leq 500$$$) — the number of rows of the beatmap. The following $$$n$$$ lines contain $$$4$$$ characters. The $$$i$$$-th line represents the $$$i$$$-th row of the beatmap from the top. It is guaranteed that the characters are either '.' or '#', and exactly one of the characters is '#'. It is guaranteed that the sum of $$$n$$$ over all test cases does not exceed $$$500$$$. Output format: For each test case, output $$$n$$$ integers on a new line, the column that the $$$i$$$-th note appears in for all $$$i$$$ from $$$1$$$ to $$$n$$$. Example Input 0: 3 4 #... .#.. ..#. ...# 2 .#.. .#.. 1 ...# Example Output 0: 4 3 2 1 2 2 4
1
Codeforces_test
null
409
stdin
[ "4\n3\nAAA\nAJJ\n6\nJAJAJJ\nJJAJAJ\n6\nAJJJAJ\nAJJAAA\n9\nAJJJJAJAJ\nJAAJJJJJA\n" ]
[ "2\n2\n3\n2\n" ]
[ "4\n3\nAAA\nAJJ\n6\nJAJAJJ\nJJAJAJ\n6\nAJJJAJ\nAJJAAA\n9\nAJJJJAJAJ\nJAAJJJJJA\n" ]
[ "2\n2\n3\n2\n" ]
Álvaro and José are the only candidates running for the presidency of Tepito, a rectangular grid of $$$2$$$ rows and $$$n$$$ columns, where each cell represents a house. It is guaranteed that $$$n$$$ is a multiple of $$$3$$$. Under the voting system of Tepito, the grid will be split into districts, which consist of any $$$3$$$ houses that are connected$$$^{\text{∗}}$$$. Each house will belong to exactly one district. Each district will cast a single vote. The district will vote for Álvaro or José respectively if at least $$$2$$$ houses in that district select them. Therefore, a total of $$$\frac{2n}{3}$$$ votes will be cast. As Álvaro is the current president, he knows exactly which candidate each house will select. If Álvaro divides the houses into districts optimally, determine the maximum number of votes he can get. Input format: Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). The description of the test cases follows. The first line of each test case contains one integer $$$n$$$ ($$$3 \le n \le 10^5$$$; $$$n$$$ is a multiple of $$$3$$$) — the number of columns of Tepito. The following two lines each contain a string of length $$$n$$$. The $$$i$$$-th line contains the string $$$s_i$$$, consisting of the characters $$$\texttt{A}$$$ and $$$\texttt{J}$$$. If $$$s_{i,j}=\texttt{A}$$$, the house in the $$$i$$$-th row and $$$j$$$-th column will select Álvaro. Otherwise if $$$s_{i,j}=\texttt{J}$$$, the house will select José. It is guaranteed that the sum of $$$n$$$ over all test cases does not exceed $$$10^5$$$. Output format: For each test case, output a single integer — the maximum number of districts Álvaro can win by optimally dividing the houses into districts. Example Input 0: 4 3 AAA AJJ 6 JAJAJJ JJAJAJ 6 AJJJAJ AJJAAA 9 AJJJJAJAJ JAAJJJJJA Example Output 0: 2 2 3 2 Notes: The image below showcases the optimal arrangement of districts Álvaro can use for each test case in the example.
1
Codeforces_test
null
410
stdin
[ "5\n1\n1\n2\n1 2\n3\n2 4 6\n4\n1000000000 999999999 999999998 999999997\n10\n3 1 4 1 5 9 2 6 5 3\n" ]
[ "0\n2\n1\n3\n8\n" ]
[ "5\n1\n1\n2\n1 2\n3\n2 4 6\n4\n1000000000 999999999 999999998 999999997\n10\n3 1 4 1 5 9 2 6 5 3\n", "1\n6\n1000000000 900000000 900000000 800000000 694967296 998046875\n" ]
[ "0\n2\n1\n3\n8\n", "2\n" ]
To train young Kevin's arithmetic skills, his mother devised the following problem. Given $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ and a sum $$$s$$$ initialized to $$$0$$$, Kevin performs the following operation for $$$i = 1, 2, \ldots, n$$$ in order: - Add $$$a_i$$$ to $$$s$$$. If the resulting $$$s$$$ is even, Kevin earns a point and repeatedly divides $$$s$$$ by $$$2$$$ until it becomes odd. Note that Kevin can earn at most one point per operation, regardless of how many divisions he does. Since these divisions are considered more beneficial for Kevin's development, his mother wants to rearrange $$$a$$$ so that the number of Kevin's total points is maximized. Determine the maximum number of points. Input format: Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 500$$$). The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1\leq n \leq 100$$$) — the number of integers. The second line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1\leq a_i \leq 10^9$$$). Output format: For each test case, output one integer — the maximum number of points. Example Input 0: 5 1 1 2 1 2 3 2 4 6 4 1000000000 999999999 999999998 999999997 10 3 1 4 1 5 9 2 6 5 3 Example Output 0: 0 2 1 3 8 Notes: In the first test case, the only arrangement of $$$a$$$ is $$$[1]$$$. $$$s$$$ becomes $$$1$$$. Kevin earns no points. In the second test case, the only possible arrangement of $$$a$$$ is $$$[2, 1]$$$. $$$s$$$ becomes $$$1$$$ and $$$1$$$ successively. Kevin earns points in both operations. In the third test case, one possible arrangement of $$$a$$$ is $$$[2, 4, 6]$$$. $$$s$$$ becomes $$$1$$$, $$$5$$$, and $$$11$$$ successively. Kevin earns a point in the first operation.
1
Codeforces_test
null
411
stdin
[ "4\n3\n5 4 5\n3\n4 5 4\n10\n3 3 3 3 4 1 2 3 4 5\n9\n17 89 92 42 29 92 14 70 45\n" ]
[ "7\n6\n10\n97\n" ]
[ "4\n3\n5 4 5\n3\n4 5 4\n10\n3 3 3 3 4 1 2 3 4 5\n9\n17 89 92 42 29 92 14 70 45\n" ]
[ "7\n6\n10\n97\n" ]
You are given an array $$$a_1, a_2, \ldots, a_n$$$ of positive integers. You can color some elements of the array red, but there cannot be two adjacent red elements (i.e., for $$$1 \leq i \leq n-1$$$, at least one of $$$a_i$$$ and $$$a_{i+1}$$$ must not be red). Your score is the maximum value of a red element plus the number of red elements. Find the maximum score you can get. Input format: Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 500$$$). The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 100$$$) — the length of the array. The second line of each test case contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \le a_i \le 1000$$$) — the given array. Output format: For each test case, output a single integer: the maximum possible score you can get after coloring some elements red according to the statement. Example Input 0: 4 3 5 4 5 3 4 5 4 10 3 3 3 3 4 1 2 3 4 5 9 17 89 92 42 29 92 14 70 45 Example Output 0: 7 6 10 97 Notes: In the first test case, you can color the array as follows: $$$[\color{red}{5}, 4, \color{red}{5}]$$$. Your score is $$$\max([5, 5]) + \text{size}([5, 5]) = 5+2 = 7$$$. This is the maximum score you can get. In the second test case, you can color the array as follows: $$$[\color{red}{4}, 5, \color{red}{4}]$$$. Your score is $$$\max([4, 4]) + \text{size}([4, 4]) = 4+2 = 6$$$. This is the maximum score you can get. In the third test case, you can color the array as follows: $$$[\color{red}{3}, 3, \color{red}{3}, 3, \color{red}{4}, 1, 2, \color{red}{3}, 4, \color{red}{5}]$$$. Your score is $$$\max([3, 3, 4, 3, 5]) + \text{size}([3, 3, 4, 3, 5]) = 5+5 = 10$$$. This is the maximum score you can get.
1
Codeforces_test
null
412
stdin
[ "3\n2 1\n10 20\n10\n6 7\n3 1 2 4 5 6\n1\n2\n4\n8\n16\n32\n64\n10 4\n1 2 4 8 16 32 64 128 256 512\n10\n100\n1000\n10000\n" ]
[ "26\n7 8 10 12 19 35 67\n513 560 1011 10001\n" ]
[ "3\n2 1\n10 20\n10\n6 7\n3 1 2 4 5 6\n1\n2\n4\n8\n16\n32\n64\n10 4\n1 2 4 8 16 32 64 128 256 512\n10\n100\n1000\n10000\n" ]
[ "26\n7 8 10 12 19 35 67\n513 560 1011 10001\n" ]
One day, the teachers of "T-generation" decided to instill discipline in the pupils, so they lined them up and made them calculate in order. There are a total of $$$n$$$ pupils, the height of the $$$i$$$-th pupil in line is $$$a_i$$$. The line is comfortable, if for each $$$i$$$ from $$$1$$$ to $$$n - 1$$$, the following condition holds: $$$a_i \cdot 2 \ge a_{i + 1}$$$. Initially, the line is comfortable. The teachers do not like that the maximum height in the line is too small, so they want to feed the pupils pizza. You know that when a pupil eats one pizza, their height increases by $$$1$$$. One pizza can only be eaten by only one pupil, but each pupil can eat an unlimited number of pizzas. It is important that after all the pupils have eaten their pizzas, the line is comfortable. The teachers have $$$q$$$ options for how many pizzas they will order. For each option $$$k_i$$$, answer the question: what is the maximum height $$$\max(a_1, a_2, \ldots, a_n)$$$ that can be achieved if the pupils eat at most $$$k_i$$$ pizzas. Input format: Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. The description of the test cases follows. The first line of each set of test case contains two integers $$$n$$$ and $$$q$$$ ($$$1 \le n, q \le 5 \cdot 10^4$$$) — the number of pupils and the number of options for how many pizzas the teachers will order. The second line of each set of test case contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \le a_i \le 10^9$$$) — the heights of the pupils.It is guaranteed that initially, the line is comfortable. Each of the following $$$q$$$ lines of each set of input data contains one integer $$$k_i$$$ ($$$1 \le k_i \le 10^9$$$) — the next limit for how many pizzas the pupils can eat. It is guaranteed that the sum of the values of $$$n$$$ across all sets of input data does not exceed $$$5 \cdot 10^4$$$. It is guaranteed that the sum of the values of $$$q$$$ across all sets of input data does not exceed $$$5 \cdot 10^4$$$. Output format: For each test case, for each limit for how many pizzas the pupils can eat, output the maximum value $$$\max(a_1, a_2, \ldots, a_n)$$$ that can be achieved while ensuring that the line is comfortable. Example Input 0: 3 2 1 10 20 10 6 7 3 1 2 4 5 6 1 2 4 8 16 32 64 10 4 1 2 4 8 16 32 64 128 256 512 10 100 1000 10000 Example Output 0: 26 7 8 10 12 19 35 67 513 560 1011 10001 Notes: In the first query of the first set of input data, you can first give $$$3$$$ pizzas to the first pupil, and then give $$$6$$$ pizzas to the second pupil, making the final array $$$[13, 26]$$$ (the line is comfortable since $$$13 \cdot 2 \ge 26$$$), and the maximum element in it is $$$26$$$.
1
Codeforces_test
null
413
stdin
[ "3\n4 4 2\n1 2 2\n2 4 2\n1 3 4\n3 4 1\n1 4 2\n2 3 1\n6 7 3\n1 2 10\n2 3 3\n3 4 9\n4 5 2\n5 6 1\n2 4 10\n4 6 10\n1 6 3\n1 6 2\n2 4 1\n11 17 10\n1 4 5\n1 3 19\n1 2 10\n3 2 13\n4 5 1\n4 6 11\n3 5 9\n3 6 18\n2 7 17\n5 8 15\n5 10 8\n6 9 4\n7 10 20\n7 8 16\n8 11 3\n9 11 6\n10 11 14\n3 11 1\n3 11 3\n1 11 1\n1 11 4\n1 11 3\n8 2 2\n10 4 1\n3 9 2\n3 9 1\n6 7 3\n" ]
[ "1 2\n2 9 9\n11 3 11 1 3 10 8 4 11 4\n" ]
[ "3\n4 4 2\n1 2 2\n2 4 2\n1 3 4\n3 4 1\n1 4 2\n2 3 1\n6 7 3\n1 2 10\n2 3 3\n3 4 9\n4 5 2\n5 6 1\n2 4 10\n4 6 10\n1 6 3\n1 6 2\n2 4 1\n11 17 10\n1 4 5\n1 3 19\n1 2 10\n3 2 13\n4 5 1\n4 6 11\n3 5 9\n3 6 18\n2 7 17\n5 8 15\n5 10 8\n6 9 4\n7 10 20\n7 8 16\n8 11 3\n9 11 6\n10 11 14\n3 11 1\n3 11 3\n1 11 1\n1 11 4\n1 11 3\n8 2 2\n10 4 1\n3 9 2\n3 9 1\n6 7 3\n", "1\n3 2 2\n1 2 1000000000\n1 3 1\n1 2 1\n1 3 1\n" ]
[ "1 2\n2 9 9\n11 3 11 1 3 10 8 4 11 4\n", "1000000000 1\n" ]
This is the easy version of the problem. The difference between the versions is that in this version, there is an additional constraint on $$$m$$$. You can hack only if you solved all versions of this problem. Recently, the instructors of "T-generation" needed to create a training contest. They were missing one problem, and there was not a single problem on graphs in the contest, so they came up with the following problem. You are given a connected weighted undirected graph with $$$n$$$ vertices and $$$m$$$ edges, which does not contain self-loops or multiple edges. There are $$$q$$$ queries of the form $$$(a, b, k)$$$: among all paths from vertex $$$a$$$ to vertex $$$b$$$, find the smallest $$$k$$$-th maximum weight of edges on the path$$$^{\dagger}$$$. The instructors thought that the problem sounded very interesting, but there is one catch. They do not know how to solve it. Help them and solve the problem, as there are only a few hours left until the contest starts. $$$^{\dagger}$$$ Let $$$w_1 \ge w_2 \ge \ldots \ge w_{h}$$$ be the weights of all edges in a path, in non-increasing order. The $$$k$$$-th maximum weight of the edges on this path is $$$w_{k}$$$. Input format: Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. The description of the test cases follows. The first line of each set of test case contains three integers $$$n, m$$$ and $$$q$$$ ($$$2 \le n \le 400$$$, $$$n - 1 \le m \le \operatorname{min}(\mathbf{400}, \frac{n \cdot (n - 1)}{2})$$$, $$$1 \le q \le 3 \cdot 10^5$$$) — the number of vertices, the number of edges, and the number of questions, respectively. Each of the following $$$m$$$ lines of each set of test case contains three integers $$$v, u$$$ and $$$w$$$ ($$$1 \le v, u \le n$$$, $$$1 \le w \le 10^9$$$) — the ends of the next edge of the graph and its weight, respectively. It is guaranteed that the graph does not contain self-loops and multiple edges. Each of the following $$$q$$$ lines of each set of test case contains three integers $$$a, b$$$ and $$$k$$$ ($$$1 \le a, b \le n$$$, $$$k \ge 1$$$) — the next question. It is guaranteed that any path from vertex $$$a$$$ to vertex $$$b$$$ contains at least $$$k$$$ edges. It is guaranteed that the sum of the values of $$$n$$$ across all sets of test cases does not exceed $$$400$$$. It is guaranteed that the sum of the values of $$$m$$$ across all sets of test cases does not exceed $$$400$$$. It is guaranteed that the sum of the values of $$$q$$$ across all sets of test cases does not exceed $$$3 \cdot 10^5$$$. Output format: For each test case, output the answers to all questions. Example Input 0: 3 4 4 2 1 2 2 2 4 2 1 3 4 3 4 1 1 4 2 2 3 1 6 7 3 1 2 10 2 3 3 3 4 9 4 5 2 5 6 1 2 4 10 4 6 10 1 6 3 1 6 2 2 4 1 11 17 10 1 4 5 1 3 19 1 2 10 3 2 13 4 5 1 4 6 11 3 5 9 3 6 18 2 7 17 5 8 15 5 10 8 6 9 4 7 10 20 7 8 16 8 11 3 9 11 6 10 11 14 3 11 1 3 11 3 1 11 1 1 11 4 1 11 3 8 2 2 10 4 1 3 9 2 3 9 1 6 7 3 Example Output 0: 1 2 2 9 9 11 3 11 1 3 10 8 4 11 4 Notes: In the first set of test cases, one of the optimal paths in the first query is the path $$$1 \rightarrow 3 \rightarrow 4$$$; the $$$2$$$-nd maximum weight of the edges on this path is $$$1$$$. In the second query, one of the optimal paths is $$$2 \rightarrow 4 \rightarrow 3$$$; $$$1$$$-st maximum weight of the edges is $$$2$$$. In the second set of input data, one of the optimal paths in the first query is the path $$$1 \rightarrow 2 \rightarrow 4 \rightarrow 5 \rightarrow 6$$$; the $$$3$$$-rd maximum weight of the edges on this path is $$$2$$$.
1
Codeforces_test
null
414
stdin
[ "3\n2\n1 2\n4\n1 2\n2 3\n2 4\n7\n1 2\n1 3\n2 4\n4 5\n5 6\n5 7\n" ]
[ "0\n2\n4\n" ]
[ "3\n2\n1 2\n4\n1 2\n2 3\n2 4\n7\n1 2\n1 3\n2 4\n4 5\n5 6\n5 7\n", "1\n22\n1 2\n3 4\n5 6\n7 8\n9 10\n11 12\n13 14\n15 16\n17 2\n17 4\n17 6\n17 8\n18 10\n18 12\n18 14\n18 16\n17 19\n18 19\n19 20\n19 21\n19 22\n", "1\n16\n1 2\n1 3\n1 4\n2 5\n2 6\n5 7\n6 8\n3 9\n3 10\n9 11\n10 12\n4 13\n4 14\n13 15\n14 16\n" ]
[ "0\n2\n4\n", "9\n", "5\n" ]
Recently, Little John got a tree from his aunt to decorate his house. But as it seems, just one tree is not enough to decorate the entire house. Little John has an idea. Maybe he can remove a few vertices from the tree. That will turn it into more trees! Right? You are given a tree$$$^{\text{∗}}$$$ of $$$n$$$ vertices. You must perform the following operation exactly twice. - Select a vertex $$$v$$$; - Remove all edges incident to $$$v$$$, and also the vertex $$$v$$$. Please find the maximum number of connected components after performing the operation exactly twice. Two vertices $$$x$$$ and $$$y$$$ are in the same connected component if and only if there exists a path from $$$x$$$ to $$$y$$$. For clarity, note that the graph with $$$0$$$ vertices has $$$0$$$ connected components by definition.$$$^{\text{†}}$$$ Input format: Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$2 \le n \le 2 \cdot 10^5$$$). Each of the next $$$n-1$$$ lines contains two integers $$$u_i$$$ and $$$v_i$$$, denoting the two vertices connected by an edge ($$$1 \le u_i,v_i \le n$$$, $$$u_i \neq v_i$$$). It is guaranteed that the given edges form a tree. It is guaranteed that the sum of $$$n$$$ over all test cases does not exceed $$$2 \cdot 10^5$$$. Output format: For each test case, output the maximum number of connected components on a separate line. Example Input 0: 3 2 1 2 4 1 2 2 3 2 4 7 1 2 1 3 2 4 4 5 5 6 5 7 Example Output 0: 0 2 4 Notes: On the first test case, removing a vertex twice will make the graph empty. By definition, the number of connected components in the graph with $$$0$$$ vertices is $$$0$$$. Therefore, the answer is $$$0$$$. On the second test case, removing two vertices $$$1$$$ and $$$2$$$ leaves $$$2$$$ connected components. As it is impossible to make $$$3$$$ connected components with $$$2$$$ vertices, the answer is $$$2$$$. On the third test case, removing two vertices $$$1$$$ and $$$5$$$ leaves $$$4$$$ connected components, which are $$$\left\{ 2,4\right\}$$$, $$$\left\{ 3\right\}$$$, $$$\left\{ 6\right\}$$$, and $$$\left\{ 7\right\}$$$. It can be shown that it is impossible to make $$$5$$$ connected components. Therefore, the answer is $$$4$$$.
1
Codeforces_test
null
415
stdin
[ "6\n0001100111\n0000011111\n010101\n111000\n0101\n0110\n0101\n1010\n011001\n001110\n0\n1\n", "6\n010101\n?0?0??\n0101\n?0?0\n11100101\n????????\n11100101\n???11?1?\n1000100011\n?11?000?0?\n10101\n?1011\n" ]
[ "1\n3\n1\n-1\n-1\n-1\n", "2\n-1\n0\n2\n2\n-1\n" ]
[ "6\n0001100111\n0000011111\n010101\n111000\n0101\n0110\n0101\n1010\n011001\n001110\n0\n1\n", "6\n010101\n?0?0??\n0101\n?0?0\n11100101\n????????\n11100101\n???11?1?\n1000100011\n?11?000?0?\n10101\n?1011\n" ]
[ "1\n3\n1\n-1\n-1\n-1\n", "2\n-1\n0\n2\n2\n-1\n" ]
This is the hard version of the problem. The difference between the versions is that in this version, string $$$t$$$ consists of '0', '1' and '?'. You can hack only if you solved all versions of this problem. Kevin has a binary string $$$s$$$ of length $$$n$$$. Kevin can perform the following operation: - Choose two adjacent blocks of $$$s$$$ and swap them. A block is a maximal substring$$$^{\text{∗}}$$$ of identical characters. Formally, denote $$$s[l,r]$$$ as the substring $$$s_l s_{l+1} \ldots s_r$$$. A block is $$$s[l,r]$$$ satisfying: - $$$l=1$$$ or $$$s_l\not=s_{l-1}$$$. - $$$s_l=s_{l+1} = \ldots = s_{r}$$$. - $$$r=n$$$ or $$$s_r\not=s_{r+1}$$$. Adjacent blocks are two blocks $$$s[l_1,r_1]$$$ and $$$s[l_2,r_2]$$$ satisfying $$$r_1+1=l_2$$$. For example, if $$$s=\mathtt{000}\,\mathbf{11}\,\mathbf{00}\,\mathtt{111}$$$, Kevin can choose the two blocks $$$s[4,5]$$$ and $$$s[6,7]$$$ and swap them, transforming $$$s$$$ into $$$\mathtt{000}\,\mathbf{00}\,\mathbf{11}\,\mathtt{111}$$$. Given a string $$$t$$$ of length $$$n$$$ consisting of '0', '1' and '?', Kevin wants to determine the minimum number of operations required to perform such that for any index $$$i$$$ ($$$1\le i\le n$$$), if $$$t_i\not=$$$ '?' then $$$s_i=t_i$$$. If it is impossible, output $$$-1$$$. Input format: Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). The description of the test cases follows. The first line of each test case contains a string $$$s$$$ consisting of '0' and '1'. The second line of each test case contains a string $$$t$$$ consisting of '0', '1' and '?'. It is guaranteed that the lengths of $$$s$$$ and $$$t$$$ are the same. It is guaranteed that the sum of the length of $$$s$$$ over all test cases will not exceed $$$4\cdot 10^5$$$. Output format: For each test case, output one integer — the minimum number of operations required. If it is impossible, output $$$-1$$$. Example Input 0: 6 0001100111 0000011111 010101 111000 0101 0110 0101 1010 011001 001110 0 1 Example Output 0: 1 3 1 -1 -1 -1 Example Input 1: 6 010101 ?0?0?? 0101 ?0?0 11100101 ???????? 11100101 ???11?1? 1000100011 ?11?000?0? 10101 ?1011 Example Output 1: 2 -1 0 2 2 -1 Notes: In the first test case of the first example, the possible way is shown in the statement. In the second test case of the first example, one possible way could be: - Swap blocks $$$[2, 2], [3, 3]$$$, $$$s$$$ will become $$$\mathtt{001101}$$$. - Swap blocks $$$[3, 4], [5, 5]$$$, $$$s$$$ will become $$$\mathtt{000111}$$$. - Swap blocks $$$[1, 3], [4, 6]$$$, $$$s$$$ will become $$$\mathtt{111000}$$$. In the first test case of the second example, one possible way could be: - Swap blocks $$$[1, 1], [2, 2]$$$, $$$s$$$ will become $$$\mathtt{100101}$$$. - Swap blocks $$$[4, 4], [5, 5]$$$, $$$s$$$ will become $$$\mathtt{100011}$$$.
1
Codeforces_test
null
416
stdin
[ "10\n4\n0 1 2 3\n6\n0 0 0 0 0 0\n5\n1 0 1 0 1\n5\n3 1 4 1 5\n4\n3 2 1 0\n7\n9 100 0 89 12 2 3\n4\n0 3 9 0\n7\n0 7 0 2 0 7 0\n1\n0\n2\n0 1\n" ]
[ "1\n0\n2\n1\n1\n2\n1\n2\n0\n1\n" ]
[ "10\n4\n0 1 2 3\n6\n0 0 0 0 0 0\n5\n1 0 1 0 1\n5\n3 1 4 1 5\n4\n3 2 1 0\n7\n9 100 0 89 12 2 3\n4\n0 3 9 0\n7\n0 7 0 2 0 7 0\n1\n0\n2\n0 1\n", "1\n8\n1 0 1 0 1 0 1 0\n" ]
[ "1\n0\n2\n1\n1\n2\n1\n2\n0\n1\n", "2\n" ]
Evirir the dragon snuck into a wizard's castle and found a mysterious contraption, and their playful instincts caused them to play with (destroy) it... Evirir the dragon found an array $$$a_1, a_2, \ldots, a_n$$$ of $$$n$$$ non-negative integers. In one operation, they can choose a non-empty subarray$$$^{\text{∗}}$$$ $$$b$$$ of $$$a$$$ and replace it with the integer $$$\operatorname{mex}(b)$$$$$$^{\text{†}}$$$. They want to use this operation any number of times to make $$$a$$$ only contain zeros. It can be proven that this is always possible under the problem constraints. What is the minimum number of operations needed? Input format: Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 200$$$). The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 50$$$), the length of $$$a$$$. The second line of each test case contains $$$n$$$ space-separated integers, $$$a_1, a_2, \ldots, a_n$$$ ($$$0 \le a_i \le 100$$$). It is guaranteed that the sum of $$$n$$$ over all test cases does not exceed $$$500$$$. Output format: For each test case, output a single integer on a line, the minimum number of operations needed to make $$$a$$$ contain only zeros. Example Input 0: 10 4 0 1 2 3 6 0 0 0 0 0 0 5 1 0 1 0 1 5 3 1 4 1 5 4 3 2 1 0 7 9 100 0 89 12 2 3 4 0 3 9 0 7 0 7 0 2 0 7 0 1 0 2 0 1 Example Output 0: 1 0 2 1 1 2 1 2 0 1 Notes: In the first test case, Evirir can choose the subarray $$$b = [1, 2, 3]$$$ and replace it with $$$\operatorname{mex}(1, 2, 3) = 0$$$, changing $$$a$$$ from $$$[0, \underline{1, 2, 3}]$$$ to $$$[0, 0]$$$ (where the chosen subarray is underlined). Therefore, the answer is $$$1$$$. In the second test case, $$$a$$$ already contains only $$$0$$$s, so no operation is needed. In the third test case, Evirir can change $$$a$$$ as follows: $$$[1, \underline{0, 1, 0, 1}] \to [\underline{1, 2}] \to [0]$$$. Here, $$$\operatorname{mex}(0, 1, 0, 1) = 2$$$ and $$$\operatorname{mex}(1, 2) = 0$$$. In the fourth test case, Evirir can choose $$$b$$$ to be the entire array $$$a$$$, changing $$$a$$$ from $$$[\underline{3, 1, 4, 1, 5}]$$$ to $$$[0]$$$.
1
Codeforces_test
null
417
stdin
[ "3\n4 2 0\n1 2 3 4\n1 1\n3 6 0\n1 2 3\n1 1 2 3 3 2\n4 6 0\n3 1 4 2\n3 1 1 2 3 4\n" ]
[ "YA\nYA\nTIDAK\n" ]
[ "3\n4 2 0\n1 2 3 4\n1 1\n3 6 0\n1 2 3\n1 1 2 3 3 2\n4 6 0\n3 1 4 2\n3 1 1 2 3 4\n" ]
[ "YA\nYA\nTIDAK\n" ]
This is the easy version of the problem. In the two versions, the constraints on $$$q$$$ and the time limit are different. In this version, $$$q=0$$$. You can make hacks only if all the versions of the problem are solved. A team consisting of $$$n$$$ members, numbered from $$$1$$$ to $$$n$$$, is set to present a slide show at a large meeting. The slide show contains $$$m$$$ slides. There is an array $$$a$$$ of length $$$n$$$. Initially, the members are standing in a line in the order of $$$a_1, a_2, \ldots, a_n$$$ from front to back. The slide show will be presented in order from slide $$$1$$$ to slide $$$m$$$. Each section will be presented by the member at the front of the line. After each slide is presented, you can move the member at the front of the line to any position in the lineup (without changing the order of the rest of the members). For example, suppose the line of members is $$$[\color{red}{3},1,2,4]$$$. After member $$$3$$$ presents the current slide, you can change the line of members into either $$$[\color{red}{3},1,2,4]$$$, $$$[1,\color{red}{3},2,4]$$$, $$$[1,2,\color{red}{3},4]$$$ or $$$[1,2,4,\color{red}{3}]$$$. There is also an array $$$b$$$ of length $$$m$$$. The slide show is considered good if it is possible to make member $$$b_i$$$ present slide $$$i$$$ for all $$$i$$$ from $$$1$$$ to $$$m$$$ under these constraints. However, your annoying boss wants to make $$$q$$$ updates to the array $$$b$$$. In the $$$i$$$-th update, he will choose a slide $$$s_i$$$ and a member $$$t_i$$$ and set $$$b_{s_i} := t_i$$$. Note that these updates are persistent, that is changes made to the array $$$b$$$ will apply when processing future updates. For each of the $$$q+1$$$ states of array $$$b$$$, the initial state and after each of the $$$q$$$ updates, determine if the slideshow is good. Input format: Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). The description of the test cases follows. The first line of each test case contains three integers $$$n$$$, $$$m$$$ and $$$q$$$ ($$$1 \le n, m \le 2 \cdot 10^5$$$; $$$q=0$$$) — the number of members, the number of sections and the number of updates. The second line of each test case contains $$$n$$$ integers $$$a_1,a_2,\ldots,a_n$$$ ($$$1 \le a_i \le n$$$) — the initial order of the members from front to back. It is guaranteed that each integer from $$$1$$$ to $$$n$$$ appears exactly once in $$$a$$$. The third line of each test case contains $$$m$$$ integers $$$b_1, b_2, \ldots, b_m$$$ ($$$1 \le b_i \le n$$$) — the members who should present each section. It is guaranteed that the sum of $$$n$$$ and the sum of $$$m$$$ over all test cases do not exceed $$$2 \cdot 10^5$$$ respectively. Output format: For each test case, output $$$q+1$$$ lines corresponding to the $$$q+1$$$ states of the array $$$b$$$. Output "YA" if the slide show is good, and "TIDAK" otherwise. You can output the answer in any case (upper or lower). For example, the strings "yA", "Ya", "ya", and "YA" will be recognized as positive responses. Example Input 0: 3 4 2 0 1 2 3 4 1 1 3 6 0 1 2 3 1 1 2 3 3 2 4 6 0 3 1 4 2 3 1 1 2 3 4 Example Output 0: YA YA TIDAK Notes: For the first test case, you do not need to move the members as both slides are presented by member $$$1$$$, who is already at the front of the line. For the second test case, the following is a possible way to move members so that the presentation is good: 1. $$$[1,2,3]$$$, do not move member $$$1$$$. 2. $$$[1,2,3]$$$, move member $$$1$$$ after member $$$3$$$. 3. $$$[2,3,1]$$$, move member $$$2$$$ after member $$$3$$$. 4. $$$[3,2,1]$$$, do not move member $$$3$$$. 5. $$$[3,2,1]$$$, move member $$$3$$$ after member $$$1$$$. 6. $$$[2,1,3]$$$, do not move member $$$2$$$.
1
Codeforces_test
null
418
stdin
[ "5\n2 1\n1 1\n2 2\n1 2\n3 4\n2 1 3\n10 50\n1 1 3 8 8 9 12 13 27 27\n2 1000000000\n1000000000 500000000\n" ]
[ "1\n2\n5\n53\n1000000000\n" ]
[ "5\n2 1\n1 1\n2 2\n1 2\n3 4\n2 1 3\n10 50\n1 1 3 8 8 9 12 13 27 27\n2 1000000000\n1000000000 500000000\n" ]
[ "1\n2\n5\n53\n1000000000\n" ]
There is a vending machine that sells lemonade. The machine has a total of $$$n$$$ slots. You know that initially, the $$$i$$$-th slot contains $$$a_i$$$ cans of lemonade. There are also $$$n$$$ buttons on the machine, each button corresponds to a slot, with exactly one button corresponding to each slot. Unfortunately, the labels on the buttons have worn off, so you do not know which button corresponds to which slot. When you press the button corresponding to the $$$i$$$-th slot, one of two events occurs: - If there is a can of lemonade in the $$$i$$$-th slot, it will drop out and you will take it. At this point, the number of cans in the $$$i$$$-th slot decreases by $$$1$$$. - If there are no cans of lemonade left in the $$$i$$$-th slot, nothing will drop out. After pressing, the can drops out so quickly that it is impossible to track from which slot it fell. The contents of the slots are hidden from your view, so you cannot see how many cans are left in each slot. The only thing you know is the initial number of cans in the slots: $$$a_1, a_2, \ldots, a_n$$$. Determine the minimum number of button presses needed to guarantee that you receive at least $$$k$$$ cans of lemonade. Note that you can adapt your strategy during the button presses based on whether you received a can or not. It is guaranteed that there are at least $$$k$$$ cans of lemonade in total in the machine. In other words, $$$k \leq a_1 + a_2 + \ldots + a_n$$$. Input format: Each test consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le n \le 2 \cdot 10^5$$$, $$$1 \leq k \leq 10^9$$$) — the number of slots in the machine and the required number of cans of lemonade. The second line of each test case contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \le a_i \le 10^9$$$) — the number of cans in the slots. It is guaranteed that $$$k \leq a_1 + a_2 + \ldots + a_n$$$, meaning there are at least $$$k$$$ cans of lemonade in the machine. It is guaranteed that the sum of $$$n$$$ over all test cases does not exceed $$$2 \cdot 10^5$$$. Output format: For each test case, output a single integer — the minimum number of button presses needed to guarantee that you receive at least $$$k$$$ cans of lemonade. Example Input 0: 5 2 1 1 1 2 2 1 2 3 4 2 1 3 10 50 1 1 3 8 8 9 12 13 27 27 2 1000000000 1000000000 500000000 Example Output 0: 1 2 5 53 1000000000 Notes: In the first test case, we can simply press the first button and receive one can of lemonade. In the second test case, we can press each button once and guarantee that we receive $$$2$$$ cans of lemonade. Note that if we simply press one button twice, we might not be lucky, and that button could correspond to the first slot, in which case we would only receive $$$1$$$ can of lemonade for two presses. In the third test case, one of the optimal strategies is as follows: Press the first button twice. After the first press, a can of lemonade will definitely drop out. Then there are two options: - If no can of lemonade drops after the second press, we know that this button must correspond to the second slot, since $$$a_2 = 1$$$ and $$$a_1, a_3 > 1$$$. Then we can press the second button twice and the third button once. Since $$$a_1, a_3 \geq 2$$$, we will definitely receive three cans of lemonade for these three presses. Thus, after $$$5$$$ presses, we will have $$$4$$$ cans of lemonade. - If a can of lemonade drops after the second press, we can make one press on the second button and one press on the third button. After each of these presses, we will definitely receive a can of lemonade. Thus, after $$$4$$$ presses, we will have $$$4$$$ cans of lemonade. It can be shown that it is impossible to guarantee receiving $$$4$$$ cans of lemonade with only $$$4$$$ presses, so the answer is $$$5$$$.
1
Codeforces_test
null
419
stdin
[ "3\n5\n1 2 3 4 5\n8\n8 8 5 3 4 6 8 12\n4\n3 3 3 4\n" ]
[ "4\nAmbiguous\n3\n" ]
[ "3\n5\n1 2 3 4 5\n8\n8 8 5 3 4 6 8 12\n4\n3 3 3 4\n" ]
[ "4\nAmbiguous\n3\n" ]
Jane has decided to solve a list of $$$n$$$ problems on Codeforces. The $$$i$$$-th problem in her list has difficulty $$$d_i$$$, and the last problem in the list is the hardest one (for every problem $$$j < n$$$, $$$d_j < d_n$$$). Jane's problem-solving skill is some integer $$$x$$$ (unknown to you). If a problem's difficulty is greater than $$$x$$$, then Jane cannot solve it, otherwise she can solve it. Jane has solved all problems form the list, except for the last one — she found out that it was too difficult for her. Can you uniquely determine the value of $$$x$$$ — Jane's problem solving skill? Input format: The first line contains one integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. Each test case consists of two lines: - the first line contains one integer $$$n$$$ ($$$2 \le n \le 50$$$) — the number of problems; - the second line contains $$$n$$$ integers $$$d_1, d_2, \dots, d_n$$$ ($$$1 \le d_i \le 50$$$). Additional constraint on the input: in every test case, the last problem is more difficult than every other problem (i. e. $$$d_n > d_j$$$ for every $$$j < n$$$). This means that at least one possible value of $$$x$$$ exists. Output format: For each test case, print one line: - if you can determine the value of $$$x$$$ uniquely, print $$$x$$$; - otherwise, print Ambiguous. The checking program is case-sensitive, so if you print ambiguous or AMBIGUOUS, your answer will be considered wrong. Example Input 0: 3 5 1 2 3 4 5 8 8 8 5 3 4 6 8 12 4 3 3 3 4 Example Output 0: 4 Ambiguous 3 Notes: In the second test case of the example, the value of $$$x$$$ could be $$$11$$$, but it also could be $$$10$$$ (other possible values for $$$x$$$ also exist).
1
Codeforces_test
null
420
stdin
[ "2\n5\n10\n" ]
[ "1 5 2 4 3\n1 2 10 9 7 4 8 3 6 5\n" ]
[ "2\n5\n10\n", "99\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n21\n22\n23\n24\n25\n26\n27\n28\n29\n30\n31\n32\n33\n34\n35\n36\n37\n38\n39\n40\n41\n42\n43\n44\n45\n46\n47\n48\n49\n50\n51\n52\n53\n54\n55\n56\n57\n58\n59\n60\n61\n62\n63\n64\n65\n66\n67\n68\n69\n70\n71\n72\n73\n74\n75\n76\n77\n78\n79\n80\n81\n82\n83\n84\n85\n86\n87\n88\n89\n90\n91\n92\n93\n94\n95\n96\n97\n98\n99\n100\n", "99\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n" ]
[ "1 5 4 3 2\n1 10 9 8 7 6 5 4 3 2\n", "1 2 \n1 3 2 \n1 4 3 2 \n1 5 4 3 2 \n1 6 5 4 3 2 \n1 7 6 5 4 3 2 \n1 8 7 6 5 4 3 2 \n1 9 8 7 6 5 4 3 2 \n1 10 9 8 7 6 5 4 3 2 \n1 11 10 9 8 7 6 5 4 3 2 \n1 12 11 10 9 8 7 6 5 4 3 2 \n1 13 12 11 10 9 8 7 6 5 4 3 2 \n1 14 13 12 11 10 9 8 7 6 5 4 3 2 \n1 15 14 13 12 11 10 9 8 7 6 5 4 3 2 \n1 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 \n1 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 \n1 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 \n1 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 \n1 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 \n1 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 \n1 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 \n1 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 \n1 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 \n1 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 \n1 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 \n1 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 \n1 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 \n1 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 \n1 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 \n1 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 \n1 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 \n1 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 \n1 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 \n1 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 \n1 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 \n1 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 \n1 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 \n1 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 \n1 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 \n1 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 \n1 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 \n1 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 \n1 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 \n1 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 \n1 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 \n1 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 \n1 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 \n1 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 \n1 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 \n1 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 \n1 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 \n1 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 \n1 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 \n1 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 \n1 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 \n1 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 \n1 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 \n1 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 \n1 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 \n1 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 \n1 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 \n1 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 \n1 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 \n1 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 \n1 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 \n1 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 \n1 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 \n1 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 \n1 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 \n1 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 \n1 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 \n1 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 \n1 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 \n1 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 \n1 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 \n1 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 \n1 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 \n1 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 \n1 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 \n1 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 \n1 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 \n1 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 \n1 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 \n1 85 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 \n1 86 85 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 \n1 87 86 85 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 \n1 88 87 86 85 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 \n1 89 88 87 86 85 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 \n1 90 89 88 87 86 85 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 \n1 91 90 89 88 87 86 85 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 \n1 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 \n1 93 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 \n1 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 \n1 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 \n1 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 \n1 97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 \n1 98 97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 \n1 99 98 97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 \n1 100 99 98 97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 \n", "1 100 99 98 97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 \n1 100 99 98 97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 \n1 100 99 98 97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 \n1 100 99 98 97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 \n1 100 99 98 97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 \n1 100 99 98 97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 \n1 100 99 98 97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 \n1 100 99 98 97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 \n1 100 99 98 97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 \n1 100 99 98 97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 \n1 100 99 98 97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 \n1 100 99 98 97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 \n1 100 99 98 97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 \n1 100 99 98 97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 \n1 100 99 98 97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 \n1 100 99 98 97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 \n1 100 99 98 97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 \n1 100 99 98 97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 \n1 100 99 98 97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 \n1 100 99 98 97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 \n1 100 99 98 97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 \n1 100 99 98 97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 \n1 100 99 98 97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 \n1 100 99 98 97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 \n1 100 99 98 97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 \n1 100 99 98 97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 \n1 100 99 98 97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 \n1 100 99 98 97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 \n1 100 99 98 97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 \n1 100 99 98 97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 \n1 100 99 98 97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 \n1 100 99 98 97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 \n1 100 99 98 97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 \n1 100 99 98 97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 \n1 100 99 98 97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 \n1 100 99 98 97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 \n1 100 99 98 97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 \n1 100 99 98 97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 \n1 100 99 98 97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 \n1 100 99 98 97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 \n1 100 99 98 97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 \n1 100 99 98 97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 \n1 100 99 98 97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 \n1 100 99 98 97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 \n1 100 99 98 97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 \n1 100 99 98 97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 \n1 100 99 98 97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 \n1 100 99 98 97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 \n1 100 99 98 97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 \n1 100 99 98 97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 \n1 100 99 98 97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 \n1 100 99 98 97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 \n1 100 99 98 97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 \n1 100 99 98 97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 \n1 100 99 98 97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 \n1 100 99 98 97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 \n1 100 99 98 97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 \n1 100 99 98 97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 \n1 100 99 98 97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 \n1 100 99 98 97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 \n1 100 99 98 97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 \n1 100 99 98 97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 \n1 100 99 98 97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 \n1 100 99 98 97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 \n1 100 99 98 97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 \n1 100 99 98 97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 \n1 100 99 98 97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 \n1 100 99 98 97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 \n1 100 99 98 97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 \n1 100 99 98 97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 \n1 100 99 98 97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 \n1 100 99 98 97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 \n1 100 99 98 97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 \n1 100 99 98 97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 \n1 100 99 98 97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 \n1 100 99 98 97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 \n1 100 99 98 97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 \n1 100 99 98 97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 \n1 100 99 98 97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 \n1 100 99 98 97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 \n1 100 99 98 97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 \n1 100 99 98 97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 \n1 100 99 98 97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 \n1 100 99 98 97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 \n1 100 99 98 97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 \n1 100 99 98 97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 \n1 100 99 98 97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 \n1 100 99 98 97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 \n1 100 99 98 97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 \n1 100 99 98 97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 \n1 100 99 98 97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 \n1 100 99 98 97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 \n1 100 99 98 97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 \n1 100 99 98 97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 \n1 100 99 98 97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 \n1 100 99 98 97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 \n1 100 99 98 97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 \n1 100 99 98 97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 \n1 100 99 98 97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 \n" ]
Yes, this is another one of those constructive permutation problems. You are given an integer $$$n$$$. You have to construct a permutation $$$p$$$ of size $$$n$$$, i. e. an array of $$$n$$$ integers, where every integer from $$$1$$$ to $$$n$$$ appears exactly once. Every pair of adjacent elements in the permutation ($$$p_i$$$ and $$$p_{i+1}$$$) must meet the following condition: - if one of them is divisible by the other, the condition $$$p_i < p_{i+1}$$$ must hold; - otherwise, the condition $$$p_i > p_{i+1}$$$ must hold. Input format: The first line contains one integer $$$t$$$ ($$$1 \le t \le 99$$$) — the number of test cases. Each test case consists of one line, containing one integer $$$n$$$ ($$$2 \le n \le 100$$$). Output format: For each test case, print the answer as follows: - if no permutation of size $$$n$$$ meeting the conditions from the statement exists, print $$$-1$$$; - otherwise, print $$$n$$$ distinct integers from $$$1$$$ to $$$n$$$ — the required permutation. If there are mutliple answers, print any of them. Example Input 0: 2 5 10 Example Output 0: 1 5 2 4 3 1 2 10 9 7 4 8 3 6 5
1
Codeforces_test
null
421
stdin
[ "8\n2\n114 109\n2\n17 10\n3\n76 83 88\n8\n38 45 38 80 85 92 99 106\n5\n63 58 65 58 65\n8\n117 124 48 53 48 43 54 49\n5\n95 102 107 114 121\n10\n72 77 82 75 70 75 68 75 68 75\n" ]
[ "YES\nYES\nYES\nNO\nYES\nNO\nYES\nYES\n" ]
[ "8\n2\n114 109\n2\n17 10\n3\n76 83 88\n8\n38 45 38 80 85 92 99 106\n5\n63 58 65 58 65\n8\n117 124 48 53 48 43 54 49\n5\n95 102 107 114 121\n10\n72 77 82 75 70 75 68 75 68 75\n", "19\n38\n1 6 11 16 21 26 31 36 41 46 51 56 61 66 71 76 81 86 91 96 101 106 111 116 121 126 121 126 121 126 121 126 121 126 121 126 121 126\n2\n48 1\n2\n48 53\n2\n48 59\n2\n20 48\n2\n43 48\n2\n1 2\n2\n1 2\n2\n1 2\n2\n1 2\n2\n1 2\n2\n1 2\n2\n1 2\n2\n1 2\n2\n1 2\n2\n1 2\n2\n1 2\n2\n1 2\n2\n1 2\n" ]
[ "YES\nYES\nYES\nNO\nYES\nNO\nYES\nYES\n", "YES\nNO\nYES\nNO\nNO\nYES\nNO\nNO\nNO\nNO\nNO\nNO\nNO\nNO\nNO\nNO\nNO\nNO\nNO\n" ]
Boris Notkin composes melodies. He represents them as a sequence of notes, where each note is encoded as an integer from $$$0$$$ to $$$127$$$ inclusive. The interval between two notes $$$a$$$ and $$$b$$$ is equal to $$$|a - b|$$$ semitones. Boris considers a melody perfect if the interval between each two adjacent notes is either $$$5$$$ semitones or $$$7$$$ semitones. After composing his latest melodies, he enthusiastically shows you his collection of works. Help Boris Notkin understand whether his melodies are perfect. Input format: The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 1000$$$) — the number of melodies. Each melody is described by two lines. The first line contains an integer $$$n$$$ ($$$2 \leq n \leq 50$$$) — the number of notes in the melody. The second line contains $$$n$$$ integers $$$a_{1}, a_{2}, \dots, a_{n}$$$ ($$$0 \leq a_{i} \leq 127$$$) — the notes of the melody. Output format: For each melody, output "YES", if it is perfect; otherwise, output "NO". You can output the answer in any case (upper or lower). For example, the strings "yEs", "yes", "Yes", and "YES" will be recognized as positive responses. Example Input 0: 8 2 114 109 2 17 10 3 76 83 88 8 38 45 38 80 85 92 99 106 5 63 58 65 58 65 8 117 124 48 53 48 43 54 49 5 95 102 107 114 121 10 72 77 82 75 70 75 68 75 68 75 Example Output 0: YES YES YES NO YES NO YES YES
1
Codeforces_test
null
422
stdin
[ "3\n5 1 1\n10101\n5 2 1\n10101\n6 3 2\n000000\n" ]
[ "2\n0\n1\n" ]
[ "3\n5 1 1\n10101\n5 2 1\n10101\n6 3 2\n000000\n" ]
[ "2\n0\n1\n" ]
Rostam's loyal horse, Rakhsh, has seen better days. Once powerful and fast, Rakhsh has grown weaker over time, struggling to even move. Rostam worries that if too many parts of Rakhsh's body lose strength at once, Rakhsh might stop entirely. To keep his companion going, Rostam decides to strengthen Rakhsh, bit by bit, so no part of his body is too frail for too long. Imagine Rakhsh's body as a line of spots represented by a binary string $$$s$$$ of length $$$n$$$, where each $$$0$$$ means a weak spot and each $$$1$$$ means a strong one. Rostam's goal is to make sure that no interval of $$$m$$$ consecutive spots is entirely weak (all $$$0$$$s). Luckily, Rostam has a special ability called Timar, inherited from his mother Rudabeh at birth. With Timar, he can select any segment of length $$$k$$$ and instantly strengthen all of it (changing every character in that segment to $$$1$$$). The challenge is to figure out the minimum number of times Rostam needs to use Timar to keep Rakhsh moving, ensuring there are no consecutive entirely weak spots of length $$$m$$$. Input format: The first line contains an integer $$$t$$$ ($$$1 \le t \le 10^4$$$), the number of test cases. The first line of each test case contains three numbers $$$n$$$, $$$m$$$, $$$k$$$ ($$$1 \le m, k \le n \le 2 \cdot 10^5$$$). The second line of each test case contains a binary string $$$s$$$ of $$$n$$$ characters $$$s_1s_2 \ldots s_n$$$. ($$$s_i \in \{$$$0,1$$$\}$$$ for $$$1 \le i \le n$$$). It is guaranteed that the sum of $$$n$$$ over all test cases does not exceed $$$2 \cdot 10^5$$$. Output format: For each test case, output the minimum number of times Rostam needs to use Timar to keep Rakhsh moving, ensuring there are no consecutive entirely weak spots of length $$$m$$$. Example Input 0: 3 5 1 1 10101 5 2 1 10101 6 3 2 000000 Example Output 0: 2 0 1 Notes: In the first test case, we should apply an operation on each 0. In the second test case, $$$s$$$ is already ok. In the third test case, we can perform an operation on interval $$$[3,4]$$$ to get 001100.
1
Codeforces_test
null
423
stdin
[ "5\n1 1\n-179\n1 1\n5 3\n-2 2 -1 3 -1\n2 4\n1 5\n1 3\n7 1\n1 1 1 -4 1 1 1\n1 7\n7 2\n2 -2 2 -2 1 2 -1\n1 7\n2 7\n4 4\n1000000000 1000000000 999999999 -1000000000\n2 4\n3 4\n2 3\n1 3\n" ]
[ "-1\n2\n5\n-1\n8\n6\n6\n2\n-1\n1\n2\n" ]
[ "5\n1 1\n-179\n1 1\n5 3\n-2 2 -1 3 -1\n2 4\n1 5\n1 3\n7 1\n1 1 1 -4 1 1 1\n1 7\n7 2\n2 -2 2 -2 1 2 -1\n1 7\n2 7\n4 4\n1000000000 1000000000 999999999 -1000000000\n2 4\n3 4\n2 3\n1 3\n" ]
[ "-1\n2\n5\n-1\n8\n6\n6\n2\n-1\n1\n2\n" ]
In a desert city with a hilly landscape, the city hall decided to level the road surface by purchasing a dump truck. The road is divided into $$$n$$$ sections, numbered from $$$1$$$ to $$$n$$$ from left to right. The height of the surface in the $$$i$$$-th section is equal to $$$a_i$$$. If the height of the $$$i$$$-th section is greater than $$$0$$$, then the dump truck must take sand from the $$$i$$$-th section of the road, and if the height of the $$$i$$$-th section is less than $$$0$$$, the dump truck must fill the pit in the $$$i$$$-th section of the road with sand. It is guaranteed that the initial heights are not equal to $$$0$$$. When the dump truck is in the $$$i$$$-th section of the road, it can either take away $$$x$$$ units of sand, in which case the height of the surface in the $$$i$$$-th section will decrease by $$$x$$$, or it can fill in $$$x$$$ units of sand (provided that it currently has at least $$$x$$$ units of sand in its bed), in which case the height of the surface in the $$$i$$$-th section of the road will increase by $$$x$$$. The dump truck can start its journey from any section of the road. Moving to an adjacent section on the left or right takes $$$1$$$ minute, and the time for loading and unloading sand can be neglected. The dump truck has an infinite capacity and is initially empty. You need to find the minimum time required for the dump truck to level the sand so that the height in each section becomes equal to $$$0$$$. Note that after all movements, the dump truck may still have sand left in its bed. You need to solve this problem independently for the segments numbered from $$$l_i$$$ to $$$r_i$$$. Sand outside the segment cannot be used. Input format: Each test consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains two integers $$$n$$$ and $$$q$$$ ($$$1 \le n, q \le 3 \cdot 10^5$$$) — the number of sections and the number of queries. The second line of each test case contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$-10^9 \le a_i \le 10^9$$$, $$$a_i \neq 0$$$) — the initial height in each section. The $$$i$$$-th of the following $$$q$$$ lines contains two integers $$$l_i$$$ and $$$r_i$$$ ($$$1 \le l_i \le r_i \le n$$$) — the boundaries of the segment of sections for which the minimum time needs to be determined. It is guaranteed that the sum of $$$n$$$ over all test cases and the sum of $$$q$$$ over all test cases do not exceed $$$3 \cdot 10^5$$$. Output format: For each query, output the minimum time required to level the sand in the segment $$$[l_i, r_i]$$$, or $$$-1$$$ if it is impossible. Example Input 0: 5 1 1 -179 1 1 5 3 -2 2 -1 3 -1 2 4 1 5 1 3 7 1 1 1 1 -4 1 1 1 1 7 7 2 2 -2 2 -2 1 2 -1 1 7 2 7 4 4 1000000000 1000000000 999999999 -1000000000 2 4 3 4 2 3 1 3 Example Output 0: -1 2 5 -1 8 6 6 2 -1 1 2 Notes: In the first test case, $$$179$$$ units of sand need to be added to the only section. However, there is nowhere to take it from, so this is impossible. In the second test case: - In the first query, the dump truck can start its journey at the second section. It can take $$$2$$$ units of sand, after which the height in the second section will become $$$0$$$. Then the dump truck can move to the third section. It can pour $$$1$$$ unit of sand there, after which the height in the third section will become $$$0$$$. Then the dump truck can move to the fourth section. There it can take $$$3$$$ units of sand, after which the height in the fourth section will become $$$0$$$. In total, the dump truck will spend $$$2$$$ minutes on movements. - In the second query, the dump truck can start its journey at the fourth section. It can take $$$3$$$ units of sand, after which the height in the fourth section will become $$$0$$$. Then the dump truck can move to the fifth section. It can pour $$$1$$$ unit of sand there, after which the height in the fifth section will become $$$0$$$. Then the dump truck can move back to the fourth section and then to the third. It can pour $$$1$$$ unit of sand there, after which the height in the third section will become $$$0$$$. Then the dump truck can move to the second section. It can take $$$2$$$ units of sand. Then it can move to the first section. It can pour $$$2$$$ units of sand there, after which the height in the first section will become $$$0$$$. In total, the dump truck will spend $$$5$$$ minutes on movements. - In the third query, the dump truck will not be able to make the height in each section equal to $$$0$$$.
1
Codeforces_test
null
424
stdin
[ "7\n5 5\n100 20 80\n1 5 30 100\n1 2 20 50\n2 3 20 50\n3 4 20 50\n4 5 20 50\n2 1\n100 50 60\n1 2 55 110\n4 4\n100 40 60\n1 2 30 100\n2 4 30 100\n1 3 20 50\n3 4 20 50\n3 3\n100 80 90\n1 2 1 10\n2 3 10 50\n1 3 20 21\n3 2\n58 55 57\n2 1 1 3\n2 3 3 4\n2 1\n12 9 10\n2 1 6 10\n5 5\n8 5 6\n2 1 1 8\n2 3 4 8\n4 2 2 4\n5 3 3 4\n4 5 2 6\n" ]
[ "0\n-1\n60\n80\n53\n3\n2\n" ]
[ "7\n5 5\n100 20 80\n1 5 30 100\n1 2 20 50\n2 3 20 50\n3 4 20 50\n4 5 20 50\n2 1\n100 50 60\n1 2 55 110\n4 4\n100 40 60\n1 2 30 100\n2 4 30 100\n1 3 20 50\n3 4 20 50\n3 3\n100 80 90\n1 2 1 10\n2 3 10 50\n1 3 20 21\n3 2\n58 55 57\n2 1 1 3\n2 3 3 4\n2 1\n12 9 10\n2 1 6 10\n5 5\n8 5 6\n2 1 1 8\n2 3 4 8\n4 2 2 4\n5 3 3 4\n4 5 2 6\n" ]
[ "0\n-1\n60\n80\n53\n3\n2\n" ]
You live in a city consisting of $$$n$$$ intersections and $$$m$$$ streets connecting some pairs of intersections. You can travel in either direction on each street. No two streets connect the same pair of intersections, and no street connects an intersection to itself. You can reach any intersection from any other, possibly passing through some other intersections. Every minute, you can board a bus at intersection $$$u_i$$$ and travel for $$$l_{i1}$$$ minutes to intersection $$$v_i$$$. Conversely, you can travel from intersection $$$v_i$$$ to intersection $$$u_i$$$ in $$$l_{i1}$$$ minutes. You can only board and exit the bus at intersections. You can only board the bus at an intersection if you are currently there. You can also walk along each street, which takes $$$l_{i2} > l_{i1}$$$ minutes. You can make stops at intersections. You live at intersection number $$$1$$$. Today you woke up at time $$$0$$$, and you have an important event scheduled at intersection number $$$n$$$, which you must reach no later than time $$$t_0$$$. You also have a phone call planned that will last from $$$t_1$$$ to $$$t_2$$$ minutes ($$$t_1 < t_2 < t_0$$$). During the phone call, you cannot ride the bus, but you can walk along any streets, make stops, or stay at home. You can exit the bus at minute $$$t_1$$$ and board the bus again at minute $$$t_2$$$. Since you want to get enough sleep, you became curious — how late can you leave home to have time to talk on the phone and still not be late for the event? Input format: The first line contains an integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. The following are the descriptions of the test cases. The first line of each test case contains two integers $$$n$$$, $$$m$$$ ($$$2 \le n \le 10^5, 1 \le m \le 10^5$$$) — the number of intersections and streets in the city. The second line of each test case contains three integers $$$t_0$$$, $$$t_1$$$, $$$t_2$$$ ($$$1 \le t_1 < t_2 < t_0 \le 10^9$$$) — the start time of the event, the start time of the phone call, and its end time, respectively. The next $$$m$$$ lines of each test case contain descriptions of the streets. The $$$i$$$-th line contains four integers $$$u_i$$$, $$$v_i$$$, $$$l_{i1}$$$, $$$l_{i2}$$$ ($$$1 \le u_i, v_i \le n$$$, $$$u_i \neq v_i$$$, $$$1 \le l_{i1} < l_{i2} \le 10^9$$$) — the numbers of the intersections connected by the $$$i$$$-th street, as well as the travel time along the street by bus and on foot. It is guaranteed that no two streets connect the same pair of intersections and that it is possible to reach any intersection from any other. It is guaranteed that the sum of the values of $$$n$$$ across all test cases does not exceed $$$10^5$$$. It is also guaranteed that the sum of the values of $$$m$$$ across all test cases does not exceed $$$10^5$$$. Output format: For each test case, output a single integer — the latest time you can leave home to have time to talk on the phone and not be late for the event. If you cannot reach the event on time, output -1. Example Input 0: 7 5 5 100 20 80 1 5 30 100 1 2 20 50 2 3 20 50 3 4 20 50 4 5 20 50 2 1 100 50 60 1 2 55 110 4 4 100 40 60 1 2 30 100 2 4 30 100 1 3 20 50 3 4 20 50 3 3 100 80 90 1 2 1 10 2 3 10 50 1 3 20 21 3 2 58 55 57 2 1 1 3 2 3 3 4 2 1 12 9 10 2 1 6 10 5 5 8 5 6 2 1 1 8 2 3 4 8 4 2 2 4 5 3 3 4 4 5 2 6 Example Output 0: 0 -1 60 80 53 3 2
1
Codeforces_test
null
425
stdin
[ "3\n2 6\n7 1\n8 5\n" ]
[ "1 3 \n1 3 7 9 \n1 3 5 7 9\n" ]
[ "3\n2 6\n7 1\n8 5\n", "9\n1000000000 1\n1000000000 2\n1000000000 3\n1000000000 4\n1000000000 5\n1000000000 6\n1000000000 7\n1000000000 8\n1000000000 9\n", "3\n5388586 7\n1625078 5\n548212 3\n" ]
[ "1 3 \n1 3 7 9 \n1 3 5 7 9 \n", "1 3 7 9 \n1 3 7 9 \n1 3 7 9 \n1 3 7 9 \n1 3 5 7 9 \n1 3 7 9 \n1 3 7 9 \n1 3 7 9 \n1 3 7 9 \n", "1 3 7 9 \n1 3 5 7 9 \n1 3 7 9 \n" ]
Artem wrote the digit $$$d$$$ on the board exactly $$$n!$$$ times in a row. So, he got the number $$$dddddd \dots ddd$$$ (exactly $$$n!$$$ digits). Now he is curious about which odd digits from $$$1$$$ to $$$9$$$ divide the number written on the board. Input format: The first line contains a single integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. The next $$$t$$$ test cases follow. Each test case consists of a single line containing two integers $$$n$$$ and $$$d$$$ ($$$2 \le n \le 10^9$$$, $$$1 \le d \le 9$$$). Output format: For each test case, output the odd digits in ascending order that divide the number written on the board. Example Input 0: 3 2 6 7 1 8 5 Example Output 0: 1 3 1 3 7 9 1 3 5 7 9 Notes: The factorial of a positive integer $$$n$$$ ($$$n!$$$) is the product of all integers from $$$1$$$ to $$$n$$$. For example, the factorial of $$$5$$$ is $$$1 \cdot 2 \cdot 3 \cdot 4 \cdot 5 = 120$$$.
1
Codeforces_test
null
426
stdin
[ "9\n5\n1 1 1 2 3\n6\n2 1 2 2 1 1\n4\n1 2 1 1\n6\n2 1 1 2 2 4\n4\n2 1 2 3\n6\n1 2 2 1 2 1\n5\n4 5 5 1 5\n7\n1 4 3 5 1 1 3\n7\n3 1 3 2 2 3 3\n" ]
[ "1\n2\n1\n0\n0\n1\n1\n0\n2\n" ]
[ "9\n5\n1 1 1 2 3\n6\n2 1 2 2 1 1\n4\n1 2 1 1\n6\n2 1 1 2 2 4\n4\n2 1 2 3\n6\n1 2 2 1 2 1\n5\n4 5 5 1 5\n7\n1 4 3 5 1 1 3\n7\n3 1 3 2 2 3 3\n" ]
[ "1\n2\n1\n0\n0\n1\n1\n0\n2\n" ]
Even in university, students need to relax. That is why Sakurakos teacher decided to go on a field trip. It is known that all of the students will be walking in one line. The student with index $$$i$$$ has some topic of interest which is described as $$$a_i$$$. As a teacher, you want to minimise the disturbance of the line of students. The disturbance of the line is defined as the number of neighbouring people with the same topic of interest. In other words, disturbance is the number of indices $$$j$$$ ($$$1 \le j < n$$$) such that $$$a_j = a_{j + 1}$$$. In order to do this, you can choose index $$$i$$$ ($$$1\le i\le n$$$) and swap students at positions $$$i$$$ and $$$n-i+1$$$. You can perform any number of swaps. Your task is to determine the minimal amount of disturbance that you can achieve by doing the operation described above any number of times. Input format: The first line contains one integer $$$t$$$ ($$$1\le t\le 10^4$$$) — the number of test cases. Each test case is described by two lines. - The first line contains one integer $$$n$$$ ($$$2 \le n \le 10^5$$$) — the length of the line of students. - The second line contains $$$n$$$ integers $$$a_i$$$ ($$$1\le a_i\le n$$$) — the topics of interest of students in line. It is guaranteed that the sum of $$$n$$$ across all test cases does not exceed $$$2\cdot 10^5$$$. Output format: For each test case, output the minimal possible disturbance of the line that you can achieve. Example Input 0: 9 5 1 1 1 2 3 6 2 1 2 2 1 1 4 1 2 1 1 6 2 1 1 2 2 4 4 2 1 2 3 6 1 2 2 1 2 1 5 4 5 5 1 5 7 1 4 3 5 1 1 3 7 3 1 3 2 2 3 3 Example Output 0: 1 2 1 0 0 1 1 0 2 Notes: In the first example, it is necessary to apply the operation to $$$i=2$$$, thus the array will become $$$[1, \textbf{2}, 1, \textbf{1}, 3]$$$, with the bold elements indicating those that have swapped places. The disturbance of this array is equal to $$$1$$$. In the fourth example, it is sufficient to apply the operation to $$$i=3$$$, thus the array will become $$$[2, 1, \textbf{2}, \textbf{1}, 2, 4]$$$. The disturbance of this array is equal to $$$0$$$. In the eighth example, it is sufficient to apply the operation to $$$i=3$$$, thus the array will become $$$[1, 4, \textbf{1}, 5, \textbf{3}, 1, 3]$$$. The disturbance of this array is equal to $$$0$$$.
1
Codeforces_test
null
427
stdin
[ "4\n1 1\n3 2\n3 3\n15 8\n" ]
[ "1\n1\n3\n1 2 3\n-1\n5\n1 4 7 10 13\n" ]
[ "4\n1 1\n3 2\n3 3\n15 8\n", "2\n199999 199999\n1 1\n", "2\n1 1\n199999 1\n", "1\n199999 62226\n", "2\n3 1\n199997 108263\n", "10\n9999 1\n9999 9999\n15673 1\n38721 38721\n89211 1\n30183 30183\n5023 1\n1023 1023\n111 1\n57 57\n", "10\n57 1\n111 111\n1023 1\n5023 5023\n30183 1\n89211 89211\n38721 1\n15673 15673\n9999 1\n9999 9999\n", "1\n199999 199998\n" ]
[ "1\n1\n3\n1 2 3\n-1\n3\n1 8 9\n", "-1\n1\n1\n", "1\n1\n-1\n", "3\n1 62226 62227\n", "-1\n3\n1 108262 108265\n", "-1\n-1\n-1\n-1\n-1\n-1\n-1\n-1\n-1\n-1\n", "-1\n-1\n-1\n-1\n-1\n-1\n-1\n-1\n-1\n-1\n", "3\n1 199998 199999\n" ]
You are given an array $$$a = [1, 2, \ldots, n]$$$, where $$$n$$$ is odd, and an integer $$$k$$$. Your task is to choose an odd positive integer $$$m$$$ and to split $$$a$$$ into $$$m$$$ subarrays$$$^{\dagger}$$$ $$$b_1, b_2, \ldots, b_m$$$ such that: - Each element of the array $$$a$$$ belongs to exactly one subarray. - For all $$$1 \le i \le m$$$, $$$|b_i|$$$ is odd, i.e., the length of each subarray is odd. - $$$\operatorname{median}([\operatorname{median}(b_1), \operatorname{median}(b_2), \ldots, \operatorname{median}(b_m)]) = k$$$, i.e., the median$$$^{\ddagger}$$$ of the array of medians of all subarrays must equal $$$k$$$. $$$\operatorname{median}(c)$$$ denotes the median of the array $$$c$$$. $$$^{\dagger}$$$A subarray of the array $$$a$$$ of length $$$n$$$ is the array $$$[a_l, a_{l + 1}, \ldots, a_r]$$$ for some integers $$$1 \le l \le r \le n$$$. $$$^{\ddagger}$$$A median of the array of odd length is the middle element after the array is sorted in non-decreasing order. For example: $$$\operatorname{median}([1,2,5,4,3]) = 3$$$, $$$\operatorname{median}([3,2,1]) = 2$$$, $$$\operatorname{median}([2,1,2,1,2,2,2]) = 2$$$. Input format: Each test consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \le t \le 5000$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le k \le n < 2 \cdot 10^5$$$, $$$n$$$ is odd) — the length of array $$$a$$$ and the desired median of the array of medians of all subarrays. It is guaranteed that the sum of $$$n$$$ over all test cases does not exceed $$$2 \cdot 10^5$$$. Output format: For each test case: - If there is no suitable partition, output $$$-1$$$ in a single line. - Otherwise, in the first line, output an odd integer $$$m$$$ ($$$1 \le m \le n$$$), and in the second line, output $$$m$$$ distinct integers $$$p_1, p_2 , p_3 , \ldots, p_m$$$ ($$$1 = p_1 < p_2 < p_3 < \ldots < p_m \le n$$$) — denoting the left borders of each subarray. In detail, for a valid answer $$$[p_1, p_2, \ldots, p_m]$$$: - $$$b_1 = \left[ a_{p_1}, a_{p_1 + 1}, \ldots, a_{p_2 - 1} \right]$$$ - $$$b_2 = \left[ a_{p_2}, a_{p_2 + 1}, \ldots, a_{p_3 - 1} \right]$$$ - $$$\ldots$$$ - $$$b_m = \left[ a_{p_m}, a_{p_m + 1}, \ldots, a_n \right]$$$. If there are multiple solutions, you can output any of them. Example Input 0: 4 1 1 3 2 3 3 15 8 Example Output 0: 1 1 3 1 2 3 -1 5 1 4 7 10 13 Notes: In the first test case, the given partition has $$$m = 1$$$ and $$$b_1 = [1]$$$. It is obvious that $$$\operatorname{median}([\operatorname{median}([1])]) = \operatorname{median}([1]) = 1$$$. In the second test case, the given partition has $$$m = 3$$$ and: - $$$b_1 = [1]$$$ - $$$b_2 = [2]$$$ - $$$b_3 = [3]$$$ Therefore, $$$\operatorname{median}([\operatorname{median}([1]), \operatorname{median}([2]), \operatorname{median}([3])]) = \operatorname{median}([1, 2, 3]) = 2$$$. In the third test case, there is no valid partition for $$$k = 3$$$. In the fourth test case, the given partition has $$$m = 5$$$ and: - $$$b_1 = [1, 2, 3]$$$ - $$$b_2 = [4, 5, 6]$$$ - $$$b_3 = [7, 8, 9]$$$ - $$$b_4 = [10, 11, 12]$$$ - $$$b_5 = [13, 14, 15]$$$ Therefore, $$$\operatorname{median}([\operatorname{median}([1, 2, 3]), \operatorname{median}([4, 5, 6]), \operatorname{median}([7, 8, 9]), \operatorname{median}([10, 11, 12]), \operatorname{median}([13, 14, 15])]) = \operatorname{median}([2, 5, 8, 11, 14]) = 8$$$.
1
Codeforces_test
null
428
stdin
[ "4\n1 2\n3 4\n2 5\n2 5\n3 7\n6 7\n4 5\n2 8\n" ]
[ "1\n3\n2\n3\n" ]
[ "4\n1 2\n3 4\n2 5\n2 5\n3 7\n6 7\n4 5\n2 8\n", "1\n10 100\n10 100\n" ]
[ "1\n3\n2\n3\n", "90\n" ]
There are $$$100$$$ rooms arranged in a row and $$$99$$$ doors between them; the $$$i$$$-th door connects rooms $$$i$$$ and $$$i+1$$$. Each door can be either locked or unlocked. Initially, all doors are unlocked. We say that room $$$x$$$ is reachable from room $$$y$$$ if all doors between them are unlocked. You know that: - Alice is in some room from the segment $$$[l, r]$$$; - Bob is in some room from the segment $$$[L, R]$$$; - Alice and Bob are in different rooms. However, you don't know the exact rooms they are in. You don't want Alice and Bob to be able to reach each other, so you are going to lock some doors to prevent that. What's the smallest number of doors you have to lock so that Alice and Bob cannot meet, regardless of their starting positions inside the given segments? Input format: The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. The first line of each test case contains two integers $$$l$$$ and $$$r$$$ ($$$1 \le l < r \le 100$$$) — the bounds of the segment of rooms where Alice is located. The second line of each test case contains two integers $$$L$$$ and $$$R$$$ ($$$1 \le L < R \le 100$$$) — the bounds of the segment of rooms where Bob is located. Output format: For each test case, print a single integer — the smallest number of doors you have to lock so that Alice and Bob cannot meet, regardless of their starting positions inside the given segments. Example Input 0: 4 1 2 3 4 2 5 2 5 3 7 6 7 4 5 2 8 Example Output 0: 1 3 2 3 Notes: In the first test case, it is sufficient to lock the door between rooms $$$2$$$ and $$$3$$$. In the second test case, the following doors have to be locked: $$$(2,3)$$$, $$$(3,4)$$$, $$$(4,5)$$$. In the third test case, the following doors have to be locked: $$$(5, 6)$$$ and $$$(6,7)$$$.
1
Codeforces_test
null
429
stdin
[ "4\n5\n2 4 6 2 5\n5\n5 4 4 5 1\n4\n6 8 2 3\n1\n1\n" ]
[ "10\n11\n10\n1\n" ]
[ "4\n5\n2 4 6 2 5\n5\n5 4 4 5 1\n4\n6 8 2 3\n1\n1\n" ]
[ "10\n11\n10\n1\n" ]
You're given an array $$$a$$$ initially containing $$$n$$$ integers. In one operation, you must do the following: - Choose a position $$$i$$$ such that $$$1 < i \le |a|$$$ and $$$a_i = |a| + 1 - i$$$, where $$$|a|$$$ is the current size of the array. - Append $$$i - 1$$$ zeros onto the end of $$$a$$$. After performing this operation as many times as you want, what is the maximum possible length of the array $$$a$$$? Input format: Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 1000$$$). The description of the test cases follows. The first line of each test case contains $$$n$$$ ($$$1 \le n \le 3 \cdot 10^5$$$) — the length of the array $$$a$$$. The second line of each test case contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \le a_i \le 10^{12}$$$). It is guaranteed that the sum of $$$n$$$ over all test cases does not exceed $$$3 \cdot 10^5$$$. Output format: For each test case, output a single integer — the maximum possible length of $$$a$$$ after performing some sequence of operations. Example Input 0: 4 5 2 4 6 2 5 5 5 4 4 5 1 4 6 8 2 3 1 1 Example Output 0: 10 11 10 1 Notes: In the first test case, we can first choose $$$i = 4$$$, since $$$a_4 = 5 + 1 - 4 = 2$$$. After this, the array becomes $$$[2, 4, 6, 2, 5, 0, 0, 0]$$$. We can then choose $$$i = 3$$$ since $$$a_3 = 8 + 1 - 3 = 6$$$. After this, the array becomes $$$[2, 4, 6, 2, 5, 0, 0, 0, 0, 0]$$$, which has a length of $$$10$$$. It can be shown that no sequence of operations will make the final array longer. In the second test case, we can choose $$$i=2$$$, then $$$i=3$$$, then $$$i=4$$$. The final array will be $$$[5, 4, 4, 5, 1, 0, 0, 0, 0, 0, 0]$$$, with a length of $$$11$$$.
1
Codeforces_test
null
430
stdin
[ "3\n2 2 4\n1 1 3\n2 1 2\n100 2 1\n4 1 10\n4 4 10\n10 5 2\n1 1 4\n3 1 2\n4 2 5\n2 2 1\n5 3 4\n" ]
[ "Anda\nKamu\nAnda\n" ]
[ "3\n2 2 4\n1 1 3\n2 1 2\n100 2 1\n4 1 10\n4 4 10\n10 5 2\n1 1 4\n3 1 2\n4 2 5\n2 2 1\n5 3 4\n" ]
[ "Anda\nKamu\nAnda\n" ]
Your friends, Anda and Kamu decide to play a game called Grid Game and ask you to become the gamemaster. As the gamemaster, you set up a triangular grid of size $$$N$$$. The grid has $$$N$$$ rows (numbered from $$$1$$$ to $$$N$$$). Row $$$r$$$ has $$$r$$$ cells; the $$$c$$$-th cell of row $$$r$$$ is denoted as $$$(r, c)$$$. Before the game starts, $$$M$$$ different cells (numbered from $$$1$$$ to $$$M$$$) are chosen: at cell $$$(R_i, C_i)$$$, you add $$$A_i$$$ stones on it. You then give Anda and Kamu an integer $$$K$$$ and commence the game. Anda and Kamu will take turns alternately with Anda taking the first turn. A player on their turn will do the following. - Choose a cell $$$(r, c)$$$ with at least one stone on it. - Remove at least one but at most $$$K$$$ stones from the chosen cell. - For each cell $$$(x, y)$$$ such that $$$r + 1 \leq x \leq \min(N, r + K)$$$ and $$$c \leq y \leq c + x - r$$$, add zero or more stones but at most $$$K$$$ stones to cell $$$(x, y)$$$. The following illustrations show all the possible cells in which you can add stones for $$$K = 3$$$. You choose the cell $$$(2, 1)$$$ for the left illustration and the cell $$$(4, 3)$$$ for the right illustration. A player who is unable to complete their turn (because there are no more stones on the grid) will lose the game, and the opposing player wins. Determine who will win the game if both players play optimally. Input format: This problem is a multi-case problem. The first line consists of an integer $$$T$$$ ($$$1 \leq T \leq 100$$$) that represents the number of test cases. Each test case starts with a single line consisting of three integers $$$N$$$ $$$M$$$ $$$K$$$ ($$$1 \leq N \leq 10^9; 1 \leq M, K \leq 200\,000$$$). Then, each of the next $$$M$$$ lines consists of three integers $$$R_i$$$ $$$C_i$$$ $$$A_i$$$ ($$$1 \leq C_i \leq R_i \leq N; 1 \leq A_1 \leq 10^9$$$). The pairs $$$(R_i, C_i)$$$ are distinct. The sum of $$$M$$$ across all test cases does not exceed $$$200\,000$$$. Output format: For each case, output a string in a single line representing the player who will win the game if both players play optimally. Output Anda if Anda, the first player, wins. Otherwise, output Kamu. Example Input 0: 3 2 2 4 1 1 3 2 1 2 100 2 1 4 1 10 4 4 10 10 5 2 1 1 4 3 1 2 4 2 5 2 2 1 5 3 4 Example Output 0: Anda Kamu Anda Notes: Explanation for the sample input/output #1 For the first case, during the first turn, Anda will remove all the stones from cell $$$(1, 1)$$$ and then add three stones at $$$(2, 1)$$$. The only cell with stones left is now cell $$$(2, 1)$$$ with five stones, so Kamu must remove stones from that cell. No matter how many stones are removed by Kamu, Anda can remove all the remaining stones at $$$(2, 1)$$$ and win the game. For the second case, Kamu can always mirror whatever move made by Anda until Anda can no longer complete their turn.
1
Codeforces_test
null
431
stdin
[ "3 2\n", "5 3\n" ]
[ "7\n", "67\n" ]
[ "3 2\n", "5 3\n", "1000000 1000000000\n", "1000000 999999\n", "1000000 1\n", "1 1000000000\n", "644271 497470\n", "1000000 2\n", "514514 514\n", "514514 515515\n", "514514 514513\n", "998789 789897\n", "999888 3\n", "556888 1324\n", "51515 55\n", "8 9\n", "18 18\n" ]
[ "7\n", "67\n", "793302832\n", "793302830\n", "1\n", "1\n", "189775039\n", "421273116\n", "638444431\n", "915424391\n", "915424389\n", "658100689\n", "117498587\n", "580017151\n", "18469295\n", "2187\n", "129140163\n" ]
Image generated by ChatGPT 4o. Alice likes singing. As a singing enthusiast, Alice has listened to countless songs and has tried singing them many times. However, occasionally, some songs make Alice feel bored. After some research, Alice believes that this is because even though the songs she chose are all different, due to her instinctive preference, they all turn out to be musically similar to one another. To thoroughly analyze this, Alice decided to study the sheet music of the songs. For convenience, Alice represented a song of length $$$n$$$ as an integer sequence $$$a_1, a_2, \ldots, a_n$$$, where $$$a_i$$$ is the pitch of the $$$i$$$-th note. Then she defined the musical equivalence between songs. Two songs $$$a_1, a_2, \ldots, a_n$$$ and $$$b_1, b_2, \ldots, b_n$$$ of length $$$n$$$ are musically equivalent if for all $$$1\leq i<n$$$, both $$$a_i, a_{i+1}$$$ and $$$b_{i}, b_{i+1}$$$ have the same pitch relationship. More specifically, $$$a_i, a_{i+1}$$$ and $$$b_i, b_{i+1}$$$ have the same pitch relationship if either - $$$a_i < a_{i + 1}$$$ and $$$b_i < b_{i + 1}$$$, - $$$a_i = a_{i + 1}$$$ and $$$b_i = b_{i + 1}$$$, or - $$$a_i > a_{i + 1}$$$ and $$$b_i > b_{i + 1}$$$. Having practiced consistently for a long time, Alice is able to sing any note in the range of $$$[1, k]$$$. She wants to know how many different songs of length $$$n$$$ within her range there are, if we treat musically equivalent songs as the same one. Can you help her calculate the number? Since the answer might be large, print the answer modulo $$$998244353$$$. Input format: The only line contains two integers $$$n, k$$$. - $$$1\leq n\leq 10^6$$$ - $$$1\leq k \leq 10^9$$$ Output format: Output the number of different songs modulo $$$998244353$$$. Example Input 0: 3 2 Example Output 0: 7 Example Input 1: 5 3 Example Output 1: 67
1
Codeforces_test
null
432
stdin
[ "6\n5 2\n3 5\n16 4\n100 3\n6492 10\n10 1\n" ]
[ "2\n3\n1\n4\n21\n10\n" ]
[ "6\n5 2\n3 5\n16 4\n100 3\n6492 10\n10 1\n" ]
[ "2\n3\n1\n4\n21\n10\n" ]
You are given two integers $$$n$$$ and $$$k$$$. In one operation, you can subtract any power of $$$k$$$ from $$$n$$$. Formally, in one operation, you can replace $$$n$$$ by $$$(n-k^x)$$$ for any non-negative integer $$$x$$$. Find the minimum number of operations required to make $$$n$$$ equal to $$$0$$$. Input format: Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). The description of the test cases follows. The only line of each test case contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le n, k \le 10^9$$$). Output format: For each test case, output the minimum number of operations on a new line. Example Input 0: 6 5 2 3 5 16 4 100 3 6492 10 10 1 Example Output 0: 2 3 1 4 21 10 Notes: In the first test case, $$$n = 5$$$ and $$$k = 2$$$. We can perform the following sequence of operations: 1. Subtract $$$2^0 = 1$$$ from $$$5$$$. The current value of $$$n$$$ becomes $$$5 - 1 = 4$$$. 2. Subtract $$$2^2 = 4$$$ from $$$4$$$. The current value of $$$n$$$ becomes $$$4 - 4 = 0$$$. It can be shown that there is no way to make $$$n$$$ equal to $$$0$$$ in less than $$$2$$$ operations. Thus, $$$2$$$ is the answer. In the second test case, $$$n = 3$$$ and $$$k = 5$$$. We can perform the following sequence of operations: 1. Subtract $$$5^0 = 1$$$ from $$$3$$$. The current value of $$$n$$$ becomes $$$3 - 1 = 2$$$. 2. Subtract $$$5^0 = 1$$$ from $$$2$$$. The current value of $$$n$$$ becomes $$$2 - 1 = 1$$$. 3. Subtract $$$5^0 = 1$$$ from $$$1$$$. The current value of $$$n$$$ becomes $$$1 - 1 = 0$$$. It can be shown that there is no way to make $$$n$$$ equal to $$$0$$$ in less than $$$3$$$ operations. Thus, $$$3$$$ is the answer.
1
Codeforces_test
null
433
stdin
[ "5\n?????\nxbx\nab??e\nabcde\nayy?x\na\nab??e\ndac\npaiu\nmom\n" ]
[ "YES\nxabax\nYES\nabcde\nYES\nayyyx\nNO\nNO\n" ]
[ "5\n?????\nxbx\nab??e\nabcde\nayy?x\na\nab??e\ndac\npaiu\nmom\n" ]
[ "YES\nxbxaa\nYES\nabcde\nYES\nayyax\nNO\nNO\n" ]
Slavic has a very tough exam and needs your help in order to pass it. Here is the question he is struggling with: There exists a string $$$s$$$, which consists of lowercase English letters and possibly zero or more "?". Slavic is asked to change each "?" to a lowercase English letter such that string $$$t$$$ becomes a subsequence (not necessarily continuous) of the string $$$s$$$. Output any such string, or say that it is impossible in case no string that respects the conditions exists. Input format: The first line contains a single integer $$$T$$$ ($$$1 \leq T \leq 10^4$$$) — the number of test cases. The first line of each test case contains a single string $$$s$$$ ($$$1 \leq |s| \leq 2 \cdot 10^5$$$, and $$$s$$$ consists only of lowercase English letters and "?"-s)  – the original string you have. The second line of each test case contains a single string $$$t$$$ ($$$1 \leq |t| \leq |s|$$$, and $$$t$$$ consists only of lowercase English letters)  – the string that should be a subsequence of string $$$s$$$. The sum of $$$|s|$$$ over all test cases doesn't exceed $$$2 \cdot 10^5$$$, where $$$|x|$$$ denotes the length of the string $$$x$$$. Output format: For each test case, if no such string exists as described in the statement, output "NO" (without quotes). Otherwise, output "YES" (without quotes). Then, output one line — the string that respects all conditions. You can output "YES" and "NO" in any case (for example, strings "yEs", "yes", and "Yes" will be recognized as a positive response). If multiple answers are possible, you can output any of them. Example Input 0: 5 ????? xbx ab??e abcde ayy?x a ab??e dac paiu mom Example Output 0: YES xabax YES abcde YES ayyyx NO NO
1
Codeforces_test
null
434
stdin
[ "4\n2 2\n7 2\n5 3\n1000000000 1000000000\n" ]
[ "1\n5\n1\n347369930\n" ]
[ "4\n2 2\n7 2\n5 3\n1000000000 1000000000\n" ]
[ "1\n5\n1\n347369930\n" ]
Klee has an array $$$a$$$ of length $$$n$$$ containing integers $$$[k, k+1, ..., k+n-1]$$$ in that order. Klee wants to choose an index $$$i$$$ ($$$1 \leq i \leq n$$$) such that $$$x = |a_1 + a_2 + \dots + a_i - a_{i+1} - \dots - a_n|$$$ is minimized. Note that for an arbitrary integer $$$z$$$, $$$|z|$$$ represents the absolute value of $$$z$$$. Output the minimum possible value of $$$x$$$. Input format: The first line contains $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Each test case contains two integers $$$n$$$ and $$$k$$$ ($$$2 \leq n, k \leq 10^9$$$) — the length of the array and the starting element of the array. Output format: For each test case, output the minimum value of $$$x$$$ on a new line. Example Input 0: 4 2 2 7 2 5 3 1000000000 1000000000 Example Output 0: 1 5 1 347369930 Notes: In the first sample, $$$a = [2, 3]$$$. When $$$i = 1$$$ is chosen, $$$x = |2-3| = 1$$$. It can be shown this is the minimum possible value of $$$x$$$. In the third sample, $$$a = [3, 4, 5, 6, 7]$$$. When $$$i = 3$$$ is chosen, $$$x = |3 + 4 + 5 - 6 - 7| = 1$$$. It can be shown this is the minimum possible value of $$$x$$$.
1
Codeforces_test
null
435
stdin
[ "3\n5\n1 2 5 905 2000000\n15\n- 2\n? 2\n? 1\n- 1\n? 1\n+ 4\n+ 2\n? 2\n+ 6\n- 4\n+ 7\n? 2\n? 3\n? 4\n? 2000000\n5\n3 4 5 6 8\n9\n? 5\n- 5\n? 5\n+ 1\n? 2\n- 6\n- 8\n+ 6\n? 5\n5\n6 7 8 9 10\n10\n? 5\n- 6\n? 4\n- 10\n+ 5\n- 8\n+ 3\n+ 2\n- 3\n+ 10\n" ]
[ "2 2 1 6 3 8 8 2000001 \n9 9 9 7 \n1 1\n" ]
[ "3\n5\n1 2 5 905 2000000\n15\n- 2\n? 2\n? 1\n- 1\n? 1\n+ 4\n+ 2\n? 2\n+ 6\n- 4\n+ 7\n? 2\n? 3\n? 4\n? 2000000\n5\n3 4 5 6 8\n9\n? 5\n- 5\n? 5\n+ 1\n? 2\n- 6\n- 8\n+ 6\n? 5\n5\n6 7 8 9 10\n10\n? 5\n- 6\n? 4\n- 10\n+ 5\n- 8\n+ 3\n+ 2\n- 3\n+ 10\n" ]
[ "2 2 1 6 3 8 8 2000001 \n9 9 9 7 \n1 1 \n" ]
Ksyusha decided to start a game development company. To stand out among competitors and achieve success, she decided to write her own game engine. The engine must support a set initially consisting of $$$n$$$ distinct integers $$$a_1, a_2, \ldots, a_n$$$. The set will undergo $$$m$$$ operations sequentially. The operations can be of the following types: - Insert element $$$x$$$ into the set; - Remove element $$$x$$$ from the set; - Report the $$$k$$$-load of the set. The $$$k$$$-load of the set is defined as the minimum positive integer $$$d$$$ such that the integers $$$d, d + 1, \ldots, d + (k - 1)$$$ do not appear in this set. For example, the $$$3$$$-load of the set $$$\{3, 4, 6, 11\}$$$ is $$$7$$$, since the integers $$$7, 8, 9$$$ are absent from the set, and no smaller value fits. Ksyusha is busy with management tasks, so you will have to write the engine. Implement efficient support for the described operations. Input format: The first line contains an integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. The following lines describe the test cases. The first line contains an integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the initial size of the set. The second line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \le a_1 < a_2 < \ldots < a_n \le 2 \cdot 10^6$$$) — the initial state of the set. The third line contains an integer $$$m$$$ ($$$1 \le m \le 2 \cdot 10^5$$$) — the number of operations. The next $$$m$$$ lines contain the operations. The operations are given in the following format: - + $$$x$$$ ($$$1 \le x \le 2 \cdot 10^6$$$) — insert element $$$x$$$ into the set (it is guaranteed that $$$x$$$ is not in the set); - - $$$x$$$ ($$$1 \le x \le 2 \cdot 10^6$$$) — remove element $$$x$$$ from the set (it is guaranteed that $$$x$$$ is in the set); - ? $$$k$$$ ($$$1 \le k \le 2 \cdot 10^6$$$) — output the value of the $$$k$$$-load of the set. It is guaranteed that the sum of $$$n$$$ across all test cases does not exceed $$$2 \cdot 10^5$$$, and the same holds for $$$m$$$. Output format: For each test case, output the answers to the operations of type "?". Example Input 0: 3 5 1 2 5 905 2000000 15 - 2 ? 2 ? 1 - 1 ? 1 + 4 + 2 ? 2 + 6 - 4 + 7 ? 2 ? 3 ? 4 ? 2000000 5 3 4 5 6 8 9 ? 5 - 5 ? 5 + 1 ? 2 - 6 - 8 + 6 ? 5 5 6 7 8 9 10 10 ? 5 - 6 ? 4 - 10 + 5 - 8 + 3 + 2 - 3 + 10 Example Output 0: 2 2 1 6 3 8 8 2000001 9 9 9 7 1 1
1
Codeforces_test
null
436
stdin
[ "3\n4\n\n1\n\n5\n\n1\n\n0\n\n9\n" ]
[ "? 2 3\n\n! 0 0 1\n\n? 2 3\n\n? 2 4\n\n! 0 0 1 2\n\n! 0 0 0 1 3 5 6 7\n" ]
[ "3\n4\n0 0 1\n5\n0 0 1 2\n9\n0 0 0 1 3 5 6 7\n" ]
[ "0 0 1\n0 0 1 2\n0 0 0 1 3 5 6 7\n" ]
This is an interactive problem. Upon clearing the Waterside Area, Gretel has found a monster named Genokraken, and she's keeping it contained for her scientific studies. The monster's nerve system can be structured as a tree$$$^{\dagger}$$$ of $$$n$$$ nodes (really, everything should stop resembling trees all the time$$$\ldots$$$), numbered from $$$0$$$ to $$$n-1$$$, with node $$$0$$$ as the root. Gretel's objective is to learn the exact structure of the monster's nerve system — more specifically, she wants to know the values $$$p_1, p_2, \ldots, p_{n-1}$$$ of the tree, where $$$p_i$$$ ($$$0 \le p_i < i$$$) is the direct parent node of node $$$i$$$ ($$$1 \le i \le n - 1$$$). She doesn't know exactly how the nodes are placed, but she knows a few convenient facts: - If we remove root node $$$0$$$ and all adjacent edges, this tree will turn into a forest consisting of only paths$$$^{\ddagger}$$$. Each node that was initially adjacent to the node $$$0$$$ will be the end of some path. - The nodes are indexed in a way that if $$$1 \le x \le y \le n - 1$$$, then $$$p_x \le p_y$$$. - Node $$$1$$$ has exactly two adjacent nodes (including the node $$$0$$$). The tree in this picture does not satisfy the condition, because if we remove node $$$0$$$, then node $$$2$$$ (which was initially adjacent to the node $$$0$$$) will not be the end of the path $$$4-2-5$$$.The tree in this picture does not satisfy the condition, because $$$p_3 \le p_4$$$ must hold.The tree in this picture does not satisfy the condition, because node $$$1$$$ has only one adjacent node. Gretel can make queries to the containment cell: - "? a b" ($$$1 \le a, b < n$$$, $$$a \ne b$$$) — the cell will check if the simple path between nodes $$$a$$$ and $$$b$$$ contains the node $$$0$$$. However, to avoid unexpected consequences by overstimulating the creature, Gretel wants to query at most $$$2n - 6$$$ times. Though Gretel is gifted, she can't do everything all at once, so can you give her a helping hand? $$$^{\dagger}$$$A tree is a connected graph where every pair of distinct nodes has exactly one simple path connecting them. $$$^{\ddagger}$$$A path is a tree whose vertices can be listed in the order $$$v_1, v_2, \ldots, v_k$$$ such that the edges are $$$(v_i, v_{i+1})$$$ ($$$1 \le i < k$$$). Input format: Each test consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \le t \le 500$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$4 \le n \le 10^4$$$) — the number of nodes in Genokraken's nerve system. It is guaranteed that the sum of $$$n$$$ over all test cases does not exceed $$$10^4$$$. Example Input 0: 3 4 1 5 1 0 9 Example Output 0: ? 2 3 ! 0 0 1 ? 2 3 ? 2 4 ! 0 0 1 2 ! 0 0 0 1 3 5 6 7 Notes: In the first test case, Genokraken's nerve system forms the following tree: - The answer to "? 2 3" is $$$1$$$. This means that the simple path between nodes $$$2$$$ and $$$3$$$ contains node $$$0$$$. In the second test case, Genokraken's nerve system forms the following tree: - The answer to "? 2 3" is $$$1$$$. This means that the simple path between nodes $$$2$$$ and $$$3$$$ contains node $$$0$$$. - The answer to "? 2 4" is $$$0$$$. This means that the simple path between nodes $$$2$$$ and $$$4$$$ doesn't contain node $$$0$$$. In the third test case, Genokraken's nerve system forms the following tree:
1
Codeforces_test
null
437
stdin
[ "3\n2 1 2\n1 2 1\n", "4\n5 5 5 5\n0 0 0 0\n", "5\n1 9 3 7 5\n2 4 6 8 5\n" ]
[ "2 332748119 1\n", "5 5 5 5\n", "6 4 3 199648873 2\n" ]
[ "3\n2 1 2\n1 2 1\n", "4\n5 5 5 5\n0 0 0 0\n", "5\n1 9 3 7 5\n2 4 6 8 5\n", "1\n0\n0\n", "1\n0\n1000000\n", "1\n1000000\n0\n", "1\n1000000\n1000000\n", "20\n443309 129766 7146 25306 61735 943035 371598 498745 993335 611156 910260 422340 664742 667842 954783 553879 829847 999710 772830 428350\n148617 668583 427042 1589 418767 392702 57869 161281 756955 973750 756208 426868 150477 312764 495355 115731 643595 796159 753920 348606\n", "20\n321380 159267 39407 456869 270423 286924 865039 427905 966965 817491 928742 770903 951860 932419 307057 818599 704973 840018 398306 570917\n926258 470757 193179 794815 12790 412140 177164 152827 820813 640167 757902 582247 11616 666146 774816 646333 195552 120057 332218 20711\n", "20\n199451 188768 72354 888431 478427 556131 320795 319381 903597 23824 946540 119464 275977 271678 771014 121002 506100 716639 23782 787482\n741581 235248 921633 662722 606814 430893 333457 145058 772989 307268 797281 699943 873441 982530 980278 139250 785193 444640 910516 693501\n", "20\n40524 180586 67617 394676 724114 862337 851236 210857 840228 230158 965023 393344 525411 536255 123288 422721 344912 556261 612260 892365\n519221 74422 687771 455946 237836 450331 489750 99605 799849 974370 798975 855322 772264 335911 297422 632168 337150 768539 488814 403290\n", "20\n881597 210087 174561 826238 969802 169227 269993 139332 813859 436493 20503 741907 812529 912515 549561 687441 146039 470566 200737 71930\n333859 839599 453908 286169 831860 469770 609044 54152 826708 678471 838353 973017 596404 652294 576883 162769 926107 55438 104110 1397\n", "20\n722669 202589 169824 294799 214804 475432 762749 993810 712806 642827 38986 53469 136645 177091 939520 952161 984851 310189 826214 176812\n149183 641773 183046 79393 463567 526207 765337 46383 815883 382571 840047 91397 495228 5676 819345 655687 478064 416336 645410 711186\n", "20\n600740 232091 202770 726362 423492 818637 256190 922285 649438 849161 20469 439031 423764 516351 328793 216880 859977 224494 414691 319379\n926824 406264 948500 909618 131588 507961 884631 930 842743 49672 841741 246091 394051 322059 136489 149290 30020 740235 223707 383976\n", "20\n404813 261592 198033 232606 669180 125527 674948 813761 586069 55494 75951 750595 710882 780928 755751 519284 698788 64116 77166 498945\n704463 245438 714637 740526 725612 564398 77922 955478 794919 753773 844120 401471 218191 675441 341951 679207 618977 27134 801321 56081\n", "20\n282884 291094 230295 664169 877183 431733 205387 668238 559700 261829 94433 61472 998000 120188 145024 747005 499916 941423 665644 603828\n556786 47613 480774 570749 319635 583837 234216 947709 858778 457874 845815 519851 117014 954826 621412 172809 133935 351033 379618 728871\n", "20\n910419 190865 103374 839463 57835 825789 959256 909104 262613 930809 212704 670190 732007 451822 217994 188049 906417 35625 53724 257830\n972153 81808 175105 393382 850528 952073 119317 12078 826410 719440 569472 937256 78434 858791 378062 250890 598207 840371 794353 824031\n" ]
[ "2 332748119 1 \n", "5 5 5 5 \n", "6 4 3 199648873 2 \n", "0 \n", "1000000 \n", "1000000 \n", "1000000 \n", "150385282 646686036 580024390 459931971 720047846 40653046 997940504 821058607 405459823 463788016 324476726 740478844 379558797 206919447 271286963 701987283 528912628 709293146 449220549 7146 \n", "749375091 630961454 438198891 470472600 176732726 185957427 724393763 980321951 857074660 976945820 922112322 622733091 550740500 178641700 473314952 869333050 645415444 462396731 45400 39407 \n", "949013903 967212384 20526889 680651234 53135948 890291842 452492707 53309450 380369635 896755489 210310968 34186935 910214793 571950882 167421583 71844041 721679632 767212282 199788411 139250 \n", "399946901 714985804 50265789 152555399 769476855 791530286 926329724 930635100 202505421 245564825 580419256 448910961 574071719 806471808 324984406 849159997 105159587 641055878 449285640 74422 \n", "50570445 667686507 374214170 56685140 8422140 915847970 215765296 709502943 852141422 371096482 907941005 292222230 547107480 645380342 733725400 303117757 344165471 730323748 399322498 20503 \n", "350009721 37191804 22186960 897922239 818783644 211873057 820751233 315673802 816244919 619438306 689608643 702696536 983276729 436464897 983743616 538418971 627887178 246975876 40080 38986 \n", "100479315 872574907 19577361 579214583 397158237 140862651 502629253 733865416 624834124 895730465 177643002 520669180 654320645 366773509 13526975 772076675 616509361 352052264 798625544 20469 \n", "849181450 173870495 22254735 520102984 26546053 367814002 598260103 252707582 468155469 893042486 865904950 588367894 966658958 532022461 36438921 399150528 722471181 105134942 349441478 55494 \n", "449883718 893614109 279667711 894873478 116629465 960494679 45993029 47002159 521790045 222551823 344949030 923904394 931108017 340075049 900976948 2758116 311807384 662063997 449275856 61472 \n", "400032612 672995134 17853059 143440957 320830687 667422109 14042787 670235654 251861650 732315451 262219951 372648782 388024946 71703862 947623492 449000187 489534657 73596507 199687541 35625 \n" ]
Suppose you are working in the Ministry of Digital Development of Berland, and your task is to monitor the industry of video blogging. There are $$$n$$$ bloggers in Berland. Recently, due to the poor state of the main video platform in Berland, two alternative platforms were introduced. That's why bloggers started to reupload their videos to these alternative platforms. You've got the statistics that the $$$i$$$-th blogger uploaded $$$v_i$$$ videos to the first alternative platform and $$$r_i$$$ videos to the second alternative platform. You think that a potential user will be upset if even at least one of his favorite bloggers doesn't upload anything. However, if a blogger uploads videos to both platforms, the user will watch that blogger on the platform where more videos are available. So, you've come up with the following function to estimate user experience. Suppose a user watches $$$k$$$ bloggers $$$b_1, b_2, \dots, b_k$$$; then, let user experience be $$$$$$E(b_1, \dots, b_k) = \max\left(\min_{i=1..k}{v[b_i]}, \min_{i=1..k}{r[b_i]}\right).$$$$$$ In order to get some statistics, you want to calculate the value $$$\mathit{avg}_k$$$ that is equal to an average experience among all subsets of bloggers of size $$$k$$$. Also, you have to calculate $$$\mathit{avg}_k$$$ for each $$$k$$$ from $$$1$$$ to $$$n$$$. Since answers may be too large, print them modulo $$$998\,244\,353$$$. Input format: The first line contains a single integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the number of bloggers. The second line contains $$$n$$$ integers $$$v_1, v_2, \dots, v_n$$$ ($$$0 \le v_i \le 10^6$$$), where $$$v_i$$$ is the number of videos of the $$$i$$$-th blogger on the first alternative platform. The third line contains $$$n$$$ integers $$$r_1, r_2, \dots, r_n$$$ ($$$0 \le r_i \le 10^6$$$), where $$$r_i$$$ is the number of videos of the $$$i$$$-th blogger on the second alternative platform. Output format: Print $$$n$$$ integers $$$\mathit{avg}_1, \mathit{avg}_2, \dots, \mathit{avg}_n$$$. It can be proven that $$$\mathit{avg}_k$$$ may be represented as an irreducible fraction $$$\dfrac{x}{y}$$$ where $$$y \not\equiv 0 \pmod{998\,244\,353}$$$. So, print $$$\mathit{avg}_k$$$ in a form $$$x \cdot y^{-1} \bmod 998\,244\,353$$$. Example Input 0: 3 2 1 2 1 2 1 Example Output 0: 2 332748119 1 Example Input 1: 4 5 5 5 5 0 0 0 0 Example Output 1: 5 5 5 5 Example Input 2: 5 1 9 3 7 5 2 4 6 8 5 Example Output 2: 6 4 3 199648873 2 Notes: In the first example, $$$332748119$$$ is $$$\frac{4}{3}$$$. In the third example, $$$199648873$$$ is $$$\frac{12}{5}$$$.
1
Codeforces_test
null
438
stdin
[ "4\n???\nY??D?X\n???\nD??DXYXYX\n" ]
[ "YES\nYDX\nX 0 D 0 Y 0 \nYES\nYDXDYX\nX 0 Y 0 D 1\nX 2 D 3 Y 4\nYES\nYDX\nY 0 D 1 X 2\nNO\n" ]
[ "4\n???\nY??D?X\n???\nD??DXYXYX\n", "27\nYYY\nDYY\nXYY\nYDY\nDDY\nXDY\nYXY\nDXY\nXXY\nYYD\nDYD\nXYD\nYDD\nDDD\nXDD\nYXD\nDXD\nXXD\nYYX\nDYX\nXYX\nYDX\nDDX\nXDX\nYXX\nDXX\nXXX\n", "64\nYYY\nDYY\nXYY\n?YY\nYDY\nDDY\nXDY\n?DY\nYXY\nDXY\nXXY\n?XY\nY?Y\nD?Y\nX?Y\n??Y\nYYD\nDYD\nXYD\n?YD\nYDD\nDDD\nXDD\n?DD\nYXD\nDXD\nXXD\n?XD\nY?D\nD?D\nX?D\n??D\nYYX\nDYX\nXYX\n?YX\nYDX\nDDX\nXDX\n?DX\nYXX\nDXX\nXXX\n?XX\nY?X\nD?X\nX?X\n??X\nYY?\nDY?\nXY?\n?Y?\nYD?\nDD?\nXD?\n?D?\nYX?\nDX?\nXX?\n?X?\nY??\nD??\nX??\n???\n" ]
[ "YES\nYDX\nX 0 D 0 Y 0 \nYES\nYDXDYX\nX 0 Y 0 D 0 \nX 0 D 0 Y 0 \nYES\nYDX\nX 0 D 0 Y 0 \nNO\n", "NO\nNO\nNO\nNO\nNO\nYES\nXDY\nY 0 D 0 X 0 \nNO\nYES\nDXY\nY 0 X 0 D 0 \nNO\nNO\nNO\nYES\nXYD\nD 0 Y 0 X 0 \nNO\nNO\nNO\nYES\nYXD\nD 0 X 0 Y 0 \nNO\nNO\nNO\nYES\nDYX\nX 0 Y 0 D 0 \nNO\nYES\nYDX\nX 0 D 0 Y 0 \nNO\nNO\nNO\nNO\nNO\n", "NO\nNO\nNO\nNO\nNO\nNO\nYES\nXDY\nX 0 D 1 Y 2\nYES\nXDY\nX 0 D 1 Y 2\nNO\nYES\nDXY\nD 0 X 1 Y 2\nNO\nYES\nDXY\nD 0 X 1 Y 2\nNO\nYES\nDXY\nD 0 X 1 Y 2\nYES\nXDY\nX 0 D 1 Y 2\nYES\nDXY\nD 0 X 1 Y 2\nNO\nNO\nYES\nXYD\nX 0 Y 1 D 2\nYES\nXYD\nX 0 Y 1 D 2\nNO\nNO\nNO\nNO\nYES\nYXD\nY 0 X 1 D 2\nNO\nNO\nYES\nYXD\nY 0 X 1 D 2\nYES\nYXD\nY 0 X 1 D 2\nNO\nYES\nXYD\nX 0 Y 1 D 2\nYES\nYXD\nY 0 X 1 D 2\nNO\nYES\nDYX\nD 0 Y 1 X 2\nNO\nYES\nDYX\nD 0 Y 1 X 2\nYES\nYDX\nY 0 D 1 X 2\nNO\nNO\nYES\nYDX\nY 0 D 1 X 2\nNO\nNO\nNO\nNO\nYES\nYDX\nY 0 D 1 X 2\nYES\nDYX\nD 0 Y 1 X 2\nNO\nYES\nYDX\nY 0 D 1 X 2\nNO\nYES\nDYX\nD 0 Y 1 X 2\nYES\nXYD\nX 0 Y 1 D 2\nYES\nXYD\nX 0 Y 1 D 2\nYES\nYDX\nY 0 D 1 X 2\nNO\nYES\nXDY\nX 0 D 1 Y 2\nYES\nXDY\nX 0 D 1 Y 2\nYES\nYXD\nY 0 X 1 D 2\nYES\nDXY\nD 0 X 1 Y 2\nNO\nYES\nDXY\nD 0 X 1 Y 2\nYES\nYDX\nY 0 D 1 X 2\nYES\nDYX\nD 0 Y 1 X 2\nYES\nXYD\nX 0 Y 1 D 2\nYES\nYDX\nY 0 D 1 X 2\n" ]
This is the hard version of the problem. The difference between the versions is that in this version, there is no restriction on the number of question marks. You can hack only if you solved all versions of this problem. For a long time, no one could decipher Sumerian cuneiform. However, it has finally succumbed to pressure! Today, you have the chance to decipher Yandex cuneiform. Yandex cuneiform is defined by the following rules: 1. An empty string is a Yandex cuneiform. 2. If you insert exactly one copy of each of the three letters 'Y', 'D', and 'X' into a Yandex cuneiform in such a way that no two adjacent letters become equal after the operation, you obtain a Yandex cuneiform. 3. If a string can't be obtained using the above rules, it is not a Yandex cuneiform. You are given a template. A template is a string consisting of the characters 'Y', 'D', 'X', and '?'. You need to check whether there exists a way to replace each question mark with 'Y', 'D', or 'X' to obtain a Yandex cuneiform, and if it exists, output any of the matching options, as well as a sequence of insertion operations to obtain the resulting cuneiform. In this version of the problem, the number of question marks in the template can be arbitrary. Input format: Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 5 \cdot 10^4$$$). The description of the test cases follows. Each test case consists of a single line containing a template of length $$$n$$$ ($$$3 \leq n < 2 \cdot 10^5$$$, $$$n \bmod 3 = 0$$$), consisting only of characters 'Y', 'D', 'X', and '?'. It is guaranteed that the sum of $$$n$$$ over all test cases does not exceed $$$2 \cdot 10^5$$$. Output format: For each test case, output a single line containing 'NO' if it is not possible to obtain a cuneiform from the given template. Otherwise, output 'YES' on the first line, and on the second line, any obtainable cuneiform. After that, you need to output the sequence of operations that leads to the cuneiform you printed. A sequence of operations is described by $$$\frac{n}{3}$$$ triples of pairs. A pair has the form c p, where $$$c$$$ is one of the letters 'Y', 'D', or 'X', and $$$p$$$ is the position at which the letter $$$c$$$ should be inserted. The insertion position is the number of letters to skip from the beginning of the string for the insertion. For example, after inserting the character 'D' into the string "YDX" with $$$p=3$$$, the result is "YDXD", and with $$$p=0$$$, it is "DYDX". Note that the index cannot exceed the current length of the string. The operations are applied from top to bottom, left to right. After inserting each triple to the string, there should be no two adjacent identical characters. Example Input 0: 4 ??? Y??D?X ??? D??DXYXYX Example Output 0: YES YDX X 0 D 0 Y 0 YES YDXDYX X 0 Y 0 D 1 X 2 D 3 Y 4 YES YDX Y 0 D 1 X 2 NO Notes: In the second example, the string is transformed like this: $$$"" \to \mathtt{YDX} \to \mathtt{YDXDYX}$$$.
1
Codeforces_test
null
439
stdin
[ "3\n5\n3 5 2 1 3\n2\nabfda\nafbfa\n2\n1 2\n3\nab\nabc\naa\n4\n5 -3 5 -3\n4\naaaa\nbcbc\naba\ncbcb\n" ]
[ "YES\nNO\nYES\nNO\nNO\nNO\nYES\nNO\nYES\n" ]
[ "3\n5\n3 5 2 1 3\n2\nabfda\nafbfa\n2\n1 2\n3\nab\nabc\naa\n4\n5 -3 5 -3\n4\naaaa\nbcbc\naba\ncbcb\n" ]
[ "YES\nNO\nYES\nNO\nNO\nNO\nYES\nNO\nYES\n" ]
Kristina has an array $$$a$$$, called a template, consisting of $$$n$$$ integers. She also has $$$m$$$ strings, each consisting only of lowercase Latin letters. The strings are numbered from $$$1$$$ to $$$m$$$. She wants to check which strings match the template. A string $$$s$$$ is considered to match the template if all of the following conditions are simultaneously satisfied: - The length of the string $$$s$$$ is equal to the number of elements in the array $$$a$$$. - The same numbers from $$$a$$$ correspond to the same symbols from $$$s$$$. So, if $$$a_i = a_j$$$, then $$$s_i = s_j$$$ for ($$$1 \le i, j \le n$$$). - The same symbols from $$$s$$$ correspond to the same numbers from $$$a$$$. So, if $$$s_i = s_j$$$, then $$$a_i = a_j$$$ for ($$$1 \le i, j \le n$$$). For example, if $$$a$$$ = [$$$3, 5, 2, 1, 3$$$], then the string "abfda" matches the template, while the string "afbfa" does not, since the character "f" corresponds to both numbers $$$1$$$ and $$$5$$$. Input format: The first line of input contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. The following descriptions are for the test cases. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the number of elements in the array $$$a$$$. The second line of each test case contains exactly $$$n$$$ integers $$$a_i$$$ ($$$-10^9 \le a_i \le 10^9$$$) — the elements of the array $$$a$$$. The third line of each test case contains a single integer $$$m$$$ ($$$1 \le m \le 2 \cdot 10^5$$$) — the number of strings to check for template matching. Following are $$$m$$$ strings, each containing a non-empty string $$$s_j$$$ ($$$1 \le |s_j| \le 2 \cdot 10^5$$$), consisting of lowercase Latin letters. It is guaranteed that the sum of $$$n$$$ across all test cases does not exceed $$$2 \cdot 10^5$$$, and that the sum of the lengths of all strings does not exceed $$$2 \cdot 10^5$$$. Output format: For each test case, output $$$m$$$ lines. On the $$$i$$$-th line ($$$1 \le i \le m$$$) output: - "YES", if the string with index $$$i$$$ matches the template; - "NO" otherwise. You may output the answer in any case (for example, the strings "yEs", "yes", "Yes", and "YES" will be recognized as a positive answer). Example Input 0: 3 5 3 5 2 1 3 2 abfda afbfa 2 1 2 3 ab abc aa 4 5 -3 5 -3 4 aaaa bcbc aba cbcb Example Output 0: YES NO YES NO NO NO YES NO YES Notes: The first test case is explained in the problem statement.
1
Codeforces_test
null
440
stdin
[ "4\n1\n6\n3\n98\n" ]
[ "Kosuke\nSakurako\nKosuke\nSakurako\n" ]
[ "4\n1\n6\n3\n98\n", "100\n100\n99\n98\n97\n96\n95\n94\n93\n92\n91\n90\n89\n88\n87\n86\n85\n84\n83\n82\n81\n80\n79\n78\n77\n76\n75\n74\n73\n72\n71\n70\n69\n68\n67\n66\n65\n64\n63\n62\n61\n60\n59\n58\n57\n56\n55\n54\n53\n52\n51\n50\n49\n48\n47\n46\n45\n44\n43\n42\n41\n40\n39\n38\n37\n36\n35\n34\n33\n32\n31\n30\n29\n28\n27\n26\n25\n24\n23\n22\n21\n20\n19\n18\n17\n16\n15\n14\n13\n12\n11\n10\n9\n8\n7\n6\n5\n4\n3\n2\n1\n" ]
[ "Kosuke\nSakurako\nKosuke\nSakurako\n", "Sakurako\nKosuke\nSakurako\nKosuke\nSakurako\nKosuke\nSakurako\nKosuke\nSakurako\nKosuke\nSakurako\nKosuke\nSakurako\nKosuke\nSakurako\nKosuke\nSakurako\nKosuke\nSakurako\nKosuke\nSakurako\nKosuke\nSakurako\nKosuke\nSakurako\nKosuke\nSakurako\nKosuke\nSakurako\nKosuke\nSakurako\nKosuke\nSakurako\nKosuke\nSakurako\nKosuke\nSakurako\nKosuke\nSakurako\nKosuke\nSakurako\nKosuke\nSakurako\nKosuke\nSakurako\nKosuke\nSakurako\nKosuke\nSakurako\nKosuke\nSakurako\nKosuke\nSakurako\nKosuke\nSakurako\nKosuke\nSakurako\nKosuke\nSakurako\nKosuke\nSakurako\nKosuke\nSakurako\nKosuke\nSakurako\nKosuke\nSakurako\nKosuke\nSakurako\nKosuke\nSakurako\nKosuke\nSakurako\nKosuke\nSakurako\nKosuke\nSakurako\nKosuke\nSakurako\nKosuke\nSakurako\nKosuke\nSakurako\nKosuke\nSakurako\nKosuke\nSakurako\nKosuke\nSakurako\nKosuke\nSakurako\nKosuke\nSakurako\nKosuke\nSakurako\nKosuke\nSakurako\nKosuke\nSakurako\nKosuke\n" ]
Sakurako and Kosuke decided to play some games with a dot on a coordinate line. The dot is currently located in position $$$x=0$$$. They will be taking turns, and Sakurako will be the one to start. On the $$$i$$$-th move, the current player will move the dot in some direction by $$$2\cdot i-1$$$ units. Sakurako will always be moving the dot in the negative direction, whereas Kosuke will always move it in the positive direction. In other words, the following will happen: 1. Sakurako will change the position of the dot by $$$-1$$$, $$$x = -1$$$ now 2. Kosuke will change the position of the dot by $$$3$$$, $$$x = 2$$$ now 3. Sakurako will change the position of the dot by $$$-5$$$, $$$x = -3$$$ now 4. $$$\cdots$$$ They will keep on playing while the absolute value of the coordinate of the dot does not exceed $$$n$$$. More formally, the game continues while $$$-n\le x\le n$$$. It can be proven that the game will always end. Your task is to determine who will be the one who makes the last turn. Input format: The first line contains one integer $$$t$$$ ($$$1\le t\le 100$$$) — the number of games that Sakurako and Kosuke played. Each game is described by one number $$$n$$$ ($$$1 \le n\le 100$$$) — the number that defines the condition when the game ends. Output format: For each of the $$$t$$$ games, output a line with the result of that game. If Sakurako makes the last turn, output "Sakurako" (without quotes); else output "Kosuke". Example Input 0: 4 1 6 3 98 Example Output 0: Kosuke Sakurako Kosuke Sakurako
1
Codeforces_test
null
441
stdin
[ "3\n1\n0\n5\n00101\n00101\n11001\n00001\n11110\n6\n000000\n000000\n000000\n000000\n000000\n000000\n" ]
[ "1 \n4 2 1 3 5 \n6 5 4 3 2 1\n" ]
[ "3\n1\n0\n5\n00101\n00101\n11001\n00001\n11110\n6\n000000\n000000\n000000\n000000\n000000\n000000\n" ]
[ "1 \n4 2 1 3 5 \n6 5 4 3 2 1 \n" ]
You are given an undirected graph with $$$n$$$ vertices, labeled from $$$1$$$ to $$$n$$$. This graph encodes a hidden permutation$$$^{\text{∗}}$$$ $$$p$$$ of size $$$n$$$. The graph is constructed as follows: - For every pair of integers $$$1 \le i < j \le n$$$, an undirected edge is added between vertex $$$p_i$$$ and vertex $$$p_j$$$ if and only if $$$p_i < p_j$$$. Note that the edge is not added between vertices $$$i$$$ and $$$j$$$, but between the vertices of their respective elements. Refer to the notes section for better understanding. Your task is to reconstruct and output the permutation $$$p$$$. It can be proven that permutation $$$p$$$ can be uniquely determined. Input format: Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 500$$$). The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 1000$$$). The $$$i$$$-th of the next $$$n$$$ lines contains a string of $$$n$$$ characters $$$g_{i, 1}g_{i, 2}\ldots g_{i, n}$$$ ($$$g_{i, j} = \mathtt{0}$$$ or $$$g_{i, j} = \mathtt{1}$$$) — the adjacency matrix. $$$g_{i, j} = \mathtt{1}$$$ if and only if there is an edge between vertex $$$i$$$ and vertex $$$j$$$. It is guaranteed that there exists a permutation $$$p$$$ which generates the given graph. It is also guaranteed that the graph is undirected and has no self-loops, meaning $$$g_{i, j} = g_{j, i}$$$ and $$$g_{i, i} = \mathtt{0}$$$. It is guaranteed that the sum of $$$n$$$ over all test cases does not exceed $$$1000$$$. Output format: For each test case, output $$$n$$$ integers $$$p_1, p_2, \ldots, p_n$$$ representing the reconstructed permutation. Example Input 0: 3 1 0 5 00101 00101 11001 00001 11110 6 000000 000000 000000 000000 000000 000000 Example Output 0: 1 4 2 1 3 5 6 5 4 3 2 1 Notes: In the first case $$$p = [1]$$$. Since there are no pairs $$$1 \le i < j \le n$$$, there are no edges in the graph. The graph in the second case is shown below. For example, when we choose $$$i = 3$$$ and $$$j = 4$$$, we add an edge between vertices $$$p_i = 1$$$ and $$$p_j = 3$$$, because $$$p_i < p_j$$$. However, when we choose $$$i = 2$$$ and $$$j = 3$$$, $$$p_i = 2$$$ and $$$p_j = 1$$$, so $$$p_i < p_j$$$ doesn't hold. Therefore, we don't add an edge between $$$2$$$ and $$$1$$$. In the third case, there are no edges in the graph, so there are no pairs of integers $$$1 \le i < j \le n$$$ such that $$$p_i < p_j$$$. Therefore, $$$p = [6, 5, 4, 3, 2, 1]$$$.
1
Codeforces_test
null
442
stdin
[ "6\n1 1 3 5\n1 3 2 1\n8 10 28 100\n100 1 100 1\n1 100 1 100\n100 100 100 100\n" ]
[ "3\n2\n2\n1\n1\n2\n" ]
[ "6\n1 1 3 5\n1 3 2 1\n8 10 28 100\n100 1 100 1\n1 100 1 100\n100 100 100 100\n", "1\n7 8 22 38\n" ]
[ "3\n2\n2\n1\n1\n2\n", "1\n" ]
There is an array of $$$5$$$ integers. Initially, you only know $$$a_1,a_2,a_4,a_5$$$. You may set $$$a_3$$$ to any positive integer, negative integer, or zero. The Fibonacciness of the array is the number of integers $$$i$$$ ($$$1 \leq i \leq 3$$$) such that $$$a_{i+2}=a_i+a_{i+1}$$$. Find the maximum Fibonacciness over all integer values of $$$a_3$$$. Input format: The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 500$$$) — the number of test cases. The only line of each test case contains four integers $$$a_1, a_2, a_4, a_5$$$ ($$$1 \leq a_i \leq 100$$$). Output format: For each test case, output the maximum Fibonacciness on a new line. Example Input 0: 6 1 1 3 5 1 3 2 1 8 10 28 100 100 1 100 1 1 100 1 100 100 100 100 100 Example Output 0: 3 2 2 1 1 2 Notes: In the first test case, we can set $$$a_3$$$ to $$$2$$$ to achieve the maximal Fibonacciness of $$$3$$$. In the third test case, it can be shown that $$$2$$$ is the maximum Fibonacciness that can be achieved. This can be done by setting $$$a_3$$$ to $$$18$$$.
1
Codeforces_test
null
443
stdin
[ "6\n1\nABCD\n2\nAAAAAAAA\n2\nAAAABBBB\n2\n????????\n3\nABCABCABCABC\n5\nACADC??ACAC?DCAABC?C\n" ]
[ "4\n2\n4\n0\n9\n13\n" ]
[ "6\n1\nABCD\n2\nAAAAAAAA\n2\nAAAABBBB\n2\n????????\n3\nABCABCABCABC\n5\nACADC??ACAC?DCAABC?C\n", "1\n5\nA?B?C?D??D?C?B?A????\n" ]
[ "4\n2\n4\n0\n9\n13\n", "8\n" ]
Tim is doing a test consisting of $$$4n$$$ questions; each question has $$$4$$$ options: 'A', 'B', 'C', and 'D'. For each option, there are exactly $$$n$$$ correct answers corresponding to that option — meaning there are $$$n$$$ questions with the answer 'A', $$$n$$$ questions with the answer 'B', $$$n$$$ questions with the answer 'C', and $$$n$$$ questions with the answer 'D'. For each question, Tim wrote his answer on the answer sheet. If he could not figure out the answer, he would leave a question mark '?' for that question. You are given his answer sheet of $$$4n$$$ characters. What is the maximum number of correct answers Tim can get? Input format: The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. The first line of each test case contains an integer $$$n$$$ ($$$1 \le n \le 100$$$). The second line of each test case contains a string $$$s$$$ of $$$4n$$$ characters ($$$s_i \in \{\texttt{A}, \texttt{B}, \texttt{C}, \texttt{D}, \texttt{?}\}$$$) — Tim's answers for the questions. Output format: For each test case, print a single integer — the maximum score that Tim can achieve. Example Input 0: 6 1 ABCD 2 AAAAAAAA 2 AAAABBBB 2 ???????? 3 ABCABCABCABC 5 ACADC??ACAC?DCAABC?C Example Output 0: 4 2 4 0 9 13 Notes: In the first test case, there is exactly one question with each answer 'A', 'B', 'C', and 'D'; so it's possible that Tim gets all his answers correct. In the second test case, there are only two correct answers 'A' which makes him get exactly $$$2$$$ points in any case. In the third test case, Tim can get at most $$$2$$$ correct answers with option 'A' and $$$2$$$ correct answers with option 'B'. For example, he would get $$$4$$$ points if the answers were 'AACCBBDD'. In the fourth test case, he refuses to answer any question at all, which makes him get $$$0$$$ points.
1
Codeforces_test
null
444
stdin
[ "3\n2\n8 0\n5\n2 2 2 2 2\n5\n0 0 9 0 0\n" ]
[ "8 4 \n4 5 4 5 4 \n4 6 9 6 4\n" ]
[ "3\n2\n8 0\n5\n2 2 2 2 2\n5\n0 0 9 0 0\n", "2\n1\n1000000000\n4\n0 2 2 8\n" ]
[ "8 4 \n4 5 4 5 4 \n4 6 9 6 4 \n", "1000000000 \n3 5 7 9 \n" ]
There are very long classes in the T-Generation. In one day, you need to have time to analyze the training and thematic contests, give a lecture with new material, and, if possible, also hold a mini-seminar. Therefore, there is a break where students can go to drink coffee and chat with each other. There are a total of $$$n+2$$$ coffee machines located in sequentially arranged rooms along a long corridor. The coffee machines are numbered from $$$0$$$ to $$$n+1$$$, and immediately after the break starts, there are $$$a_i$$$ students gathered around the $$$i$$$-th coffee machine. The students are talking too loudly among themselves, and the teachers need to make a very important announcement. Therefore, they want to gather the maximum number of students around some single coffee machine. The teachers are too lazy to run around the corridors and gather the students, so they came up with a more sophisticated way to manipulate them: - At any moment, the teachers can choose room $$$i$$$ ($$$1 \le i \le n$$$) and turn off the lights there; - If there were $$$x$$$ students in that room, then after turning off the lights, $$$\lfloor \frac12 x \rfloor$$$ students will go to room $$$(i-1)$$$, and $$$\lfloor \frac12 x \rfloor$$$ other students will go to room $$$(i+1)$$$. - If $$$x$$$ was odd, then one student remains in the same room. - After that, the lights in room $$$i$$$ are turned back on. The teachers have not yet decided where they will gather the students, so for each $$$i$$$ from $$$1$$$ to $$$n$$$, you should determine what is the maximum number of students that can be gathered around the $$$i$$$-th coffee machine. The teachers can turn off the lights in any rooms at their discretion, in any order, possibly turning off the lights in the same room multiple times. Note that the values of $$$a_0$$$ and $$$a_{n+1}$$$ do not affect the answer to the problem, so their values will not be given to you. Input format: The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10\,000$$$) — the number of test cases. In the first line of each test case, there is an integer $$$n$$$ ($$$1 \le n \le 10^6$$$). In the second line of each test case, there are integers $$$a_1, \ldots, a_n$$$ ($$$0 \le a_i \le 10^9$$$) — the number of students around coffee machines numbered $$$1, 2, \ldots, n$$$. It is guaranteed that the sum of $$$n$$$ across all test cases does not exceed $$$10^6$$$. Output format: For each test case, output $$$n$$$ integers $$$b_1, \ldots, b_n$$$, where $$$b_i$$$ is the maximum number of students that can be around coffee machines number $$$i$$$. Example Input 0: 3 2 8 0 5 2 2 2 2 2 5 0 0 9 0 0 Example Output 0: 8 4 4 5 4 5 4 4 6 9 6 4 Notes: Let's analyze the first test case: - To maximize the number of students at the $$$1$$$-st coffee machine, all that needs to be done is nothing. - To maximize the number of students at the $$$2$$$-nd coffee machine, it is sufficient to turn off the lights in the $$$1$$$-st room once.
1
Codeforces_test
null
445
stdin
[ "3\n2\n3\n6\n" ]
[ "uo\niae\noeiiua\n" ]
[ "3\n2\n3\n6\n", "100\n39\n77\n67\n25\n81\n26\n50\n11\n73\n95\n86\n16\n90\n33\n14\n79\n12\n100\n68\n64\n60\n27\n41\n15\n34\n24\n3\n61\n83\n47\n57\n65\n99\n43\n40\n21\n94\n72\n82\n85\n23\n71\n76\n32\n10\n17\n30\n18\n44\n59\n35\n89\n6\n63\n7\n69\n62\n70\n4\n29\n92\n87\n31\n48\n36\n28\n45\n97\n93\n98\n56\n38\n58\n80\n8\n1\n74\n91\n53\n55\n54\n51\n96\n5\n42\n52\n9\n22\n78\n88\n75\n13\n66\n2\n37\n20\n49\n19\n84\n46\n", "50\n68\n41\n92\n27\n1\n20\n34\n47\n3\n29\n43\n44\n72\n19\n48\n7\n8\n38\n91\n51\n36\n47\n91\n73\n97\n75\n34\n35\n87\n19\n31\n46\n62\n59\n92\n87\n40\n22\n57\n81\n84\n7\n3\n53\n65\n91\n47\n17\n49\n65\n", "1\n53\n" ]
[ "ae\naei\naaeiou\n", "aaaaaaaaeeeeeeeeoooooooouuuuuuuuiiiiiii\naaaaaaaaaaaaaaaaeeeeeeeeeeeeeeeeooooooooooooooouuuuuuuuuuuuuuuiiiiiiiiiiiiiii\naaaaaaaaaaaaaaeeeeeeeeeeeeeeooooooooooooouuuuuuuuuuuuuiiiiiiiiiiiii\naaaaaeeeeeooooouuuuuiiiii\naaaaaaaaaaaaaaaaaeeeeeeeeeeeeeeeeoooooooooooooooouuuuuuuuuuuuuuuuiiiiiiiiiiiiiiii\naaaaaaeeeeeooooouuuuuiiiii\naaaaaaaaaaeeeeeeeeeeoooooooooouuuuuuuuuuiiiiiiiiii\naaaeeoouuii\naaaaaaaaaaaaaaaeeeeeeeeeeeeeeeooooooooooooooouuuuuuuuuuuuuuiiiiiiiiiiiiii\naaaaaaaaaaaaaaaaaaaeeeeeeeeeeeeeeeeeeeooooooooooooooooooouuuuuuuuuuuuuuuuuuuiiiiiiiiiiiiiiiiiii\naaaaaaaaaaaaaaaaaaeeeeeeeeeeeeeeeeeooooooooooooooooouuuuuuuuuuuuuuuuuiiiiiiiiiiiiiiiii\naaaaeeeooouuuiii\naaaaaaaaaaaaaaaaaaeeeeeeeeeeeeeeeeeeoooooooooooooooooouuuuuuuuuuuuuuuuuuiiiiiiiiiiiiiiiiii\naaaaaaaeeeeeeeooooooouuuuuuiiiiii\naaaeeeooouuuii\naaaaaaaaaaaaaaaaeeeeeeeeeeeeeeeeoooooooooooooooouuuuuuuuuuuuuuuuiiiiiiiiiiiiiii\naaaeeeoouuii\naaaaaaaaaaaaaaaaaaaaeeeeeeeeeeeeeeeeeeeeoooooooooooooooooooouuuuuuuuuuuuuuuuuuuuiiiiiiiiiiiiiiiiiiii\naaaaaaaaaaaaaaeeeeeeeeeeeeeeoooooooooooooouuuuuuuuuuuuuiiiiiiiiiiiii\naaaaaaaaaaaaaeeeeeeeeeeeeeooooooooooooouuuuuuuuuuuuuiiiiiiiiiiii\naaaaaaaaaaaaeeeeeeeeeeeeoooooooooooouuuuuuuuuuuuiiiiiiiiiiii\naaaaaaeeeeeeooooouuuuuiiiii\naaaaaaaaaeeeeeeeeoooooooouuuuuuuuiiiiiiii\naaaeeeooouuuiii\naaaaaaaeeeeeeeooooooouuuuuuuiiiiii\naaaaaeeeeeooooouuuuuiiii\naeo\naaaaaaaaaaaaaeeeeeeeeeeeeoooooooooooouuuuuuuuuuuuiiiiiiiiiiii\naaaaaaaaaaaaaaaaaeeeeeeeeeeeeeeeeeooooooooooooooooouuuuuuuuuuuuuuuuiiiiiiiiiiiiiiii\naaaaaaaaaaeeeeeeeeeeooooooooouuuuuuuuuiiiiiiiii\naaaaaaaaaaaaeeeeeeeeeeeeooooooooooouuuuuuuuuuuiiiiiiiiiii\naaaaaaaaaaaaaeeeeeeeeeeeeeooooooooooooouuuuuuuuuuuuuiiiiiiiiiiiii\naaaaaaaaaaaaaaaaaaaaeeeeeeeeeeeeeeeeeeeeoooooooooooooooooooouuuuuuuuuuuuuuuuuuuuiiiiiiiiiiiiiiiiiii\naaaaaaaaaeeeeeeeeeooooooooouuuuuuuuiiiiiiii\naaaaaaaaeeeeeeeeoooooooouuuuuuuuiiiiiiii\naaaaaeeeeoooouuuuiiii\naaaaaaaaaaaaaaaaaaaeeeeeeeeeeeeeeeeeeeooooooooooooooooooouuuuuuuuuuuuuuuuuuuiiiiiiiiiiiiiiiiii\naaaaaaaaaaaaaaaeeeeeeeeeeeeeeeoooooooooooooouuuuuuuuuuuuuuiiiiiiiiiiiiii\naaaaaaaaaaaaaaaaaeeeeeeeeeeeeeeeeeoooooooooooooooouuuuuuuuuuuuuuuuiiiiiiiiiiiiiiii\naaaaaaaaaaaaaaaaaeeeeeeeeeeeeeeeeeooooooooooooooooouuuuuuuuuuuuuuuuuiiiiiiiiiiiiiiiii\naaaaaeeeeeooooouuuuiiii\naaaaaaaaaaaaaaaeeeeeeeeeeeeeeoooooooooooooouuuuuuuuuuuuuuiiiiiiiiiiiiii\naaaaaaaaaaaaaaaaeeeeeeeeeeeeeeeooooooooooooooouuuuuuuuuuuuuuuiiiiiiiiiiiiiii\naaaaaaaeeeeeeeoooooouuuuuuiiiiii\naaeeoouuii\naaaaeeeeooouuuiii\naaaaaaeeeeeeoooooouuuuuuiiiiii\naaaaeeeeoooouuuiii\naaaaaaaaaeeeeeeeeeooooooooouuuuuuuuuiiiiiiii\naaaaaaaaaaaaeeeeeeeeeeeeoooooooooooouuuuuuuuuuuuiiiiiiiiiii\naaaaaaaeeeeeeeooooooouuuuuuuiiiiiii\naaaaaaaaaaaaaaaaaaeeeeeeeeeeeeeeeeeeoooooooooooooooooouuuuuuuuuuuuuuuuuuiiiiiiiiiiiiiiiii\naaeoui\naaaaaaaaaaaaaeeeeeeeeeeeeeooooooooooooouuuuuuuuuuuuiiiiiiiiiiii\naaeeoui\naaaaaaaaaaaaaaeeeeeeeeeeeeeeoooooooooooooouuuuuuuuuuuuuuiiiiiiiiiiiii\naaaaaaaaaaaaaeeeeeeeeeeeeeoooooooooooouuuuuuuuuuuuiiiiiiiiiiii\naaaaaaaaaaaaaaeeeeeeeeeeeeeeoooooooooooooouuuuuuuuuuuuuuiiiiiiiiiiiiii\naeou\naaaaaaeeeeeeoooooouuuuuuiiiii\naaaaaaaaaaaaaaaaaaaeeeeeeeeeeeeeeeeeeeoooooooooooooooooouuuuuuuuuuuuuuuuuuiiiiiiiiiiiiiiiiii\naaaaaaaaaaaaaaaaaaeeeeeeeeeeeeeeeeeeooooooooooooooooouuuuuuuuuuuuuuuuuiiiiiiiiiiiiiiiii\naaaaaaaeeeeeeoooooouuuuuuiiiiii\naaaaaaaaaaeeeeeeeeeeoooooooooouuuuuuuuuiiiiiiiii\naaaaaaaaeeeeeeeooooooouuuuuuuiiiiiii\naaaaaaeeeeeeoooooouuuuuiiiii\naaaaaaaaaeeeeeeeeeooooooooouuuuuuuuuiiiiiiiii\naaaaaaaaaaaaaaaaaaaaeeeeeeeeeeeeeeeeeeeeooooooooooooooooooouuuuuuuuuuuuuuuuuuuiiiiiiiiiiiiiiiiiii\naaaaaaaaaaaaaaaaaaaeeeeeeeeeeeeeeeeeeeooooooooooooooooooouuuuuuuuuuuuuuuuuuiiiiiiiiiiiiiiiiii\naaaaaaaaaaaaaaaaaaaaeeeeeeeeeeeeeeeeeeeeoooooooooooooooooooouuuuuuuuuuuuuuuuuuuiiiiiiiiiiiiiiiiiii\naaaaaaaaaaaaeeeeeeeeeeeooooooooooouuuuuuuuuuuiiiiiiiiiii\naaaaaaaaeeeeeeeeoooooooouuuuuuuiiiiiii\naaaaaaaaaaaaeeeeeeeeeeeeoooooooooooouuuuuuuuuuuiiiiiiiiiii\naaaaaaaaaaaaaaaaeeeeeeeeeeeeeeeeoooooooooooooooouuuuuuuuuuuuuuuuiiiiiiiiiiiiiiii\naaeeooui\na\naaaaaaaaaaaaaaaeeeeeeeeeeeeeeeooooooooooooooouuuuuuuuuuuuuuuiiiiiiiiiiiiii\naaaaaaaaaaaaaaaaaaaeeeeeeeeeeeeeeeeeeoooooooooooooooooouuuuuuuuuuuuuuuuuuiiiiiiiiiiiiiiiiii\naaaaaaaaaaaeeeeeeeeeeeooooooooooouuuuuuuuuuiiiiiiiiii\naaaaaaaaaaaeeeeeeeeeeeooooooooooouuuuuuuuuuuiiiiiiiiiii\naaaaaaaaaaaeeeeeeeeeeeooooooooooouuuuuuuuuuuiiiiiiiiii\naaaaaaaaaaaeeeeeeeeeeoooooooooouuuuuuuuuuiiiiiiiiii\naaaaaaaaaaaaaaaaaaaaeeeeeeeeeeeeeeeeeeeooooooooooooooooooouuuuuuuuuuuuuuuuuuuiiiiiiiiiiiiiiiiiii\naeoui\naaaaaaaaaeeeeeeeeeoooooooouuuuuuuuiiiiiiii\naaaaaaaaaaaeeeeeeeeeeeoooooooooouuuuuuuuuuiiiiiiiiii\naaeeoouui\naaaaaeeeeeoooouuuuiiii\naaaaaaaaaaaaaaaaeeeeeeeeeeeeeeeeoooooooooooooooouuuuuuuuuuuuuuuiiiiiiiiiiiiiii\naaaaaaaaaaaaaaaaaaeeeeeeeeeeeeeeeeeeoooooooooooooooooouuuuuuuuuuuuuuuuuiiiiiiiiiiiiiiiii\naaaaaaaaaaaaaaaeeeeeeeeeeeeeeeooooooooooooooouuuuuuuuuuuuuuuiiiiiiiiiiiiiii\naaaeeeooouuii\naaaaaaaaaaaaaaeeeeeeeeeeeeeooooooooooooouuuuuuuuuuuuuiiiiiiiiiiiii\nae\naaaaaaaaeeeeeeeeooooooouuuuuuuiiiiiii\naaaaeeeeoooouuuuiiii\naaaaaaaaaaeeeeeeeeeeoooooooooouuuuuuuuuuiiiiiiiii\naaaaeeeeoooouuuuiii\naaaaaaaaaaaaaaaaaeeeeeeeeeeeeeeeeeooooooooooooooooouuuuuuuuuuuuuuuuuiiiiiiiiiiiiiiii\naaaaaaaaaaeeeeeeeeeooooooooouuuuuuuuuiiiiiiiii\n", "aaaaaaaaaaaaaaeeeeeeeeeeeeeeoooooooooooooouuuuuuuuuuuuuiiiiiiiiiiiii\naaaaaaaaaeeeeeeeeoooooooouuuuuuuuiiiiiiii\naaaaaaaaaaaaaaaaaaaeeeeeeeeeeeeeeeeeeeoooooooooooooooooouuuuuuuuuuuuuuuuuuiiiiiiiiiiiiiiiiii\naaaaaaeeeeeeooooouuuuuiiiii\na\naaaaeeeeoooouuuuiiii\naaaaaaaeeeeeeeooooooouuuuuuuiiiiii\naaaaaaaaaaeeeeeeeeeeooooooooouuuuuuuuuiiiiiiiii\naeo\naaaaaaeeeeeeoooooouuuuuuiiiii\naaaaaaaaaeeeeeeeeeooooooooouuuuuuuuiiiiiiii\naaaaaaaaaeeeeeeeeeooooooooouuuuuuuuuiiiiiiii\naaaaaaaaaaaaaaaeeeeeeeeeeeeeeeoooooooooooooouuuuuuuuuuuuuuiiiiiiiiiiiiii\naaaaeeeeoooouuuuiii\naaaaaaaaaaeeeeeeeeeeoooooooooouuuuuuuuuiiiiiiiii\naaeeoui\naaeeooui\naaaaaaaaeeeeeeeeoooooooouuuuuuuiiiiiii\naaaaaaaaaaaaaaaaaaaeeeeeeeeeeeeeeeeeeoooooooooooooooooouuuuuuuuuuuuuuuuuuiiiiiiiiiiiiiiiiii\naaaaaaaaaaaeeeeeeeeeeoooooooooouuuuuuuuuuiiiiiiiiii\naaaaaaaaeeeeeeeooooooouuuuuuuiiiiiii\naaaaaaaaaaeeeeeeeeeeooooooooouuuuuuuuuiiiiiiiii\naaaaaaaaaaaaaaaaaaaeeeeeeeeeeeeeeeeeeoooooooooooooooooouuuuuuuuuuuuuuuuuuiiiiiiiiiiiiiiiiii\naaaaaaaaaaaaaaaeeeeeeeeeeeeeeeooooooooooooooouuuuuuuuuuuuuuiiiiiiiiiiiiii\naaaaaaaaaaaaaaaaaaaaeeeeeeeeeeeeeeeeeeeeooooooooooooooooooouuuuuuuuuuuuuuuuuuuiiiiiiiiiiiiiiiiiii\naaaaaaaaaaaaaaaeeeeeeeeeeeeeeeooooooooooooooouuuuuuuuuuuuuuuiiiiiiiiiiiiiii\naaaaaaaeeeeeeeooooooouuuuuuuiiiiii\naaaaaaaeeeeeeeooooooouuuuuuuiiiiiii\naaaaaaaaaaaaaaaaaaeeeeeeeeeeeeeeeeeeooooooooooooooooouuuuuuuuuuuuuuuuuiiiiiiiiiiiiiiiii\naaaaeeeeoooouuuuiii\naaaaaaaeeeeeeoooooouuuuuuiiiiii\naaaaaaaaaaeeeeeeeeeooooooooouuuuuuuuuiiiiiiiii\naaaaaaaaaaaaaeeeeeeeeeeeeeoooooooooooouuuuuuuuuuuuiiiiiiiiiiii\naaaaaaaaaaaaeeeeeeeeeeeeoooooooooooouuuuuuuuuuuuiiiiiiiiiii\naaaaaaaaaaaaaaaaaaaeeeeeeeeeeeeeeeeeeeoooooooooooooooooouuuuuuuuuuuuuuuuuuiiiiiiiiiiiiiiiiii\naaaaaaaaaaaaaaaaaaeeeeeeeeeeeeeeeeeeooooooooooooooooouuuuuuuuuuuuuuuuuiiiiiiiiiiiiiiiii\naaaaaaaaeeeeeeeeoooooooouuuuuuuuiiiiiiii\naaaaaeeeeeoooouuuuiiii\naaaaaaaaaaaaeeeeeeeeeeeeooooooooooouuuuuuuuuuuiiiiiiiiiii\naaaaaaaaaaaaaaaaaeeeeeeeeeeeeeeeeoooooooooooooooouuuuuuuuuuuuuuuuiiiiiiiiiiiiiiii\naaaaaaaaaaaaaaaaaeeeeeeeeeeeeeeeeeooooooooooooooooouuuuuuuuuuuuuuuuuiiiiiiiiiiiiiiii\naaeeoui\naeo\naaaaaaaaaaaeeeeeeeeeeeooooooooooouuuuuuuuuuiiiiiiiiii\naaaaaaaaaaaaaeeeeeeeeeeeeeooooooooooooouuuuuuuuuuuuuiiiiiiiiiiiii\naaaaaaaaaaaaaaaaaaaeeeeeeeeeeeeeeeeeeoooooooooooooooooouuuuuuuuuuuuuuuuuuiiiiiiiiiiiiiiiiii\naaaaaaaaaaeeeeeeeeeeooooooooouuuuuuuuuiiiiiiiii\naaaaeeeeooouuuiii\naaaaaaaaaaeeeeeeeeeeoooooooooouuuuuuuuuuiiiiiiiii\naaaaaaaaaaaaaeeeeeeeeeeeeeooooooooooooouuuuuuuuuuuuuiiiiiiiiiiiii\n", "aaaaaaaaaaaeeeeeeeeeeeiiiiiiiiiiioooooooooouuuuuuuuuu\n" ]
Narek has to spend 2 hours with some 2-year-old kids at the kindergarten. He wants to teach them competitive programming, and their first lesson is about palindromes. Narek found out that the kids only know the vowels of the English alphabet (the letters $$$\mathtt{a}$$$, $$$\mathtt{e}$$$, $$$\mathtt{i}$$$, $$$\mathtt{o}$$$, and $$$\mathtt{u}$$$), so Narek needs to make a string that consists of vowels only. After making the string, he'll ask the kids to count the number of subsequences that are palindromes. Narek wants to keep it simple, so he's looking for a string such that the amount of palindrome subsequences is minimal. Help Narek find a string of length $$$n$$$, consisting of lowercase English vowels only (letters $$$\mathtt{a}$$$, $$$\mathtt{e}$$$, $$$\mathtt{i}$$$, $$$\mathtt{o}$$$, and $$$\mathtt{u}$$$), which minimizes the amount of palindrome$$$^{\dagger}$$$ subsequences$$$^{\ddagger}$$$ in it. $$$^{\dagger}$$$ A string is called a palindrome if it reads the same from left to right and from right to left. $$$^{\ddagger}$$$ String $$$t$$$ is a subsequence of string $$$s$$$ if $$$t$$$ can be obtained from $$$s$$$ by removing several (possibly, zero or all) characters from $$$s$$$ and concatenating the remaining ones, without changing their order. For example, $$$\mathtt{odocs}$$$ is a subsequence of $$$\texttt{c}{\color{red}{\texttt{od}}}\texttt{ef}{\color{red}{\texttt{o}}}\texttt{r}{\color{red}{\texttt{c}}}\texttt{e}{\color{red}{\texttt{s}}}$$$. Input format: The first line of the input contains a single integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Subsequently, the description of each test case follows. The only line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 100$$$) — the size of the string. Output format: For each test case, output any string of length $$$n$$$ that satisfies the above conditions. Example Input 0: 3 2 3 6 Example Output 0: uo iae oeiiua Notes: In the first example, $$$\texttt{uo}$$$ has only three palindrome subsequences: $$$\texttt{u}$$$, $$$\texttt{o}$$$, and the empty string. It can be shown that there is no better answer. In the third example, $$$\texttt{oeiiua}$$$ has only eight palindrome subsequences: $$$\texttt{o}$$$, $$$\texttt{e}$$$, $$$\texttt{i}$$$, $$$\texttt{i}$$$, $$$\texttt{u}$$$, $$$\texttt{a}$$$, $$$\texttt{ii}$$$, and the empty string. It can be shown that there is no better answer.
1
Codeforces_test
null
446
stdin
[ "2\n3 1\n2 1 2\n5 2\n2 1 4\n4 2 5\n" ]
[ "5\n15\n" ]
[ "2\n3 1\n2 1 2\n5 2\n2 1 4\n4 2 5\n" ]
[ "5\n15\n" ]
Claire loves drawing lines. She receives a sheet of paper with an $$$n \times n$$$ grid and begins drawing "lines" on it. Well—the concept of a "line" here is not what we usually think of. Claire refers each line to be a set of consecutive vertical grid cells. When she draws a line, these cells are all covered with black ink. Initially, all the cells are white, and drawing lines turns some of them black. After drawing a few lines, Claire wonders: how many ways she can color an additional white cell black so that the remaining white cells do not form a single connected component. Two cells are directly connected if they share an edge. Two cells $$$x$$$ and $$$y$$$ are indirectly connected if there exists a sequence of cells $$$c_0, c_1, \ldots, c_k$$$ with $$$k > 1$$$ such that $$$c_0 = x$$$, $$$c_k = y$$$, and for every $$$i \in \{1, 2, \ldots, k\}$$$ the cells $$$c_i$$$ and $$$c_{i-1}$$$ are directly connected. A set of cells forms a single connected component if each pair of cells in the set is either directly or indirectly connected. The grid has $$$n$$$ rows and $$$n$$$ columns, both indexed from $$$1$$$ to $$$n$$$. Claire will draw $$$q$$$ lines. The $$$i$$$-th line is drawn in the $$$y_i$$$-th column, from the $$$s_i$$$-th row to the $$$f_i$$$-th row, where $$$s_i \leq f_i$$$ for each $$$i \in \{1, 2, \ldots, q\}$$$. Note that the cells that are passed by at least one of the $$$q$$$ lines are colored black. The following figure shows an example of a $$$20\times 20$$$ grid with $$$q=67$$$ lines. The grid cells marked with red star symbols refer to the cells such that, if Claire colors that cell black, all white cells no longer form a single connected component. You may assume that, after drawing the $$$q$$$ lines, the remaining white cells form a single connected component with at least three white cells. Input format: The first line contains exactly one integer $$$t$$$, indicating the number of test cases. For each test case, it begins with a line containing exactly two integers $$$n$$$ and $$$q$$$. This indicates that the grid is $$$n$$$ by $$$n$$$ and that Claire draws $$$q$$$ lines on it. Then $$$q$$$ lines follow. For each $$$i \in \{1, 2, \ldots, q\}$$$, the $$$i$$$-th line among the $$$q$$$ lines contains exactly three integers $$$y_i$$$, $$$s_i$$$, and $$$f_i$$$. - $$$1\le t \le 125$$$ - $$$2\leq n \leq 10^9$$$ - $$$q\ge 1$$$; the sum of all $$$q$$$ values is at most $$$10^5$$$. - $$$1\leq y_i \leq n$$$ - $$$1\leq s_i \leq f_i \leq n$$$ - There are at least three white cells and all white cells form a connected component. Output format: Print an integer on a line, indicating how many ways Claire can color an additional white cell black so that the remaining white cells do not form a single connected component. Example Input 0: 2 3 1 2 1 2 5 2 2 1 4 4 2 5 Example Output 0: 5 15
1
Codeforces_test
null
447
stdin
[ "6\n7 2\n11 3\n55 13\n5801 6\n8919 64\n8765432 1\n" ]
[ "12\n18\n196\n1975581\n958900\n38416403456028\n" ]
[ "6\n7 2\n11 3\n55 13\n5801 6\n8919 64\n8765432 1\n", "1\n2000000000 2000000000\n" ]
[ "12\n18\n196\n1975581\n958900\n38416403456028\n", "0\n" ]
Iris looked at the stars and a beautiful problem emerged in her mind. She is inviting you to solve it so that a meteor shower is believed to form. There are $$$n$$$ stars in the sky, arranged in a row. Iris has a telescope, which she uses to look at the stars. Initially, Iris observes stars in the segment $$$[1, n]$$$, and she has a lucky value of $$$0$$$. Iris wants to look for the star in the middle position for each segment $$$[l, r]$$$ that she observes. So the following recursive procedure is used: - First, she will calculate $$$m = \left\lfloor \frac{l+r}{2} \right\rfloor$$$. - If the length of the segment (i.e. $$$r - l + 1$$$) is even, Iris will divide it into two equally long segments $$$[l, m]$$$ and $$$[m+1, r]$$$ for further observation. - Otherwise, Iris will aim the telescope at star $$$m$$$, and her lucky value will increase by $$$m$$$; subsequently, if $$$l \neq r$$$, Iris will continue to observe two segments $$$[l, m-1]$$$ and $$$[m+1, r]$$$. Iris is a bit lazy. She defines her laziness by an integer $$$k$$$: as the observation progresses, she will not continue to observe any segment $$$[l, r]$$$ with a length strictly less than $$$k$$$. In this case, please predict her final lucky value. Input format: Each test contains multiple test cases. The first line of input contains a single integer $$$t$$$ ($$$1 \leq t \leq 10^5$$$) — the number of test cases. The description of test cases follows. The only line of each test case contains two integers $$$n$$$ and $$$k$$$ ($$$1 \leq k \leq n \leq 2\cdot 10^9$$$). Output format: For each test case, output a single integer — the final lucky value. Example Input 0: 6 7 2 11 3 55 13 5801 6 8919 64 8765432 1 Example Output 0: 12 18 196 1975581 958900 38416403456028 Notes: In the first test case, at the beginning, Iris observes $$$[1, 7]$$$. Since $$$[1, 7]$$$ has an odd length, she aims at star $$$4$$$ and therefore increases her lucky value by $$$4$$$. Then it is split into $$$2$$$ new segments: $$$[1, 3]$$$ and $$$[5, 7]$$$. The segment $$$[1, 3]$$$ again has an odd length, so Iris aims at star $$$2$$$ and increases her lucky value by $$$2$$$. Then it is split into $$$2$$$ new segments: $$$[1, 1]$$$ and $$$[3, 3]$$$, both having a length less than $$$2$$$, so no further observation is conducted. For range $$$[5, 7]$$$, the progress is similar and the lucky value eventually increases by $$$6$$$. Therefore, the final lucky value is $$$4 + 2 + 6 = 12$$$. In the last test case, Iris finally observes all the stars and the final lucky value is $$$1 + 2 + \cdots + 8\,765\,432 = 38\,416\,403\,456\,028$$$.
1
Codeforces_test
null
448
stdin
[ "16\n51\n60\n61\n777\n12345689\n1000000000\n2002\n3001\n977\n989898986\n80\n800001\n96\n70\n15\n90\n" ]
[ "3\n2\n1\n0\n1\n3\n5\n4\n0\n7\n1\n2\n7\n0\n7\n3\n" ]
[ "16\n51\n60\n61\n777\n12345689\n1000000000\n2002\n3001\n977\n989898986\n80\n800001\n96\n70\n15\n90\n" ]
[ "3\n2\n1\n0\n1\n3\n5\n4\n0\n7\n1\n2\n7\n0\n7\n3\n" ]
You are given a positive integer $$$n$$$. In one operation, you can add to $$$n$$$ any positive integer whose decimal representation contains only the digit $$$9$$$, possibly repeated several times. What is the minimum number of operations needed to make the number $$$n$$$ contain at least one digit $$$7$$$ in its decimal representation? For example, if $$$n = 80$$$, it is sufficient to perform one operation: you can add $$$99$$$ to $$$n$$$, after the operation $$$n = 179$$$, which contains the digit $$$7$$$. Input format: Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). The description of the test cases follows. The only line of each test case contains an integer $$$n$$$ ($$$10 \leq n \leq 10^9$$$). Output format: For each test case, output the minimum number of operations required for the number $$$n$$$ to contain the digit $$$7$$$. Example Input 0: 16 51 60 61 777 12345689 1000000000 2002 3001 977 989898986 80 800001 96 70 15 90 Example Output 0: 3 2 1 0 1 3 5 4 0 7 1 2 7 0 7 3 Notes: In the first test case, three operations are sufficient: $$$51 + 9 + 9 + 9 = 78$$$, which contains the digit $$$7$$$. It can be shown that it is impossible to achieve the goal in one or two operations. In the second test case, two operations are sufficient: $$$60 + 9 + 9 = 78$$$. In the third test case, one operation is sufficient: $$$61 + 9 = 70$$$. In the fourth test case, $$$n$$$ already contains the digit $$$7$$$, so no operations are required. In the fifth test case, you can add $$$99$$$ to $$$n$$$ to obtain a number containing the digit $$$7$$$.
1
Codeforces_test
null
449
stdin
[ "3\n3\n2 5\n1 6\n3 4\n4\n1 6\n7 8\n2 3\n4 5\n6\n2 3\n1 6\n7 8\n9 12\n10 11\n4 5\n" ]
[ "5 1 1 1\n14 2 2 1 1\n132 42 5 2 1 1 1\n" ]
[ "3\n3\n2 5\n1 6\n3 4\n4\n1 6\n7 8\n2 3\n4 5\n6\n2 3\n1 6\n7 8\n9 12\n10 11\n4 5\n" ]
[ "5 1 1 1\n14 2 2 1 1\n132 42 5 2 1 1 1\n" ]
This is the hard version of the problem. The difference between the versions is that in this version, the limits on $$$t$$$ and $$$n$$$ are bigger. You can hack only if you solved all versions of this problem. Now Little John is rich, and so he finally buys a house big enough to fit himself and his favorite bracket sequence. But somehow, he ended up with a lot of brackets! Frustrated, he penetrates through the ceiling with the "buddha palm". A bracket sequence is called balanced if it can be constructed by the following formal grammar. 1. The empty sequence $$$\varnothing$$$ is balanced. 2. If the bracket sequence $$$A$$$ is balanced, then $$$\mathtt{(}A\mathtt{)}$$$ is also balanced. 3. If the bracket sequences $$$A$$$ and $$$B$$$ are balanced, then the concatenated sequence $$$A B$$$ is also balanced. For example, the sequences "(())()", "()", "(()(()))", and the empty sequence are balanced, while "(()" and "(()))(" are not. Given a balanced bracket sequence $$$s$$$, a pair of indices $$$(i,j)$$$ ($$$i<j$$$) is called a good pair if $$$s_i$$$ is '(', $$$s_j$$$ is ')', and the two brackets are added simultaneously with respect to Rule 2 while constructing the sequence $$$s$$$. For example, the sequence "(())()" has three different good pairs, which are $$$(1,4)$$$, $$$(2,3)$$$, and $$$(5,6)$$$. One can show that any balanced bracket sequence of $$$2n$$$ brackets contains exactly $$$n$$$ different good pairs, and using any order of rules to construct the same bracket sequence will yield the same set of good pairs. Emily will play a bracket guessing game with John. The game is played as follows. Initially, John has a balanced bracket sequence $$$s$$$ containing $$$n$$$ different good pairs, which is not known to Emily. John tells Emily the value of $$$n$$$ and asks Emily to guess the sequence. Throughout $$$n$$$ turns, John gives Emily the following kind of clue on each turn. - $$$l\;r$$$: The sequence $$$s$$$ contains a good pair $$$(l,r)$$$. The clues that John gives Emily are pairwise distinct and do not contradict each other. At a certain point, Emily can be certain that the balanced bracket sequence satisfying the clues given so far is unique. For example, assume Emily knows that $$$s$$$ has $$$3$$$ good pairs, and it contains the good pair $$$(2,5)$$$. Out of $$$5$$$ balanced bracket sequences with $$$3$$$ good pairs, there exists only one such sequence "((()))" with the good pair $$$(2,5)$$$. Therefore, one can see that Emily does not always need $$$n$$$ turns to guess $$$s$$$. To find out the content of $$$s$$$ as early as possible, Emily wants to know the number of different balanced bracket sequences that match the clues after each turn. Surely, this is not an easy job for Emily, especially when she is given so many good pairs. Now it is your turn to help Emily. Given the clues, you must find the answer before and after each turn. As the answers may be huge, you need to find them modulo $$$998\,244\,353$$$. Input format: Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). The description of the test cases follows. The first line of each test case contains one integer $$$n$$$ ($$$2 \le n \le 3 \cdot 10^5$$$) — the number of good pairs. Then, each of the $$$n$$$ following lines contains two integers $$$l_i$$$ and $$$r_i$$$ representing the $$$i$$$-th clue ($$$1 \le l_i < r_i \le 2n$$$). The clues in one test case are pairwise distinct and do not contradict each other. It is guaranteed that the sum of $$$n$$$ over all test cases does not exceed $$$3 \cdot 10^5$$$. Output format: For each test case, output $$$n+1$$$ integers on a separate line: - The first integer is the answer before all clues, modulo $$$998\,244\,353$$$. - For all $$$i \ge 1$$$, the $$$i+1$$$-th integer is the answer after the $$$i$$$-th clue, modulo $$$998\,244\,353$$$. Example Input 0: 3 3 2 5 1 6 3 4 4 1 6 7 8 2 3 4 5 6 2 3 1 6 7 8 9 12 10 11 4 5 Example Output 0: 5 1 1 1 14 2 2 1 1 132 42 5 2 1 1 1 Notes: The first test case of the example is explained in the problem description. The third test case of the example is explained as follows. It can be shown that there are $$$132$$$ balanced bracket sequences with $$$6$$$ good pairs. The answers after each clue are given as follows: 1. You are given the good pair $$$(2,3)$$$. There are $$$42$$$ balanced bracket sequences having the good pair $$$(2,3)$$$. 2. You are given the good pair $$$(1,6)$$$. There are $$$5$$$ balanced bracket sequences having good pairs $$$(2,3)$$$, $$$(1,6)$$$. 3. You are given the good pair $$$(7,8)$$$. There are $$$2$$$ balanced bracket sequences having the three good pairs. The strings are "(()())()(())" and "(()())()()()", respectively. 4. You are given the good pair $$$(9,12)$$$. There is only one balanced bracket sequence having the four good pairs. The content of $$$s$$$ is therefore the only string, which is "(()())()(())". Then, the number of bracket sequences after the fifth and the sixth clue are both $$$1$$$ as you already know the content of $$$s$$$.
1
Codeforces_test
null
450
stdin
[ "6\n2 1 1\n1 2\n4 1 2\n1 2\n2 4\n7 2 3\n1 2\n1 3\n6 7\n5 1 2\n1 2\n3 5\n9 2 1\n2 8\n9 2 4\n7 9\n4 8\n1 3\n2 3\n" ]
[ "1 1\n2 1\n1 4\n1 1\n1 1\n3 4\n" ]
[ "6\n2 1 1\n1 2\n4 1 2\n1 2\n2 4\n7 2 3\n1 2\n1 3\n6 7\n5 1 2\n1 2\n3 5\n9 2 1\n2 8\n9 2 4\n7 9\n4 8\n1 3\n2 3\n" ]
[ "1 1\n2 1\n1 4\n1 1\n1 1\n3 4\n" ]
Robin's brother and mother are visiting, and Robin gets to choose the start day for each visitor. All days are numbered from $$$1$$$ to $$$n$$$. Visitors stay for $$$d$$$ continuous days, all of those $$$d$$$ days must be between day $$$1$$$ and $$$n$$$ inclusive. Robin has a total of $$$k$$$ risky 'jobs' planned. The $$$i$$$-th job takes place between days $$$l_i$$$ and $$$r_i$$$ inclusive, for $$$1 \le i \le k$$$. If a job takes place on any of the $$$d$$$ days, the visit overlaps with this job (the length of overlap is unimportant). Robin wants his brother's visit to overlap with the maximum number of distinct jobs, and his mother's the minimum. Find suitable start days for the visits of Robin's brother and mother. If there are multiple suitable days, choose the earliest one. Input format: The first line of the input contains a single integer $$$t$$$ ($$$1\leq t \leq 10^4$$$) — the number of test cases. The first line of each test case consists of three integers $$$n$$$, $$$d$$$, $$$k$$$ ($$$1 \le n \le 10^5, 1 \le d, k \le n$$$) — the number of total days, duration of the visits, and the number of jobs. Then follow $$$k$$$ lines of each test case, each with two integers $$$l_i$$$ and $$$r_i$$$ ($$$1 \le l_i \le r_i \le n$$$) — the start and end day of each job. It is guaranteed that the sum of $$$n$$$ over all test cases does not exceed $$$2 \cdot 10^5$$$. Output format: For each test case, output two integers, the best starting days of Robin's brother and mother respectively. Both visits must fit between day $$$1$$$ and $$$n$$$ inclusive. Example Input 0: 6 2 1 1 1 2 4 1 2 1 2 2 4 7 2 3 1 2 1 3 6 7 5 1 2 1 2 3 5 9 2 1 2 8 9 2 4 7 9 4 8 1 3 2 3 Example Output 0: 1 1 2 1 1 4 1 1 1 1 3 4 Notes: In the first test case, the only job fills all $$$2$$$ days, both should visit on day $$$1$$$. In the second test case, day $$$2$$$ overlaps with $$$2$$$ jobs and day $$$1$$$ overlaps with only $$$1$$$. In the third test case, Robert visits for days $$$[1,2]$$$, Mrs. Hood visits for days $$$[4,5]$$$.
1
Codeforces_test
null
451
stdin
[ "2\n4 3\n1 5 2 4\n4 9 5 3\n4 5 2 3\n1 5 5 2\n1 1 4 4\n2 2 3 3\n1 2 4 3\n3 3\n1 2 3\n4 5 6\n7 8 9\n1 1 1 3\n1 3 3 3\n2 2 2 2\n" ]
[ "500 42 168 \n14 42 5\n" ]
[ "2\n4 3\n1 5 2 4\n4 9 5 3\n4 5 2 3\n1 5 5 2\n1 1 4 4\n2 2 3 3\n1 2 4 3\n3 3\n1 2 3\n4 5 6\n7 8 9\n1 1 1 3\n1 3 3 3\n2 2 2 2\n" ]
[ "500 42 168 \n14 42 5 \n" ]
Swing is opening a pancake factory! A good pancake factory must be good at flattening things, so Swing is going to test his new equipment on 2D matrices. Swing is given an $$$n \times n$$$ matrix $$$M$$$ containing positive integers. He has $$$q$$$ queries to ask you. For each query, he gives you four integers $$$x_1$$$, $$$y_1$$$, $$$x_2$$$, $$$y_2$$$ and asks you to flatten the submatrix bounded by $$$(x_1, y_1)$$$ and $$$(x_2, y_2)$$$ into an array $$$A$$$. Formally, $$$A = [M_{(x1,y1)}, M_{(x1,y1+1)}, \ldots, M_{(x1,y2)}, M_{(x1+1,y1)}, M_{(x1+1,y1+1)}, \ldots, M_{(x2,y2)}]$$$. The following image depicts the flattening of a submatrix bounded by the red dotted lines. The orange arrows denote the direction that the elements of the submatrix are appended to the back of $$$A$$$, and $$$A$$$ is shown at the bottom of the image. Afterwards, he asks you for the value of $$$\sum_{i=1}^{|A|} A_i \cdot i$$$ (sum of $$$A_i \cdot i$$$ over all $$$i$$$). Input format: The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The first line of each test contains two integers $$$n$$$ and $$$q$$$ ($$$1 \leq n \leq 2000, 1 \leq q \leq 10^6$$$) — the length of $$$M$$$ and the number of queries. The following $$$n$$$ lines contain $$$n$$$ integers each, the $$$i$$$'th of which contains $$$M_{(i,1)}, M_{(i,2)}, \ldots, M_{(i,n)}$$$ ($$$1 \leq M_{(i, j)} \leq 10^6$$$). The following $$$q$$$ lines contain four integers $$$x_1$$$, $$$y_1$$$, $$$x_2$$$, and $$$y_2$$$ ($$$1 \leq x_1 \leq x_2 \leq n, 1 \leq y_1 \leq y_2 \leq n$$$) — the bounds of the query. It is guaranteed that the sum of $$$n$$$ over all test cases does not exceed $$$2000$$$ and the sum of $$$q$$$ over all test cases does not exceed $$$10^6$$$. Output format: For each test case, output the results of the $$$q$$$ queries on a new line. Example Input 0: 2 4 3 1 5 2 4 4 9 5 3 4 5 2 3 1 5 5 2 1 1 4 4 2 2 3 3 1 2 4 3 3 3 1 2 3 4 5 6 7 8 9 1 1 1 3 1 3 3 3 2 2 2 2 Example Output 0: 500 42 168 14 42 5 Notes: In the second query of the first test case, $$$A = [9, 5, 5, 2]$$$. Therefore, the sum is $$$1 \cdot 9 + 2 \cdot 5 + 3 \cdot 5 + 4 \cdot 2 = 42$$$.
1
Codeforces_test
null
452
stdin
[ "6\n2 3\n10\n2 3\n11\n5 1\n11101\n7 9\n1101011\n17 34\n11001010001010010\n1 500\n1\n" ]
[ "3\n2\n0\n8\n32\n0\n" ]
[ "6\n2 3\n10\n2 3\n11\n5 1\n11101\n7 9\n1101011\n17 34\n11001010001010010\n1 500\n1\n", "4\n5 347\n11111\n61 373\n1000000000000000000000000000100000000000000000000000000000000\n57 439\n100010101011110000010111010000110010000110101000110111010\n77 488\n10000000000000000000000000000000000010000000000000000000000000000000100000000\n", "4\n43 136\n1111100010001010100011011110110001110100001\n10 20\n1000101110\n17 6\n10100000100100110\n130 68\n1011111111111111111111111111011111111111111111110111111111111111111111111111111111111011111111011111111111111111111111110111111111\n", "4\n45 12\n111010001111111001110111111111011011101100111\n24 38\n101000001101111110011001\n19 55\n1000001110111110010\n112 40\n1100000001110100001001000000100000110010000000010000000000000000000000000010100000000001000000000010000000000000\n", "4\n69 3\n110111011100000110000010011111101100000100010000100100000100011000110\n1 1\n1\n4 1\n1000\n126 1\n110101110011000010110101101101011111110001000110001111010011000101101011101110001111111011110001000111111111001100101011010101\n", "4\n44 331\n11111111111111111111111111111111111111111111\n99 395\n111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111\n1 488\n1\n56 493\n11111111111111111111111111111111111111111111111111111111\n", "4\n119 13\n11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111\n39 17\n111111111111111111111111111111111111111\n13 13\n1111111111111\n29 6\n11111111111111111111111111111\n", "4\n65 131\n11111111111111111111111111111111111111111111111111111111111111111\n52 326\n1111111111111111111111111111111111111111111111111111\n41 73\n11111111111111111111111111111111111111111\n42 332\n111111111111111111111111111111111111111111\n", "4\n6 176\n111111\n54 140\n111111111111111111111111111111111111111111111111111111\n131 267\n11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111\n9 58\n111111111\n", "4\n82 388\n1111111111111111111111111111111111111111111111111111111111111111111111111111111111\n56 200\n11111111111111111111111111111111111111111111111111111111\n57 75\n111111111111111111111111111111111111111111111111111111111\n5 21\n11111\n", "1\n200 268\n11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111\n", "1\n200 265\n11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111\n", "4\n44 320\n11111111111111111111111111111111111111111111\n99 128\n111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111\n1 490\n1\n56 320\n11111111111111111111111111111111111111111111111111111111\n", "4\n60 2\n111111111111111111111111111111111111111111111111111111111111\n32 386\n11111111111111111111111111111111\n64 395\n1111111111111111111111111111111111111111111111111111111111111111\n16 353\n1111111111111111\n", "4\n7 33\n1111111\n64 419\n1111111111111111111111111111111111111111111111111111111111111111\n64 421\n1111111111111111111111111111111111111111111111111111111111111111\n32 199\n11111111111111111111111111111111\n", "4\n32 65\n11111111111111111111111111111111\n32 217\n11111111111111111111111111111111\n32 258\n11111111111111111111111111111111\n64 1\n1111111111111111111111111111111111111111111111111111111111111111\n", "1\n192 335\n111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111\n", "1\n192 308\n111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111\n", "4\n124 115\n1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111\n40 111\n1111111111111111111111111111111111111111\n33 60\n111111111111111111111111111111111\n3 264\n111\n", "4\n94 379\n1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111\n3 108\n111\n31 128\n1111111111111111111111111111111\n72 466\n111111111111111111111111111111111111111111111111111111111111111111111111\n" ]
[ "3\n2\n0\n8\n32\n0\n", "344\n374\n0\n0\n", "6\n3\n1\n77\n", "3\n38\n49\n0\n", "2\n0\n0\n0\n", "323\n3\n0\n486\n", "12\n3\n12\n6\n", "128\n5\n0\n333\n", "0\n4\n3\n57\n", "385\n219\n3\n3\n", "10\n", "11\n", "0\n0\n1\n24\n", "0\n384\n449\n368\n", "32\n461\n458\n227\n", "96\n236\n256\n0\n", "471\n", "473\n", "14\n24\n3\n0\n", "6\n3\n0\n31\n" ]
This is the easy version of the problem. The difference between the versions is that in this version, the constraints on $$$t$$$, $$$k$$$, and $$$m$$$ are lower. You can hack only if you solved all versions of this problem. A sequence $$$a$$$ of $$$n$$$ integers is called good if the following condition holds: - Let $$$\text{cnt}_x$$$ be the number of occurrences of $$$x$$$ in sequence $$$a$$$. For all pairs $$$0 \le i < j < m$$$, at least one of the following has to be true: $$$\text{cnt}_i = 0$$$, $$$\text{cnt}_j = 0$$$, or $$$\text{cnt}_i \le \text{cnt}_j$$$. In other words, if both $$$i$$$ and $$$j$$$ are present in sequence $$$a$$$, then the number of occurrences of $$$i$$$ in $$$a$$$ is less than or equal to the number of occurrences of $$$j$$$ in $$$a$$$. You are given integers $$$n$$$ and $$$m$$$. Calculate the value of the bitwise XOR of the median$$$^{\text{∗}}$$$ of all good sequences $$$a$$$ of length $$$n$$$ with $$$0\le a_i < m$$$. Note that the value of $$$n$$$ can be very large, so you are given its binary representation instead. Input format: Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 50$$$). The description of the test cases follows. The first line of each test case contains two integers $$$k$$$ and $$$m$$$ ($$$1 \le k \le 200$$$, $$$1 \le m \le 500$$$) — the number of bits in $$$n$$$ and the upper bound on the elements in sequence $$$a$$$. The second line of each test case contains a binary string of length $$$k$$$ — the binary representation of $$$n$$$ with no leading zeros. It is guaranteed that the sum of $$$k$$$ over all test cases does not exceed $$$200$$$. Output format: For each test case, output a single integer representing the bitwise XOR of the median of all good sequences $$$a$$$ of length $$$n$$$ where $$$0\le a_i < m$$$. Example Input 0: 6 2 3 10 2 3 11 5 1 11101 7 9 1101011 17 34 11001010001010010 1 500 1 Example Output 0: 3 2 0 8 32 0 Notes: In the first example, $$$n = 10_2 = 2$$$ and $$$m = 3$$$. All possible sequences with elements less than $$$m$$$ are: $$$[0, 0]$$$, $$$[0, 1]$$$, $$$[0, 2]$$$, $$$[1, 0]$$$, $$$[1, 1]$$$, $$$[1, 2]$$$, $$$[2, 0]$$$, $$$[2, 1]$$$, $$$[2, 2]$$$. All of them are good, so the answer is: $$$0 \oplus 0 \oplus 0 \oplus 0 \oplus 1 \oplus 1 \oplus 0 \oplus 1 \oplus 2 = 3$$$. In the second example, $$$n = 11_2 = 3$$$ and $$$m = 3$$$. Some good sequences are $$$[2, 2, 2]$$$, $$$[1, 0, 1]$$$, and $$$[2, 0, 1]$$$. However, a sequence $$$[2, 0, 0]$$$ is not good, because $$$\text{cnt}_0 = 2$$$, $$$\text{cnt}_2 = 1$$$. Therefore, if we set $$$i = 0$$$ and $$$j = 2$$$, $$$i < j$$$ holds, but $$$\text{cnt}_i \le \text{cnt}_j$$$ does not.
1
Codeforces_test
null
453
stdin
[ "3\n3\n1 2\n2 3\n2 2\n3\n1 2\n2 3\n3 3\n6\n1 2\n1 3\n2 4\n2 5\n1 6\n4 4\n" ]
[ "Bob\nAlice\nAlice\n" ]
[ "3\n3\n1 2\n2 3\n2 2\n3\n1 2\n2 3\n3 3\n6\n1 2\n1 3\n2 4\n2 5\n1 6\n4 4\n" ]
[ "Bob\nAlice\nAlice\n" ]
This is the easy version of the problem. In this version, $$$\mathbf{u = v}$$$. You can make hacks only if both versions of the problem are solved. Alice and Bob are playing a fun game on a tree. This game is played on a tree with $$$n$$$ vertices, numbered from $$$1$$$ to $$$n$$$. Recall that a tree with $$$n$$$ vertices is an undirected connected graph with $$$n - 1$$$ edges. Alice and Bob take turns, with Alice going first. Each player starts at some vertex. On their turn, a player must move from the current vertex to a neighboring vertex that has not yet been visited by anyone. The first player who cannot make a move loses. You are given two vertices $$$u$$$ and $$$v$$$. Represent the simple path from vertex $$$u$$$ to $$$v$$$ as an array $$$p_1, p_2, p_3, \ldots, p_m$$$, where $$$p_1 = u$$$, $$$p_m = v$$$, and there is an edge between $$$p_i$$$ and $$$p_{i + 1}$$$ for all $$$i$$$ ($$$1 \le i < m$$$). You need to determine the winner of the game if Alice starts at vertex $$$1$$$ and Bob starts at vertex $$$p_j$$$ for each $$$j$$$ (where $$$1 \le j \le m$$$). Input format: Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$2 \le n \le 2 \cdot 10^5$$$) — the number of vertices in the tree. Each of the following $$$n - 1$$$ lines contains two integers $$$a$$$ and $$$b$$$ ($$$1 \le a, b \le n$$$), denoting an undirected edge between vertices $$$a$$$ and $$$b$$$. It is guaranteed that these edges form a tree. The last line of each test case contains two integers $$$u$$$ and $$$v$$$ ($$$2 \le u, v \le n$$$, $$$\mathbf{u = v}$$$). It is guaranteed that the path from $$$u$$$ to $$$v$$$ does not pass through vertex $$$1$$$. It is guaranteed that the sum of $$$n$$$ over all test cases does not exceed $$$2 \cdot 10^5$$$. Output format: For each test case, output $$$m$$$ lines. In the $$$i$$$-th line, print the winner of the game if Alice starts at vertex $$$1$$$ and Bob starts at vertex $$$p_i$$$. Print "Alice" (without quotes) if Alice wins, or "Bob" (without quotes) otherwise. Example Input 0: 3 3 1 2 2 3 2 2 3 1 2 2 3 3 3 6 1 2 1 3 2 4 2 5 1 6 4 4 Example Output 0: Bob Alice Alice Notes: Tree from the first and second examples. In the first test case, the path will be ($$$2,2$$$). Bob starts at vertex $$$2$$$, Alice will not be able to move anywhere on her first turn and will lose. In the second test case, the path will be ($$$3,3$$$). Bob starts at vertex $$$3$$$, Alice will move to vertex $$$2$$$, and Bob will have no remaining vertices to visit and will lose.
1
Codeforces_test
null
454
stdin
[ "9 5\n0 1 2 1 3 4 5 6 0\n1 5\n2 5\n3 5\n4 5\n1 9\n" ]
[ "4 1\n2 1\n0 1\n-1\n8 2\n" ]
[ "9 5\n0 1 2 1 3 4 5 6 0\n1 5\n2 5\n3 5\n4 5\n1 9\n", "1 1\n0\n1 1\n", "1 1\n50\n1 1\n" ]
[ "4 1\n2 1\n0 1\n-1\n8 2\n", "0 1\n", "-1\n" ]
Recall the rules of the game "Nim". There are $$$n$$$ piles of stones, where the $$$i$$$-th pile initially contains some number of stones. Two players take turns choosing a non-empty pile and removing any positive (strictly greater than $$$0$$$) number of stones from it. The player unable to make a move loses the game. You are given an array $$$a$$$, consisting of $$$n$$$ integers. Artem and Ruslan decided to play Nim on segments of this array. Each of the $$$q$$$ rounds is defined by a segment $$$(l_i, r_i)$$$, where the elements $$$a_{l_i}, a_{l_i+1}, \dots, a_{r_i}$$$ represent the sizes of the piles of stones. Before the game starts, Ruslan can remove any number of piles from the chosen segment. However, at least one pile must remain, so in a single round he can remove at most $$$(r_i - l_i)$$$ piles. He is allowed to remove $$$0$$$ piles. After the removal, the game is played on the remaining piles within the segment. All rounds are independent: the changes made in one round do not affect the original array or any other rounds. Ruslan wants to remove as many piles as possible so that Artem, who always makes the first move, loses. For each round, determine: 1. the maximum number of piles Ruslan can remove; 2. the number of ways to choose the maximum number of piles for removal. Two ways are considered different if there exists an index $$$i$$$ such that the pile at index $$$i$$$ is removed in one way but not in the other. Since the number of ways can be large, output it modulo $$$998\,244\,353$$$. If Ruslan cannot ensure Artem's loss in a particular round, output -1 for that round. Input format: The first line of input contains two integers $$$n$$$ and $$$q$$$ ($$$1 \le n, q \le 10^5$$$) — the size of the array and the number of segments for which the answers need to be calculated. The second line of input contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$0 \le a_i \le 50$$$) — the elements of the initial array. The $$$i$$$-th of the next $$$q$$$ lines contains two integers $$$l_i, r_i$$$ ($$$1 \le l_i \le r_i \le n$$$) — the bounds of the segment on which the boys want to play the game during the $$$i$$$-th round. Output format: For each round: - if Ruslan can win, print two integers — the maximum number of piles that can be removed, and the number of ways to remove the maximum number of piles, taken modulo $$$998\,244\,353$$$; - otherwise print -1. Example Input 0: 9 5 0 1 2 1 3 4 5 6 0 1 5 2 5 3 5 4 5 1 9 Example Output 0: 4 1 2 1 0 1 -1 8 2
1
Codeforces_test
null
455
stdin
[ "4\n4\n2 0\n1 1\n3 0\n5 1\n6\n4 6\n1 3\n4 6\n4 0\n7 6\n6 3\n7\n9 0\n7 1\n5 0\n7 1\n9 0\n1 1\n2 0\n10\n10 7\n4 9\n2 2\n7 9\n2 8\n8 5\n11 7\n15 5\n12 7\n4 0\n" ]
[ "2 2 4 5 \n4 4 7 7 10 10 \n9 9 9 9 9 9 10 \n10 10 10 10 10 10 12 15 15 15\n" ]
[ "4\n4\n2 0\n1 1\n3 0\n5 1\n6\n4 6\n1 3\n4 6\n4 0\n7 6\n6 3\n7\n9 0\n7 1\n5 0\n7 1\n9 0\n1 1\n2 0\n10\n10 7\n4 9\n2 2\n7 9\n2 8\n8 5\n11 7\n15 5\n12 7\n4 0\n", "1\n10\n1000000000 1\n1 0\n1000000000 1\n1 0\n1000000000 1\n1 0\n1000000000 1\n1 0\n1000000000 1\n1 0\n" ]
[ "2 2 4 5 \n4 4 7 7 10 10 \n9 9 9 9 9 9 10 \n10 10 10 10 10 10 12 15 15 15 \n", "1000000000 1000000000 1999999999 1999999999 2999999998 2999999998 3999999997 3999999997 4999999996 4999999996 \n" ]
Given an array of integers $$$s_1, s_2, \ldots, s_l$$$, every second, cosmic rays will cause all $$$s_i$$$ such that $$$i=1$$$ or $$$s_i\neq s_{i-1}$$$ to be deleted simultaneously, and the remaining parts will be concatenated together in order to form the new array $$$s_1, s_2, \ldots, s_{l'}$$$. Define the strength of an array as the number of seconds it takes to become empty. You are given an array of integers compressed in the form of $$$n$$$ pairs that describe the array left to right. Each pair $$$(a_i,b_i)$$$ represents $$$a_i$$$ copies of $$$b_i$$$, i.e. $$$\underbrace{b_i,b_i,\cdots,b_i}_{a_i\textrm{ times}}$$$. For each $$$i=1,2,\dots,n$$$, please find the strength of the sequence described by the first $$$i$$$ pairs. Input format: Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1\le t\le10^4$$$). The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1\le n\le3\cdot10^5$$$) — the length of sequence $$$a$$$. The next $$$n$$$ lines contain two integers each $$$a_i$$$, $$$b_i$$$ ($$$1\le a_i\le10^9,0\le b_i\le n$$$) — the pairs which describe the sequence. It is guaranteed that the sum of all $$$n$$$ does not exceed $$$3\cdot10^5$$$. It is guaranteed that for all $$$1\le i<n$$$, $$$b_i\neq b_{i+1}$$$ holds. Output format: For each test case, print one line containing $$$n$$$ integers — the answer for each prefix of pairs. Example Input 0: 4 4 2 0 1 1 3 0 5 1 6 4 6 1 3 4 6 4 0 7 6 6 3 7 9 0 7 1 5 0 7 1 9 0 1 1 2 0 10 10 7 4 9 2 2 7 9 2 8 8 5 11 7 15 5 12 7 4 0 Example Output 0: 2 2 4 5 4 4 7 7 10 10 9 9 9 9 9 9 10 10 10 10 10 10 10 12 15 15 15 Notes: In the first test case, for the prefix of length $$$4$$$, the changes will be $$$[0,0,1,0,0,0,1,1,1,1,1]\rightarrow[0,0,0,1,1,1,1]\rightarrow[0,0,1,1,1]\rightarrow[0,1,1]\rightarrow[1]\rightarrow[]$$$, so the array becomes empty after $$$5$$$ seconds. In the second test case, for the prefix of length $$$4$$$, the changes will be $$$[6,6,6,6,3,6,6,6,6,0,0,0,0]\rightarrow[6,6,6,6,6,6,0,0,0]\rightarrow[6,6,6,6,6,0,0]\rightarrow[6,6,6,6,0]\rightarrow[6,6,6]\rightarrow[6,6]\rightarrow[6]\rightarrow[]$$$, so the array becomes empty after $$$7$$$ seconds.
1
Codeforces_test
null
456
stdin
[ "7\n4\n5 5 5 10\n4\n10 5 10 5\n4\n1 2 3 4\n4\n1 1 1 3\n6\n4 2 1 5 7 1\n6\n10 200 30 300 30 100\n4\n100000000 100000000 1 2\n" ]
[ "5 5 5 10\n5 5 10 10\n-1\n-1\n1 1 4 5\n-1\n100000000 100000000 1 2\n" ]
[ "7\n4\n5 5 5 10\n4\n10 5 10 5\n4\n1 2 3 4\n4\n1 1 1 3\n6\n4 2 1 5 7 1\n6\n10 200 30 300 30 100\n4\n100000000 100000000 1 2\n", "1\n4\n1 2 2 4\n", "1\n5\n8 10 10 12 100\n", "1\n4\n10 11 11 12\n", "1\n4\n100 105 105 106\n", "1\n4\n1 5 5 6\n", "1\n4\n1 10 10 20\n", "1\n4\n3 4 4 5\n", "1\n4\n1 2 2 3\n", "1\n4\n1 1 1 1\n", "1\n4\n4 4 4 4\n" ]
[ "5 10 5 5\n5 5 10 10\n-1\n-1\n4 5 1 1\n-1\n1 2 100000000 100000000\n", "1 4 2 2\n", "8 12 10 10\n", "10 12 11 11\n", "100 106 105 105\n", "1 6 5 5\n", "1 20 10 10\n", "3 5 4 4\n", "1 3 2 2\n", "1 1 1 1\n", "4 4 4 4\n" ]
Kevin has $$$n$$$ sticks with length $$$a_1,a_2,\ldots,a_n$$$. Kevin wants to select $$$4$$$ sticks from these to form an isosceles trapezoid$$$^{\text{∗}}$$$ with a positive area. Note that rectangles and squares are also considered isosceles trapezoids. Help Kevin find a solution. If no solution exists, output $$$-1$$$. Input format: Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$4 \le n \le 2\cdot 10^5$$$). The second line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \le a_i \le 10^8$$$). It is guaranteed that the sum of $$$n$$$ over all test cases does not exceed $$$2\cdot 10^5$$$. Output format: For each test case, output $$$4$$$ integers — the lengths of sticks. If no solution exists, output $$$-1$$$. If there are multiple solutions, print any of them. Example Input 0: 7 4 5 5 5 10 4 10 5 10 5 4 1 2 3 4 4 1 1 1 3 6 4 2 1 5 7 1 6 10 200 30 300 30 100 4 100000000 100000000 1 2 Example Output 0: 5 5 5 10 5 5 10 10 -1 -1 1 1 4 5 -1 100000000 100000000 1 2 Notes: In the first test case, you can form an isosceles trapezoid with bases of length $$$5$$$ and $$$10$$$, and two legs of length $$$5$$$. In the second test case, you can form an isosceles trapezoid with two bases of length $$$5$$$ and two legs of length $$$10$$$. A rectangle is considered an isosceles trapezoid here. In the third test case, there are no sticks with the same length. It's impossible to form an isosceles trapezoid. In the fourth test case, it's impossible to form an isosceles trapezoid with a positive area.
1
Codeforces_test
null
457
stdin
[ "7\n1\n1\n3\n1 2 3\n3\n1 2 2\n5\n5 4 3 2 1\n6\n1 1 2 2 3 3\n8\n8 7 6 3 8 7 6 3\n6\n1 1 4 5 1 4\n" ]
[ "0\n2\n1\n4\n4\n6\n3\n" ]
[ "7\n1\n1\n3\n1 2 3\n3\n1 2 2\n5\n5 4 3 2 1\n6\n1 1 2 2 3 3\n8\n8 7 6 3 8 7 6 3\n6\n1 1 4 5 1 4\n" ]
[ "0\n2\n1\n4\n4\n6\n3\n" ]
You are given a cyclic array $$$a_1, a_2, \ldots, a_n$$$. You can perform the following operation on $$$a$$$ at most $$$n - 1$$$ times: - Let $$$m$$$ be the current size of $$$a$$$, you can choose any two adjacent elements where the previous one is no greater than the latter one (In particular, $$$a_m$$$ and $$$a_1$$$ are adjacent and $$$a_m$$$ is the previous one), and delete exactly one of them. In other words, choose an integer $$$i$$$ ($$$1 \leq i \leq m$$$) where $$$a_i \leq a_{(i \bmod m) + 1}$$$ holds, and delete exactly one of $$$a_i$$$ or $$$a_{(i \bmod m) + 1}$$$ from $$$a$$$. Your goal is to find the minimum number of operations needed to make all elements in $$$a$$$ equal. Input format: Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 500$$$). The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 100$$$) — the length of the array $$$a$$$. The second line of each test case contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \le a_i \le n$$$) — the elements of array $$$a$$$. Output format: For each test case, output a single line containing an integer: the minimum number of operations needed to make all elements in $$$a$$$ equal. Example Input 0: 7 1 1 3 1 2 3 3 1 2 2 5 5 4 3 2 1 6 1 1 2 2 3 3 8 8 7 6 3 8 7 6 3 6 1 1 4 5 1 4 Example Output 0: 0 2 1 4 4 6 3 Notes: In the first test case, there is only one element in $$$a$$$, so we can't do any operation. In the second test case, we can perform the following operations to make all elements in $$$a$$$ equal: - choose $$$i = 2$$$, delete $$$a_3$$$, then $$$a$$$ would become $$$[1, 2]$$$. - choose $$$i = 1$$$, delete $$$a_1$$$, then $$$a$$$ would become $$$[2]$$$. It can be proven that we can't make all elements in $$$a$$$ equal using fewer than $$$2$$$ operations, so the answer is $$$2$$$.
1
Codeforces_test
null
458
stdin
[ "6\n3\nabc\n4\nxyyx\n8\nalphabet\n1\nk\n10\naabbccddee\n6\nttbddq\n" ]
[ "cbc\nyyyx\nalphaaet\nk\neabbccddee\ntttddq\n" ]
[ "6\n3\nabc\n4\nxyyx\n8\nalphabet\n1\nk\n10\naabbccddee\n6\nttbddq\n" ]
[ "cbc\nyyyx\nalphaaet\nk\neabbccddee\ntttddq\n" ]
You're given a string $$$s$$$ of length $$$n$$$, consisting of only lowercase English letters. You must do the following operation exactly once: - Choose any two indices $$$i$$$ and $$$j$$$ ($$$1 \le i, j \le n$$$). You can choose $$$i = j$$$. - Set $$$s_i := s_j$$$. You need to minimize the number of distinct permutations$$$^\dagger$$$ of $$$s$$$. Output any string with the smallest number of distinct permutations after performing exactly one operation. $$$^\dagger$$$ A permutation of the string is an arrangement of its characters into any order. For example, "bac" is a permutation of "abc" but "bcc" is not. Input format: Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 500$$$). The description of the test cases follows. The first line of each test case contains $$$n$$$ ($$$1 \le n \le 10$$$) — the length of string $$$s$$$. The second line of each test case contains $$$s$$$ of length $$$n$$$. The string contains only lowercase English letters. Output format: For each test case, output the required $$$s$$$ after applying exactly one operation. If there are multiple solutions, print any of them. Example Input 0: 6 3 abc 4 xyyx 8 alphabet 1 k 10 aabbccddee 6 ttbddq Example Output 0: cbc yyyx alphaaet k eabbccddee tttddq Notes: In the first test case, we can obtain the following strings in one operation: "abc", "bbc", "cbc", "aac", "acc", "aba", and "abb". The string "abc" has $$$6$$$ distinct permutations: "abc", "acb", "bac", "bca", "cab", and "cba". The string "cbc" has $$$3$$$ distinct permutations: "bcc", "cbc", and "ccb", which is the lowest of all the obtainable strings. In fact, all obtainable strings except "abc" have $$$3$$$ permutations, so any of them would be accepted.
1
Codeforces_test
null
459
stdin
[ "2\n5\n\n4\n\n0\n\n1\n\n2\n\n2\n\n0\n" ]
[ "? 1 5\n\n? 2 4\n\n? 4 5\n\n? 3 5\n\n! 01001\n\n? 1 2\n\n! IMPOSSIBLE\n" ]
[ "2\n5\n01001\n2\n11\n" ]
[ "01001\nIMPOSSIBLE\n" ]
This is an interactive problem. Kachina challenges you to guess her favorite binary string$$$^{\text{∗}}$$$ $$$s$$$ of length $$$n$$$. She defines $$$f(l, r)$$$ as the number of subsequences$$$^{\text{†}}$$$ of $$$\texttt{01}$$$ in $$$s_l s_{l+1} \ldots s_r$$$. Two subsequences are considered different if they are formed by deleting characters from different positions in the original string, even if the resulting subsequences consist of the same characters. To determine $$$s$$$, you can ask her some questions. In each question, you can choose two indices $$$l$$$ and $$$r$$$ ($$$1 \leq l < r \leq n$$$) and ask her for the value of $$$f(l, r)$$$. Determine and output $$$s$$$ after asking Kachina no more than $$$n$$$ questions. However, it may be the case that $$$s$$$ is impossible to be determined. In this case, you would need to report $$$\texttt{IMPOSSIBLE}$$$ instead. Formally, $$$s$$$ is impossible to be determined if after asking $$$n$$$ questions, there are always multiple possible strings for $$$s$$$, regardless of what questions are asked. Note that if you report $$$\texttt{IMPOSSIBLE}$$$ when there exists a sequence of at most $$$n$$$ queries that will uniquely determine the binary string, you will get the Wrong Answer verdict. Input format: The first line of input contains a single integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The first line of each test case contains a single integer $$$n$$$ ($$$2 \leq n \leq 10^4$$$) — the length of $$$s$$$. It is guaranteed that the sum of $$$n$$$ over all test cases does not exceed $$$10^4$$$. Example Input 0: 2 5 4 0 1 2 2 0 Example Output 0: ? 1 5 ? 2 4 ? 4 5 ? 3 5 ! 01001 ? 1 2 ! IMPOSSIBLE Notes: In the first test case: In the first query, you ask Kachina for the value of $$$f(1, 5)$$$, and she responds with $$$4$$$ in the input stream. In the second query, you ask Kachina for the value of $$$f(2, 4)$$$. Because there are no subsequences of $$$\texttt{01}$$$ in the string $$$\texttt{100}$$$, she responds with $$$0$$$ in the input stream. After asking $$$4$$$ questions, you report $$$\texttt{01001}$$$ as $$$s$$$, and it is correct. In the second test case: In the first query, you ask Kachina for the value of $$$f(1, 2)$$$, and she responds with $$$0$$$ in the input stream. Notice that this is the only distinct question you can ask. However, notice that the strings $$$00$$$ and $$$11$$$ both have an answer of $$$0$$$, and it is impossible to differentiate between the two. Therefore, we report IMPOSSIBLE. Please note that this example only serves to demonstrate the interaction format. It is not guaranteed the queries provided are optimal or uniquely determine the answer. However, it can be shown there exists a sequence of at most $$$5$$$ queries that does uniquely determine sample test case $$$1$$$.
1
Codeforces_test
null
460
stdin
[ "11\n1 998244353\n2 998244353\n3 998244353\n4 998244353\n5 998244353\n6 998244353\n7 998244353\n8 998244353\n9 998244353\n10 102275857\n10 999662017\n" ]
[ "0 1 \n1 2 1 \n14 7 4 2 \n183 34 19 16 4 \n2624 209 112 120 48 12 \n42605 1546 793 992 468 216 36 \n785910 13327 6556 9190 4672 2880 864 144 \n16382863 130922 61939 94992 50100 36960 14256 4608 576 \n382823936 1441729 657784 1086596 583344 488700 216000 96480 23040 2880 \n20300780 17572114 7751377 13641280 7376068 6810552 3269700 1785600 576000 144000 14400 \n944100756 17572114 7751377 13641280 7376068 6810552 3269700 1785600 576000 144000 14400\n" ]
[ "11\n1 998244353\n2 998244353\n3 998244353\n4 998244353\n5 998244353\n6 998244353\n7 998244353\n8 998244353\n9 998244353\n10 102275857\n10 999662017\n", "25\n14 616004887\n16 795653233\n15 156499103\n15 531841069\n16 725817269\n16 959122081\n13 362265263\n18 639275569\n19 303815327\n15 889963901\n11 523951873\n16 457793759\n14 412461589\n18 802848257\n16 959122081\n20 690191011\n11 315480631\n17 581727137\n11 146704721\n17 303815327\n18 407890807\n17 218865187\n15 536563493\n15 828371549\n20 935261221\n", "1\n2998 480951103\n", "1\n2999 156499103\n", "1\n3000 303815327\n", "4\n623 945591749\n629 122757067\n635 744596999\n722 924445351\n", "3\n957 281456863\n858 729606287\n921 680737573\n", "2\n1196 523951873\n1221 202745321\n", "1\n2047 943469929\n", "1\n2048 640618673\n", "1\n2049 685718269\n" ]
[ "0 1 \n1 2 1 \n14 7 4 2 \n183 34 19 16 4 \n2624 209 112 120 48 12 \n42605 1546 793 992 468 216 36 \n785910 13327 6556 9190 4672 2880 864 144 \n16382863 130922 61939 94992 50100 36960 14256 4608 576 \n382823936 1441729 657784 1086596 583344 488700 216000 96480 23040 2880 \n20300780 17572114 7751377 13641280 7376068 6810552 3269700 1785600 576000 144000 14400 \n944100756 17572114 7751377 13641280 7376068 6810552 3269700 1785600 576000 144000 14400 \n", "240322783 37198049 263552645 345169911 296238355 103636358 320442847 216840006 68421864 496327008 196267181 526874069 209514939 355622400 25401600 \n572127537 210277549 656238268 265960715 55882672 233441861 635588834 753912546 411529168 265584746 454101732 788900999 530161056 472051140 91326406 550334944 34395934 \n15204171 145029969 134125028 136756435 130614920 63883845 102126746 49880521 109465343 37427660 19829834 52401019 36450536 55826331 27995346 46713697 \n369768575 152077650 99611220 512550536 299809363 139597469 120261895 469595331 531302445 354070773 143520645 456410618 354739933 158937516 185773855 203212800 \n705545510 259289929 236873993 27769778 647419152 603553124 248184212 529664156 626865999 137303299 459929346 270737863 396227963 574642058 73403909 607633985 174067862 \n316747248 180665882 90715155 714314830 42312128 126623215 731615964 216400479 777343278 181691574 128897859 352016293 586774332 621068274 901756620 114942213 666580319 \n227485066 81460756 161316267 108357689 29194305 125472421 173709399 18659838 345582877 57928759 150413474 257644800 43545600 3628800 \n154019016 144355387 267944286 204583605 160807067 544297701 347197466 76756150 335837280 68377654 495615799 112973821 291958950 572639585 151039606 173947051 71848434 479564917 630402755 \n10153276 161863785 153336738 273176080 21735994 207077732 247977289 49613770 297675986 303715022 209378592 254078265 243587281 284464954 267009301 192874371 55519646 28882303 284440768 83316782 \n39686871 130226407 31158935 692841112 804765138 251495100 830355676 812577719 678814253 885252757 473099946 146765914 761081215 615974079 175087497 203212800 \n505682304 234662231 100310068 186542442 100954368 100802016 51057216 32104800 12326400 4363200 864000 86400 \n360603529 59771536 333966467 324757945 270597472 135516133 290900439 174159288 388743579 230050762 251119493 211444292 89372387 370014093 39896539 374787896 252321123 \n198309509 45275737 376151003 173323581 1043681 107321984 225535786 122639381 29384041 238327344 303060605 285705820 407683244 355622400 25401600 \n704160924 167808756 293313966 184780289 477039959 248214507 461362563 153526096 365411929 790527215 134353921 153691008 595775338 680038546 216545832 664966610 404417758 266044536 14780252 \n316747248 180665882 90715155 714314830 42312128 126623215 731615964 216400479 777343278 181691574 128897859 352016293 586774332 621068274 901756620 114942213 666580319 \n6954424 131299509 111187346 328117370 291262728 399696886 309587522 170557419 493299857 337588649 498304428 469576596 577226621 517194451 556759788 134545045 485003549 376712511 581085521 12631609 35141131 \n239548939 234662231 100310068 186542442 100954368 100802016 51057216 32104800 12326400 4363200 864000 86400 \n451245988 412474941 80684296 67053018 365852155 197484621 430830493 246096912 151431570 259476712 38032014 392766759 569747946 439625376 459823404 35586903 246836526 88143175 \n27143451 87957510 100310068 39837721 100954368 100802016 51057216 32104800 12326400 4363200 864000 86400 \n165309793 21891229 253721721 84017094 196708997 138475967 68620505 90034532 99054272 295804588 277989758 110483505 204721581 26063830 214871463 130282027 163343810 48185904 \n365318575 265368383 2501597 326768956 319837581 167004838 392011533 405875702 31863449 273809724 279603427 366474649 185676384 373097748 387750230 389062822 291757065 20619723 341054546 \n97344562 210130768 19226434 56738575 207771994 83485135 171258392 93898049 184502756 218394755 128970707 123966982 145030168 72473699 112611784 49879657 134260697 186219258 \n471979185 67142604 11189714 505844477 374528910 211341652 459658441 244925417 509261913 497009920 338101295 345345918 215996794 525493745 162161735 203212800 \n466493591 724221444 685957024 670715304 3744829 627111435 605801485 385341187 631677679 659523758 164292253 366376057 197830292 252670373 359864553 203212800 \n206777298 482488916 295929271 262906285 538093335 244812836 275090740 81133967 236727036 552405033 803718235 546574069 479659386 37358448 848926122 836339126 571779537 107821166 875748713 775794947 646709541 \n", "197759893 302682484 336095321 291899624 339448280 432653111 351496061 252765323 186643140 312637594 111203065 317478554 361710474 309977117 66234983 300675554 432427522 155264848 377291647 249511671 385869905 223588383 173029973 475669717 109087136 130710646 263828080 436695391 92462561 400134350 296766776 422133487 387171068 39182053 226847957 438165742 356344219 173461948 369496151 82408634 81598325 119024417 448208218 34337242 226156117 334906035 28563791 218245286 402775489 308709678 196266260 237005499 114189755 432413995 348452119 402310536 176251373 214064264 279608794 201240336 45145885 29912136 382368522 4055740 29521022 199969178 192564849 260861330 162032337 396468687 229510704 441667175 379260677 256184963 299773078 280008377 93694761 227626787 59890426 284503586 447973301 201112730 87402082 342955175 113524602 17785451 349453647 254496024 217274714 35198429 441876974 253506987 71962951 103067058 445856106 4622181 342922312 17267219 23597032 389075753 443762975 114620660 100674309 278553879 224850737 300591650 76205902 390272602 176723163 286572506 155478566 434731334 407088664 188938811 348694530 253155986 193910082 372268805 388314778 96334716 321959669 60301070 452602045 76801188 382346812 368318224 52711512 171121121 389419327 61741663 237677673 267058301 252943502 234322680 321286048 302497127 294425715 475105362 78814605 257941269 214233761 372589708 42428718 48779627 381734638 112465560 339246927 390126364 98685633 247458524 147646642 282343305 470633358 200210020 227755263 475345481 321666611 360806598 306708077 11306382 139063447 297624356 182892479 209842759 342111381 396635293 83077389 378730381 446293453 327722248 90926113 290050818 181400337 290454189 356779107 363685070 448611494 320084175 217151012 228378306 321035095 307559386 51751767 440435344 393779701 452242838 271312085 22817178 394230269 275832829 447353753 29097422 279270881 233327407 364721817 320691132 307487494 89069573 38902505 230714140 423426041 354715466 380587496 309706527 355433823 166781092 143419015 63123854 324289417 138838144 444037040 400196393 299355517 326793167 394660841 86165582 358064833 12398967 211573441 313718294 82545767 11483422 399156429 83992343 61047206 431133720 208457537 320970382 306522033 321216680 97933701 131024601 238298091 172836965 9253596 227462230 60349931 378764520 174939695 123836940 453421471 325831475 124704230 259761517 127545299 314536661 33845775 66993305 213460124 106443675 179030092 190518155 111491410 9479845 415363491 304635538 286777787 277700957 43901496 419492669 90943281 11627914 446276808 292777207 343328883 463289180 90478524 324843325 141871970 115611288 365606217 443576662 183885654 201680780 337958341 108541798 307868246 277923662 217883744 364013103 436755440 356454866 367488655 386957231 446641789 375746699 422998411 68156993 431184049 412965669 230376093 110890385 46312085 6686865 172915366 262465026 171054092 198567848 447245339 67896268 368112017 133551170 269963561 30456619 76979727 289992486 75615434 55761027 68119202 124125562 337118503 109170568 7253610 349179843 112689247 180227779 83671040 324828105 371493372 357660827 375387598 465135090 13217024 466709196 8568808 296878771 197259126 431789508 322225652 367092003 427164172 261945462 215470324 385552206 410624298 257109566 266642560 232309868 468477151 257526089 275542006 74137788 341439367 296034434 472500543 59025818 339758829 154272384 137791182 75652170 171980447 263193980 295322156 112431034 23950372 195116806 334783896 470288293 25923818 392308470 215981960 298772273 228631959 260840177 406197478 134466667 399929292 17649076 58237705 405828508 266542109 176715661 258263733 211243058 214035139 463882595 467461969 68757355 386355044 388824937 352217766 469256147 185951713 400560659 264757524 163971447 278813669 422636005 265361089 386195895 28316140 471292853 38163480 93828351 280908778 232956041 118227993 228679355 56421446 49372086 351907293 424995702 216439237 240264317 299310094 251528432 198630610 296343843 16974472 474165025 170325291 50680171 344877839 30585535 15422593 434627515 127077309 98293820 86981314 457460791 365726258 266942911 333650227 297372169 381409218 192730046 199058975 158441400 287553557 46581673 263913790 208327843 50000167 195175892 169037955 20341193 402542641 308215495 305388995 51796624 80148370 54062483 288398384 192843728 312017520 468696635 400194676 151550318 183401242 12124823 160991134 394740659 184292831 320916125 105294189 159423735 323801155 23459346 52569368 360678680 357048564 347732032 57513561 185029251 281232911 361183563 230044843 417747530 24045956 223725490 243364875 9891856 378073108 68717582 366964375 271801457 106713337 302261958 226663280 476651293 199841052 258831529 147167467 273856974 164133897 442022374 203681532 139151628 19634171 447872667 161837286 67907824 329863247 209439212 130335225 358090997 269722654 157838941 346459935 104328838 159533873 100515598 125159235 391244587 112684897 366094014 39465243 390038301 396949575 152550067 162888623 202681319 161919034 247397499 282545064 462889166 425124150 291905790 458102645 229134563 248994051 152275571 174293193 239643265 308292836 199121641 386035332 192704373 107384867 286595710 84198345 38253655 46805556 205831221 352413920 107675337 133313713 228769266 315100816 420173685 78567686 325145563 358739213 362739334 148922726 169283470 269336404 90449805 219543609 208943151 464122883 336028248 333795323 368903715 351529690 241169484 408526493 367762262 136210376 25983741 49907058 264358859 479492016 113111157 131727151 419196870 344565871 35784659 241097167 333535609 336833665 278923940 131258218 16811210 376322038 287941646 318828855 214597616 267605782 48395526 67945506 238458887 96790476 231728829 165152912 431316950 280866720 386075970 309116947 332139421 240921760 259854963 128687136 43976727 354121595 395502462 309071836 156536871 249703674 270281995 69140966 363707550 47271633 173660299 390412985 237392196 253146639 241386954 101064122 356174737 314647594 230911607 465534491 208302446 220716127 62574986 405667031 226135115 452034308 287503926 110241959 440360413 323723587 269760323 118108396 105194304 40903473 171035763 313361654 94067559 99891488 34204099 430144036 438912148 42897923 318473715 144531614 60787147 10624987 119224564 149814389 350219028 141852069 354430743 414619344 128972019 99072100 327109263 198836718 92233489 334423528 116960493 400491137 43309090 399156448 160875840 322478179 248087573 102345187 173121445 6433480 333652142 82877608 215982204 428828217 95703971 258242081 104223105 256599762 354574797 6937215 90581632 227090702 214976961 290780295 154320387 128014396 111050425 247672529 57795233 275476886 25922973 67002556 49922457 180878955 360165816 293749799 212947684 404085801 98938328 331806002 240325274 371310215 20486140 393346833 314420591 197921151 275209150 261188757 194239960 92880760 17135470 374618242 254694957 53129169 129601627 446012820 56164816 275393025 49482025 74198120 71420630 41183420 424967004 363434882 200249145 456472841 137256502 149319700 258462838 368781741 76907506 282194142 85979429 295469890 263376727 277510135 442671858 11538518 440690104 124445752 118310085 212026530 334480806 242451313 442124222 345113838 423251269 27507414 465427257 164666883 257210151 122991068 202859048 447614208 293778388 104755534 258910463 149481088 133692152 133841460 176923842 471146025 457290021 353021406 440305440 93649733 372287020 265635566 459486040 469138350 96686026 467499658 235270735 133236750 67483373 147064651 361298154 283645877 215966950 363886636 355886761 215884145 269566912 76580689 138217292 19487731 176682528 435737468 424148250 58507240 79077095 452904674 341829474 395658314 326058108 173926491 17475775 150312857 210690048 469400891 284523536 351986293 266760307 337303598 146942509 356338759 254671559 364236444 246652035 422786874 395917166 218310703 360400000 190341958 57217019 403755929 193643573 336599374 298224860 336493791 330954420 390756276 25681311 439365424 187167767 195820804 210630588 73111437 439905095 362739755 34379045 315142365 426841753 84594776 23518905 67618933 396232065 17855953 183812742 103853145 323943862 366773991 186467902 325703518 267743300 468076643 256282322 235949901 5878468 231485017 353590669 60496355 233410273 236199665 104143661 17956971 138946322 304986954 288856833 389372879 366067805 64004161 28601757 148522364 370512415 309486739 282583879 794432 25626537 385499102 405375123 356740000 77201212 157791924 163768646 265808914 191813791 370964466 48755632 334075674 81684227 105452846 31825982 177503090 166478116 411047516 265430636 448266138 361174988 142879246 188577721 277156948 70925144 158967314 288969678 280908987 169430701 170908784 64212060 392321072 115630285 253969227 70866005 108551950 147427679 359880545 104381503 474240552 123538301 28103365 437036123 469240439 390681829 158095737 52873679 50482661 337936436 274332527 426727154 344643928 80376526 402966714 177184088 191737614 417867695 254847013 305911715 139810369 305769468 273737623 356848744 436353193 71892766 284312382 372586231 74928686 29864153 95183029 268199024 159708215 383921787 81633270 32328848 386078833 189790829 356305189 292004021 18929367 430973797 212654129 56845150 241101363 157354941 393162141 451408430 462527553 68138003 358068327 423673617 425879383 287983539 122768347 259933640 465818490 17667243 75559614 5383213 381043801 311194295 440267239 211907022 480273232 195094324 326207310 69526539 395096851 434675118 359156066 60458439 417214011 11009808 316689978 341832443 400985445 318905447 186742474 221238374 32104556 166585986 405919376 52489486 31712446 143803087 300202116 466981523 181890086 344747969 228304934 83750365 444535977 232615107 363848251 106635228 354168321 430080259 146894178 72630483 143863937 329498035 392005387 446495550 458645000 65128971 392035541 165766811 194998927 175614556 72698603 188729963 475914014 155652515 244465391 88850425 381687100 372126266 393271952 152749711 405739174 237429415 108327933 69716621 59233590 325310851 33983688 99193107 276062714 338124734 380080818 57577699 34711546 43399594 399809775 428595085 464479642 361166143 15354496 55103654 19287777 168886032 159886541 403183732 212483044 140362248 34198878 260694773 149425491 462508130 249928566 61091965 135835114 10427725 177620091 241258589 421834192 364094915 330398738 87106705 216772038 329120358 110925709 295947944 145184260 227158958 231979760 292676776 146374239 83785934 369271355 218911808 327005074 376180712 124678156 38519790 219838549 9983658 454576974 335946828 323236360 122499422 234703921 278222429 95946576 396270458 55765793 426313946 382544594 449250744 194457816 41556822 5840818 322252463 122299038 236819679 455502026 22780252 17673375 75830681 345249108 215262216 455533594 3528242 445933227 169190454 449968219 297383975 242562004 104694858 92390275 471346057 13735460 67729770 235472111 409407685 351208784 466862584 445602858 34726111 288524655 347025893 461621830 60544540 111818103 57816639 195255292 32223831 418187513 321329143 93938636 176680662 479968925 293930900 307172758 161245218 329750268 307059209 243604706 232172944 52492098 322648593 176715845 367349215 405004055 40668738 157505451 413563122 195215974 292791582 146688283 371486506 479391049 246799300 353345934 164424100 59237369 219850446 205041264 364038867 473813369 54814827 269765397 437594778 279067993 284150473 15808376 183147833 250845593 30295690 149477584 240168578 118208358 248653903 453190113 414724362 119586958 383255295 311963940 185478673 192657598 292793543 69871241 61161052 258230440 264150253 122059540 342702530 221836401 479830548 224158166 424121834 167712622 423846144 241167303 448474144 296582492 286735555 104394356 15202197 64701671 387405987 431956427 15913223 351877833 381094921 30296067 201516039 455308084 282976382 427792042 478317001 363280523 94452633 42978293 327319554 465288542 334978749 460448735 326545471 429003669 231510352 13991306 3272724 282849199 285253969 43350252 83619365 360485775 280031967 168922909 293061029 111439141 329870393 204782879 422995105 405147776 209057852 81801062 182212492 333580155 165936403 145139775 109431705 269325565 1302834 204269893 398302023 381062654 480105540 327612207 124673554 65052149 174147613 316691996 345216742 331037520 245228877 76675420 341838582 26089611 82150426 402553392 446001954 416708536 262405563 297087775 282250924 327066517 432115570 207922310 64037774 217845779 31352940 365944469 69666354 216807707 352430738 397559653 55663732 318749762 223527982 180073697 444339949 13710911 226022684 208460958 218987782 438571181 434367939 58588444 446950848 401612774 179081820 414960015 235504223 5115022 188351828 367521232 104964568 424762300 34277438 345027992 145166130 146405503 438491446 38050200 313004888 165125384 51583110 387004660 287319534 58020293 365711441 1906605 86288977 414161252 67632876 274434271 294728763 234196065 193920194 18159437 327555838 124671582 383698948 139622739 403942603 20377304 77707429 471345846 237527523 150971860 155721708 453325918 92250412 443987350 17495325 111478385 41826385 129306903 83439590 212317799 119363027 478802804 284830884 388179823 296032945 430234034 25310764 312141195 66981196 61211311 136530019 81198886 385987468 193964165 78894440 327337954 13225056 387987047 119790380 29712445 372919722 404746215 383776717 216734922 384780824 247075778 187140999 438247026 410204690 172265344 472429361 346401576 280607317 331781439 358561853 258278194 180604868 364937560 220106103 453106426 310935648 153852661 458915031 270160488 343030559 430946572 123340558 263148404 421744793 267009017 228912307 68642288 175300808 152897720 81997117 448235805 102165694 355453006 233285480 69020831 374444857 10365533 35218022 408326976 471320803 413146273 171223719 413369186 339142719 389756377 204960505 423649303 154784666 47355151 352109735 125031621 173171261 355845311 179023067 30358811 447508488 198687459 34490681 61575877 419202608 234361975 325972348 287762906 415871271 470461093 284176945 297835408 387765251 255157308 70490340 217402428 351075003 441545827 76740445 55104803 43159297 321420701 356105828 462281770 125124557 234816920 265012989 344469914 398053053 460948743 309189476 280189377 354240230 417944011 186724669 475490015 273474868 295890117 220765786 330636302 351151776 279164315 15859651 464943506 234689223 94693240 183187478 154207457 130163761 403744293 47224672 270584863 81446089 460131681 261856675 118879778 139745602 88751275 79993444 297941971 82785299 189127869 339724495 450148665 149879727 144976075 427772960 93077086 441082076 308531630 440042359 466188217 125255739 146870647 49135034 449564160 456603637 324412606 426927388 57461495 283241399 365134979 314586037 406824614 477553690 347189406 345150971 325814028 158860560 211193129 232886150 386938097 87944648 404797728 314055062 341144972 37030133 83546109 320182729 140269042 383714774 117602648 60591195 452006879 453919060 90558486 6097985 236167983 148162333 345654348 29941222 309074564 478342617 246411270 229701881 36715174 133807733 255611547 358205606 42528465 112033396 230240776 106174125 102568641 157826675 313403661 258782030 23204010 139821198 305574797 108765306 381295227 252048690 469875828 347023929 118670406 468820134 293139055 440680652 180416797 376783501 159262405 81024959 404712910 141445756 337163433 189340116 301719223 13586691 157491639 358093624 31934247 105645468 185488283 393928331 41042327 390268373 362015116 306401599 84267410 75614126 371469888 44288882 469816602 183481706 363628555 240989784 2158108 359909376 216957346 315133055 383395099 19707443 325691548 122796877 63289096 48417389 329830938 19927325 287361523 166147742 323022131 310945998 402100360 99080902 275241614 352355227 91140593 377596107 470098806 84019710 434218726 181288549 142186032 287760903 446137412 457946329 133207900 400310886 187446627 363152271 410758091 38513828 177089708 200732121 449676965 472416508 289963489 411704372 390325254 56336082 441460070 336100337 402346741 392554865 254418107 205331499 314156795 46664109 129315868 457201841 409549905 405156886 330808398 440298641 167358366 197035592 259581985 183401208 372342932 344786148 443504530 73609443 222745 168082527 419218097 71548561 193990363 380910717 339226132 298733262 395928915 405610858 378105543 378031612 273092362 216206011 82746702 407903103 374738334 236753032 172391031 38291058 164687237 33864329 118478466 296956025 132842419 164439135 326215880 214963826 81663249 234680359 273988309 177263218 425173221 211136427 223737186 153363416 315841635 170694132 433596024 18125112 145394693 456954095 305441316 393878560 229753141 269662600 303556951 422689327 457475486 359969562 265449185 173041822 130038425 400026115 433004226 38996695 27768536 458280008 179283257 50598638 83548594 6631775 54145966 176675434 227343722 297718319 243413591 25208375 435589455 315610512 216116541 68058006 173140767 321295701 107877879 396413269 293977782 474751743 66094853 272481646 109890501 200890434 271572397 195153563 164408256 342539764 27604433 156690567 165366473 425693647 397131543 38546537 457996571 284705615 56595943 435098423 416615761 83127891 473595993 40768918 55319768 298552923 1115435 10726787 222815379 446108350 181167275 6199307 278657628 70947220 41000186 15626726 301159774 478883050 461345683 363945463 96945953 219267736 344582090 249534695 221602405 198669115 352167969 96323116 121612708 324474694 4542091 292887757 47472491 295790677 60665665 242763512 39394620 363469153 172410788 226026535 414671196 479411822 133131349 144293074 402263283 436077806 270685552 177717804 267999993 375090377 330767598 53289880 298908545 243582762 1733269 158699598 203630416 98016419 86685616 204857100 144260715 300447804 104965162 12872836 399114358 136442278 435230604 109361461 41849492 19533309 323209304 111226606 260877919 366363935 454831838 342736366 124986124 196174030 7430255 217412750 145254492 437435941 165792428 138412731 90654105 161280408 69312314 434829936 263950311 471632850 296671346 221004455 424678820 216119919 424785611 365878913 289632575 301889261 33203087 156000715 360279414 187508397 228132032 55980157 240524899 439074797 333782138 208681681 412706838 346463467 474946893 318894349 273522175 436643281 60078994 193427776 228830139 426593920 328002358 379083867 65085456 247954487 191906833 23164710 100832303 198985556 231562982 331932778 63216275 53877880 99212956 133206217 442725614 44428671 207698093 473254902 314910257 351017744 313360476 451224903 401103028 217402414 118557501 458781244 353177106 119073204 62031208 88203221 146956223 68738064 261422513 133178097 283088550 187600704 166871153 75539061 151940660 15968434 288315199 446940237 348588749 310762651 272816124 439651806 282881854 216572546 414763491 273242540 303879130 350045876 322628648 61510104 322917015 38180058 418496425 155282648 235777437 155263521 135504420 336548989 296442774 229527831 105614551 216883803 114585757 473191133 12252506 32398204 48797324 382326192 70723131 200916308 294855408 220374421 20028889 260058159 385834428 204688148 133476757 384625898 226401938 477903971 134779894 187825823 250735396 257340610 162016824 157424602 400075483 123951531 275800330 60248744 8860081 37841508 437584084 363282161 173533188 312208850 15697888 452117258 125166205 143760455 70669993 24953243 221686134 165594733 186573645 120053624 340680482 296605558 152776476 442505525 296051688 223828582 440564987 445147587 144086047 220657931 109868509 271737469 238288274 403702918 227217249 9698330 389399414 169946168 439107505 253076026 154383295 93164622 421052411 142924651 331133577 287127646 122382511 409362034 72688322 43486504 341056918 389878492 86696868 114081234 19415803 333521309 302971565 40848192 372156951 138639336 52003551 446046479 330197291 340629605 472670275 427026080 319643411 379309643 49247871 2309212 222186602 237505758 438112579 356784230 211864387 365808822 138368529 195855115 131391137 348152936 128858132 412597205 331411546 165595466 13580821 433527655 252411605 282809912 296203353 159194665 191767038 358712125 41563466 135543196 318769626 145080464 179655610 431952805 40733478 131766897 27871080 69605425 427634047 122105849 267431103 233700982 221673619 49216734 312848247 425930853 235914826 39598196 231240731 185572246 19963849 87681486 35219011 373960956 212186274 87998860 5640476 353399910 475323012 63488985 470457830 81885921 250464328 130136101 305927183 102603433 445017588 336502054 60485530 93870614 343764146 375700878 456622348 109628903 469090346 53948256 459405466 260366905 178161888 134748229 176826963 218884340 49761126 314234991 134829495 472496121 409881804 357696813 272415692 316388569 431573342 224433992 469679871 132954963 34707516 119682589 401077717 164540756 18694550 29036727 160156276 68921710 13521489 252733435 138628451 443749513 126152816 361587884 311940601 318223870 202369843 416325342 226111649 99119194 419369954 460211564 106564848 309099664 118715828 411368508 238342702 210498552 444791681 294969202 122126925 465491320 363689927 226304124 2503405 7306052 312234677 171405684 205269084 238035931 59557732 88548251 335805363 207694143 194017843 156795461 16879590 399759795 274242660 315210699 272976996 443411002 190937188 480748045 266410713 132743455 120208684 186759257 311668213 247282194 62285722 41523519 337691486 361072792 402180982 208751186 34768034 68185431 186505085 31199308 442307987 88375900 305696399 378643022 104190522 282947698 303233435 163641064 287141643 355230119 214296831 217043836 402877431 266062821 117200057 142496309 107323464 437758779 313910619 233741177 266384215 151397156 154137438 59404974 134691339 241865075 375942792 420785516 12361532 366065502 227429920 298948653 319970445 226458959 290071734 238991447 132051965 315859539 216425599 436634573 153731873 30964757 229687761 297083636 66926675 6964605 476800564 143566402 36634062 256642768 427119111 202785937 59808643 448685042 144766792 278348274 168385636 191026159 243819682 413724330 432234377 158857638 383867946 476609508 245897050 423139860 337366267 169536472 186228170 265750675 111781344 284858123 445038391 240332162 361365934 416396528 171670931 172697632 56762797 330829514 25877836 473504098 277736078 301506760 191151272 147897683 44955844 92410736 127305082 43560899 321251166 162516462 333994412 414010043 391723901 157754874 460002477 415876075 6406524 144463909 55666155 321414075 95458555 219112166 332764315 195368213 235394222 371642064 306106700 284414861 173347472 196495557 409122294 259826528 182188639 380152402 271014153 144574165 209623780 202265986 476489816 163691996 60996919 472707888 35356717 391621927 360711015 236673545 364019837 94863834 370224673 144681923 10415187 74490460 361815944 21912605 97359188 307345527 241613434 140337433 383752184 290350438 50860420 168362196 278215365 417712757 431657981 436617369 78702302 99168228 448727194 89995374 397026213 456544712 426185666 346147031 480754148 322229739 312219187 371450166 52781476 161754204 250734391 454856457 139896912 110948075 340100607 93814662 415398155 439480440 141368172 380027108 307972071 317061832 206416775 234162318 463565259 2483575 247793260 63841784 86158807 45574359 351918286 306196431 159763032 162600674 259651194 48786703 163810225 330086065 172436718 412993918 452981701 113222532 59431695 452848380 328069546 441694145 368492986 262268818 283245125 148046315 340690125 433855082 325968415 458610337 177379598 277824099 82187992 192246653 355607785 188853003 309865657 117392744 224551266 242524426 305460949 337111215 49799572 432009521 242725867 441390090 410613306 147488023 439495120 148608553 432710059 276772392 405036464 55876024 320986142 184723651 136149027 252413703 71774765 341109217 236625947 315415197 250244097 472302106 280663838 339499503 403701740 90016467 28162736 109831231 12379686 247046485 411650964 317313211 228948589 320868510 265709064 29562038 357324443 207962857 306667334 377924368 261770485 217932166 116674045 71469576 194206540 480816972 467929314 305520973 350725928 67009314 223085268 108885621 219366496 450993103 290781515 133323628 58719145 225275507 163074240 385337617 115891690 299710738 447649524 440263376 149052838 189797022 32908871 364161528 226664425 358206329 249024056 251108379 131990100 394257828 401972825 454289696 84338133 10144364 278634571 55058219 356681402 302859557 338613567 298383744 224837812 272536013 334899547 121658158 75831919 239154711 170056222 438326518 306685831 359136101 452590801 206369506 269181624 387084386 396130274 45362486 94486606 19104686 354767031 35475399 279249495 59826711 424145614 358692583 241831004 371382509 222011539 101509783 99763608 401556318 417156379 176230783 314005499 461248535 171881935 328106272 202921229 379676327 18410651 442198199 150864055 12686146 12796391 153942598 387756294 348343349 118862219 274731180 108194153 103294365 189933308 204552573 130328644 245429825 262333793 67623422 185800277 394371680 322260510 313181642 413278157 144412781 374199852 173018054 454289705 102881938 470145109 465514668 149551946 158511841 436301036 175521558 263291949 235907533 109683003 381860596 381142717 150533693 285047222 289441317 430416869 470386469 31846779 439535208 56704533 229693412 125600118 449729668 12322545 174439343 198384955 3117843 83878656 95432072 356068990 295777628 22450446 126400076 431891193 228631127 234752174 202389348 161221542 249013475 169609736 467460833 240883679 217785109 52495006 69934615 164485296 335227606 295356062 452134489 371458223 18334808 215513563 364744975 411093787 181651949 448194716 300690682 97804482 401341195 142464316 392875058 154491015 431914635 103063711 46167936 49600838 243807566 364339371 46303797 9962132 139899726 435999286 25377069 227639486 180434572 291590180 167215808 355443409 382093613 79519680 463439444 81513521 24489290 375757951 118529374 218116637 411440591 99801942 401629173 17213712 196983700 158987445 257715733 415452655 458733932 235841597 403082619 364753158 30183963 454956032 412790397 294270406 414506148 125028673 441300184 208693958 169806313 400591601 78078205 468423987 323347734 20429098 230824907 158629362 474413595 394730117 305871695 379029901 117260506 414475297 307812077 222178390 398413097 168004518 371060325 84317417 218695969 416852655 419981116 31785694 6722279 213185556 431429174 394885233 234714340 244299240 240600591 256522876 84521270 214406312 295911127 397517451 144775103 443444635 470172094 351160376 463738752 384878695 253682852 286549640 320614801 106010984 296644099 322928324 320874555 328231232 242777450 421232259 275883565 390821375 436326236 22117554 131963702 211636226 173990395 79863388 266425611 423835212 255861981 105101589 61027899 40566832 454806675 120784596 232621464 357173076 401419311 423764018 198908304 442243730 307241687 118358124 393941597 7713311 368410130 463506132 414629497 137919787 372171496 298255199 442905838 331195642 63596272 298709658 460723589 93231982 264844181 427369263 195324651 159945308 13335971 120281425 94463461 177330629 285728652 310064011 82202777 411333123 99195902 372475462 55780174 260304321 407167415 479500212 34964555 136798957 62588748 438821082 464531987 175368867 137150219 74094439 255599027 411002589 66258495 466627324 331716437 66751300 4809787 4673963 332753280 219201470 394976270 361634663 410433410 404942997 471565859 224125760 95532979 276650400 398170957 74678485 456623813 172757958 44488238 385552319 391346966 229996886 138083846 318722798 166092344 63027910 425370452 19698061 234930321 219152246 156376895 302205932 10038912 389626106 51208168 457899323 287647503 75309168 249727259 26344240 30635319 283975691 71536834 306417056 434154629 223234516 427042527 134071227 396591265 66168186 314831987 22451776 52991992 136823728 311257064 389743704 52863363 197828929 372454103 159655222 318976196 203095597 208799618 102735173 229785454 203021963 359960163 10728565 325199986 197907437 401159639 219773578 413621317 108173994 145868346 241697175 321611918 340829366 455859721 346116413 268065870 1582135 358908744 206169717 380566971 223739388 125235207 265878649 359900172 430960670 246643595 106063100 273849460 469628177 250136892 58804320 408111487 90571983 288537297 88802708 374919961 360110745 180757724 220665623 209955455 41629634 62050949 23580280 248143825 278432277 212005176 477878963 449652711 32971426 472894615 388619480 230319168 112327160 55732073 261161738 358934117 175645597 382523771 48664552 222823247 101279812 7252314 156821591 354776123 266621971 266658157 134102409 173189422 421541215 390940575 137964089 360864714 154740351 422818976 233913148 94036220 446023903 27074125 69283252 150584074 325772642 28575768 373097073 471596499 176482843 114785935 183940973 143862342 459849401 163313365 203515990 26434066 281350608 207041655 355627079 83787870 469967055 1455773 18866052 437159618 369512909 345074484 74950294 168367541 300920847 220626874 104366803 477350960 461003508 275022355 366662372 154373110 9931384 276463203 205924168 371459554 205280530 475985490 46151032 87258783 450043981 237197894 231437466 470381355 379304500 329859440 320893080 443188777 297735333 445334078 40264550 340456184 277056926 68995797 466875948 358281322 21357179 59000009 238019109 409063922 449856963 246426348 53845697 438560819 343053037 473992966 310990470 186772038 221085521 148724659 297276923 274792499 42468927 361295506 11671039 \n", "41368186 87099799 119946936 66745044 124624721 143014104 1628219 39755562 91753242 136109392 61610310 154038640 145006594 61155972 33314348 128270518 154714032 32148241 104430869 43515506 64764736 155170045 75200057 106788092 149509639 40085721 89071062 91409213 54072453 33438670 13728385 145613223 81970283 124097975 5954536 137246313 38236037 90839104 81280258 134704093 10758898 21467319 109270552 115335441 123729472 31185717 5444096 99853620 3681555 103490453 30672653 36240068 26830293 71505394 70356243 74985737 113415260 111963052 16531997 92585824 86860388 114178813 107323482 93843719 133011916 99652015 140442952 77009782 14192418 58703877 141479871 32675904 17627842 114334259 121752768 102226388 100907722 107102543 37039775 130223459 93080507 44436725 94663184 96266205 7114343 74901394 90549137 3620098 222351 8369348 70841420 53019748 61005654 28255049 13944474 142243883 57676767 54432601 65547744 72605750 90367481 142211505 53609255 102067655 55125606 115163836 47651330 76913840 140825499 84535230 152353254 35682598 2218405 117991115 97515831 20651544 156420867 150062564 9225305 32356904 90710634 124513253 153054228 149804240 67572939 15865782 84778221 27727140 135833857 80810964 49912287 61024670 120692319 40335539 100463821 20543527 96713868 4681730 57234038 126909048 118716423 75743877 147781577 156032625 93050600 135640821 56270111 87331601 108817815 76260184 141755673 2404357 51453090 21552482 148112407 146699916 47451814 1595840 72210714 52269059 645889 111073655 136557987 61522801 70679754 37641056 129431294 98189915 56994032 68265446 46370514 24611999 28060952 51852042 63000808 52388954 92914640 9921700 114256794 124634170 80474682 143110114 99614706 27713410 70917547 148387179 58529540 131694579 156240977 90737601 134001889 137648371 92115287 62137000 34543488 67553927 140024172 151538124 144479435 111167501 95118647 95996448 33594477 74087094 25833632 87801279 144980638 83823085 156117988 142771681 84646782 24827371 103144606 138974358 14398319 111192073 88004553 123637414 35293843 38933798 127789904 102893602 73645222 141666748 2446593 66971533 37618354 155488826 155014504 64120399 133886269 112552947 87715687 98765786 63363581 18148885 144134631 60268132 91465723 24918274 71900847 33446218 27919589 126469805 99245141 32383356 103784126 21795529 97749207 120802772 70358217 3294071 110557925 156151693 80396263 87742628 91358201 49301792 99156110 14439 46261762 96389233 68033576 72852873 49737991 153565141 56507670 76767734 73508700 92052305 6858814 114192806 75932935 57069752 12075155 45868892 146372047 118605936 14649113 83923750 106122798 68667002 95851379 39711242 11339504 9104976 148483440 138554014 33245444 74606224 78943519 114156499 40309532 123416723 13372640 50514205 39479827 93112645 113837929 103828417 123445314 26342928 56502283 73151364 100890959 129569573 36391894 39238456 119929409 118674952 115197678 30163669 136209136 69442185 48654117 120802742 27227279 142841590 74912810 127311723 104944412 58614542 37021734 29217473 36108621 1522037 153111809 141392352 132652001 10626757 37419031 96438906 96056590 35840507 45855070 25255647 30143090 24659069 18557573 118093065 37100749 75174391 114143741 94004886 45595571 28663870 134290942 30513751 72896019 72147875 25718401 48410417 3586656 20818631 15149984 107545463 56610284 77540163 104938784 86004968 53534035 39942039 87794897 54505071 50385722 51214725 51278624 14473265 103557163 10515694 45198577 109502450 131648817 119856111 77393121 141370532 45333517 102671 25766581 32769893 146240062 101813830 89997535 79441117 107901326 51921321 151533911 42264513 14229759 143287532 118927293 78377807 148972401 111444253 99552692 97371873 139743294 73417153 88815415 102524845 63482842 70414485 78069334 96190309 100826339 107988732 66877282 21184147 147757910 91827509 85531220 140117944 156372923 148014938 14427755 53287776 108645355 16067739 97389935 139718447 140026510 126840748 155828533 142016364 73317392 144822111 122291276 13805395 48815133 117407246 18435697 113820781 151167303 21414087 142773904 65586876 88564454 123226469 109899735 67454545 45969633 44658481 103578241 7695999 133861619 105560840 40356078 89872757 52700606 80324884 67288568 12955460 139987393 136383392 124605529 68125237 36155842 137951172 1629870 72039675 94526020 128365331 92462624 79701855 135491301 103266182 94538255 87120434 73750792 118741326 155738281 48532009 97375294 76367749 151781471 56005489 15067985 3613844 42787203 134124964 146063018 133270328 35930887 145792389 124171532 30829491 152915517 37250063 71332022 114621666 107389165 89569784 3331548 135462447 35543270 141442192 145996658 83925789 29529250 112698786 43667642 63427893 63284212 137567467 137483226 69302300 86814117 61001436 54715572 118173375 87076659 12697674 37466119 25614010 78402755 14945061 108194785 144115545 45401753 129429967 94172448 91110751 85091236 111691489 40491552 2269065 87100607 143726265 137077053 105196734 79653668 43343044 69606929 30537081 121334263 33160311 121966760 96743221 66507825 68333762 81034984 6533148 62865647 53818273 87248067 149541426 50138234 11690884 86401269 131727822 56465818 29138419 104613543 71353867 82274295 20245964 44291711 133366551 41367174 53344236 55286989 10946806 27361806 116663594 137470387 22933920 128046358 92676299 137973486 44003407 4672285 46356508 66903291 98960859 120072877 81738583 10650127 133278101 103357860 45985134 71585391 115883253 145237903 136236573 125842477 70769102 156177637 86638757 22634743 130471840 101259783 144943062 46048023 76522039 65481016 112843254 92096536 88194430 49722991 89570597 71351199 101301460 144927520 100401560 127449385 100167850 155784721 154895729 99510682 128139880 64546648 140709370 129802810 114556609 152853070 127743825 10252436 14824210 150728584 139756944 72700708 77596454 23743585 51983458 125948057 15311964 71247903 145651551 99210002 1070873 39197667 72153931 144680740 55453195 119395396 81580868 1012318 52347671 13653168 139475549 144758634 52277101 49900070 21899034 54631953 97545821 76188859 57411065 112051358 122304852 47159630 67059050 54627796 32431720 83964873 130037995 146636220 135876280 82028180 68392168 132802711 40803829 30772162 102806118 88909762 74012658 41484718 144532040 145546108 39168108 115111560 47213240 71131318 20017340 66043704 51516131 63219807 136517051 15713522 48455783 95646877 130320998 107142589 30294998 36558556 70378427 7819156 34162018 78611497 108302819 20362137 81917697 76391768 100990352 14852098 143227232 116228944 56960028 90977075 148207380 101432177 41867598 79896775 59374774 30957195 105389167 25550784 79220555 76167915 110605663 120575946 77811200 54588968 46337416 111016090 4838498 87895637 149208087 147357934 101542985 72958901 106593105 84374744 31444678 119542478 34658311 21984035 147653591 79710745 12527088 98112947 151891584 149476637 21301940 62302642 125496300 21185212 64750135 81927176 58754256 64784189 82433543 89586305 597315 75594806 73384130 54809007 107937959 117838711 33023453 83938419 109180478 151879256 46857258 137933094 108151284 124200342 151219780 58135884 54030895 121061134 64251748 135874934 89603363 21230251 104560327 55300829 24712340 64092780 32062018 135271443 2050003 130588748 122500717 4928867 57516433 86378067 18518171 103013234 53892673 77846348 132608601 106683799 15822376 147028729 107874741 142299492 20801748 19128989 87994107 2179899 82235029 109771947 50317674 150040326 30914599 103165286 144330802 60312822 33513569 97987383 93330389 100471215 145117587 131206792 64854585 130636137 108477420 152665060 31971783 122030206 125662548 125687150 55123207 8765938 77140772 110386965 27362101 106131380 40630640 66863777 103313531 81278317 134791892 39284306 75130699 90852234 148250306 103141435 80685647 33249732 25445871 123568508 18057542 6123358 9051870 25089843 56875136 94295671 12629504 150263461 363212 104760290 84998642 22185021 134712216 21265284 71227044 144869012 68408345 34564606 132292284 11795656 32269150 108017966 142679788 41535212 30443407 39946917 13509673 32658951 93366544 781563 46732594 116165052 21329495 92788025 44637443 55252171 90765563 108459259 68952874 6444703 132372641 87940539 108289898 58284526 39487961 72375039 112749441 17859792 976647 99908437 71920400 82785218 42372699 15046814 91616668 126252528 61607714 13468635 20598526 56590046 7418805 145328869 81721295 43061567 82794761 2118218 14704422 74069700 150891121 82658209 80398405 28232264 136451666 11321371 131279542 54052046 104565768 24236426 117784985 92795275 1395808 18351738 50176086 44788780 22451210 6392822 47984409 106542991 11427811 103689630 69039696 48143708 126327579 42139744 97187284 149416341 35763354 26010315 136949652 108891720 101785246 110683480 151517226 119026639 124777192 127145497 153112183 103931421 85156440 4746499 93109703 46763663 78740921 124967591 105753664 8219852 64087825 110502994 108203868 154082179 15098228 22275729 143775213 43921064 53031725 103551644 74876097 117681374 276311 89732174 61916239 22744476 124219461 112290459 5603319 44193960 115845353 79954876 90516219 150727004 147222644 113388187 27232485 125680044 71937000 69988343 62058993 38610192 39550628 98120758 127158166 112684514 69684900 75075710 115701080 58388745 152013506 75200134 144524248 34529108 2658812 132926896 84441519 108514301 46823271 5195116 65190057 70458628 77028301 132369813 121937072 56195534 82506648 97542012 154708385 98554225 95640581 97223253 152000896 140406954 116347511 18859304 105018377 55002547 67938131 11963413 13574315 84092164 125324767 64469094 109116113 138471824 145726784 73528389 79147583 95084121 55134323 36176788 75961797 23775489 148108621 18612499 23191353 60932315 68571057 67587582 140612935 109709401 133688716 104075361 118726849 47275477 132992647 58368258 128248284 111633751 125674082 142095860 27262909 110934439 113119512 61985040 136056098 6609379 32373360 45494171 127597713 133973825 15495273 92830572 38938309 37634757 71682496 107482661 66912427 156312472 101897773 126036719 26783177 150961110 81189176 149145039 35756505 5384121 24747494 128110585 144831644 72547041 75109923 72389926 72779480 36805758 111551109 12571345 44716054 112403346 101882080 147683405 92184478 90919409 61119208 78159405 101034385 26967504 16958666 82615126 99236052 154853563 447147 74342502 155742166 102718818 128515401 82853085 131706357 30758996 145472178 109443535 78934559 104314598 124083428 16526645 102940418 41955207 85439253 76361582 153819679 74592975 18118657 124438635 132291440 17304109 106159007 23016468 151372606 123469564 119012118 65817395 114188695 654548 52179541 59680931 126198137 101512009 101401755 125883843 91434324 39264372 139455356 69929951 46031145 143306168 105269666 152779025 73026211 64157949 146477011 127031844 72088758 143407024 139505018 151755699 74325976 92958004 20124050 12246826 91081960 132783537 3050743 104816902 3834521 68437930 40224655 121860105 98247424 142094790 71112111 26744011 21259576 74002085 87813113 16466628 63592531 21148382 112202817 25732279 95143165 71485817 106732471 80280482 85276100 46969395 98765226 106730894 108654503 76883671 122712884 56423466 88179323 122756861 62363987 67185149 144897683 131197640 122138348 34647214 117921051 105784602 100285199 108323011 45394373 15739999 49370315 4878299 7784441 100285082 88465250 117802509 76887380 154924116 145400937 66833384 56461055 37291579 19779386 104969615 15361674 69098715 102535260 94116265 36826911 46205139 82158038 76720940 133354543 143560837 45076296 57936273 43582715 104073765 18513012 5980075 116797408 151088726 72224113 92878309 100484675 115000766 149194902 44446009 63641432 62788595 53064620 77868831 55490369 23471520 68951868 55209349 154421023 147195443 62643936 137292444 101770024 114750499 108603137 107539614 69160054 40077112 117623069 152835983 102870359 82367424 128230753 28773707 93591572 47072526 146468656 125078773 14182503 100592497 122089129 58095684 34712266 49103216 149519438 35291437 120076467 724138 86880413 68536120 73900678 37293258 44652084 31679775 20144954 146446845 132878910 44718622 52029104 59283042 64753639 23147859 31002187 100023660 71760483 122371823 61054383 28512725 79054109 80476053 105790348 133234611 137598315 135519943 67485776 141030871 84727234 69812371 68390072 78734068 80918876 93870741 81663446 15774303 136986279 67952392 79171651 58119521 100087166 124113333 99577241 132704463 1231332 120264389 146114926 33013947 50831046 123652312 90800968 34725818 24091446 4713995 129413646 27327406 115328342 24766205 29829966 59743914 31986107 65241325 134353855 136479320 78335149 140242514 154832494 112491712 147549860 50635487 134634727 153667934 142686137 123613310 126276329 30170746 20830184 31681721 127484795 141886192 146373908 124060684 18755900 82209448 141177195 63292663 55132613 154670769 94556305 138081484 99723529 87516589 119232707 89183153 77030343 6149318 83161379 96716205 13078751 107161942 38379580 3975807 13245091 24100774 20223937 151761438 74002208 23706389 119745637 113740215 24737819 25368156 54294554 133710675 72831154 92594360 59756911 38225468 106277660 153177087 16061965 61813808 4470983 82374481 93175103 107831787 134230285 46207121 7668967 90629927 16210183 119213803 72099482 53741998 81348650 110862160 139853293 73241183 153677553 11400334 53182380 104532636 18505698 30934274 72437879 110044231 117760043 25499354 110965126 11651483 7919721 42731128 29761682 125806390 19183772 125277203 26028418 103323502 11428463 58102467 139572161 46843627 24337466 22238218 126801116 154954803 106460322 18191441 73157294 81484260 76126648 37841464 42717549 38073723 14777967 20760387 112389203 86101507 75644696 56876025 111165347 113522730 52351291 322527 127247382 118591301 128086365 134031569 11899354 114612632 134219463 63744258 135730729 133565088 86573110 77563981 137843562 6558954 141716286 102062678 47579009 89889166 63368792 84293386 142363177 22992881 121471432 139227110 49853906 154114317 69574367 22529541 92596292 51076958 11070905 9961966 96479260 4578850 122931722 9909043 134648085 82802557 53638849 144595572 513396 84497731 140900993 15470660 11769598 94631359 132708932 39356729 119879683 86360115 27840077 119299142 74372383 14836912 83516933 29791334 94834309 30388020 25840399 101444722 29146460 143883989 9659745 148702050 18748310 129727749 14446022 42321267 97980129 26580791 102636910 87954344 150976456 145980445 154934222 32146558 132544991 145695518 2473359 151700667 97492502 95923720 118080826 126843587 135118365 120216644 127988416 75925568 77616276 5499630 17696793 106011796 72606579 104885717 41612727 69766133 31909978 140280451 48786552 117771072 19273761 124647981 100998167 63215532 107267287 84828459 132916594 107529537 104588453 33869517 38001945 4010476 37481055 144080327 41652361 9299734 96465117 80677020 89331852 144875542 22963330 54508610 35940437 88751878 110913950 56688385 83783001 141016266 105344348 83049071 79100809 32234285 62851418 87898080 39081671 17427754 110505890 107873111 63367774 88306409 50342242 123549121 112837888 18863717 2060891 116440804 58475213 86925991 3322919 90268037 63887698 34889376 69290813 35210286 80114068 153696576 145304549 88130472 105109461 154781340 80409447 107821917 144550657 99465536 17351580 52098296 68182514 532655 132820449 71541824 104656352 60345811 77620851 127490095 35030359 93965312 148717874 59259021 71632659 94555855 117681799 31151448 22647789 34511112 149109505 152409250 70215249 110626381 97435379 130856889 107329404 69251174 118006693 109606320 149127667 14229312 82656768 11936896 123576291 108833141 44752718 136762267 128913144 46494613 3915877 80176076 148283862 75993493 46191097 48151103 73466293 42283863 67949478 110222561 89199908 114233604 70329221 78828465 99620652 70448247 137779717 96355280 64442401 123707226 38387474 140310861 90388394 23586246 81957216 75821164 89618174 57773413 102750379 36270325 115296766 46103022 18936666 141608850 135369626 93137243 97196623 98908653 87395460 70829922 22632550 139995925 31205298 50670365 28808372 22393156 123969030 42182421 4418785 145490364 104365429 89630859 50645386 6247178 82941815 110904858 113298682 36892242 23094387 58084596 92001264 51919220 54216450 123049383 67289826 14883610 41941736 73565750 3637973 12356758 142002190 148487846 21661932 112444064 28970340 82964074 50325487 143879782 129169123 110457117 141785294 103033067 57965682 65533333 60397113 19824647 152804300 154463769 40201758 5308327 116637730 145014246 57444787 94094225 9616425 127261845 111021201 80038055 9234626 8848620 131446050 18794020 116574815 12829943 62421350 111987765 96551078 142151106 60103702 146649360 73555207 73199604 123680856 119048767 96514020 29801789 597936 95435559 93927075 44905109 9699897 34739636 112899110 66773819 46427098 77031522 147809053 16272898 64930054 108680072 108129790 22703212 1560130 14158102 59978220 67132397 33384285 58357956 87175126 103440406 9221724 1597962 91592347 24592225 110366012 53224900 18248468 82526835 25632662 86575633 33190945 52099979 14737485 80429651 62794158 152237729 63326455 106774189 65023593 138126430 44601186 74496794 121630230 101457219 56299536 60959381 47150347 39980657 41337401 52664810 67747687 71708081 36188240 136815456 35513996 144921007 35908045 109750468 12517076 112684666 81671401 89803263 119334312 83355711 63832262 31827391 25379732 24767522 31060832 143049970 110236521 86746127 54641138 55443907 138819252 52954209 23525206 1561060 152570454 120505355 54871315 50938330 76642466 65444518 87271679 143940723 131934775 148554229 107029524 43634121 112143680 78422966 44669408 53405788 121991948 115435672 28887588 80837546 78195758 25116800 26231042 13585853 77690711 150336004 93392264 26970709 121163641 78931113 105153261 80290227 86700241 85592294 65681925 145455446 48948706 9697160 51514328 88517171 96371622 101209756 127843029 127051511 7911073 104476470 138589707 31475943 38963824 110069579 86073538 29271020 17913455 123808970 76813146 69328929 113209211 36287117 91505139 85521809 62058973 155751733 116126072 92285528 45020629 96346529 58025804 67164348 7027001 119543535 150831451 84208397 53614335 95980422 125734107 94592905 51260495 133268250 82009111 65394851 108692473 127881840 96186268 106843582 82481347 38140922 128055389 117412164 156260064 3878018 72180854 44363463 155301782 118289340 47592140 125260945 61295327 106950531 155105166 73680863 81038063 16413298 6855726 109503935 21525806 93129104 46055930 114606020 89864450 14221893 114496518 22656554 46774107 76611846 68409224 45918969 80051068 64000019 84321704 87205912 124229783 107597591 60039066 64535200 33028724 71972604 123076025 77403258 84194448 32152655 31178640 141799339 77137010 123835882 98793192 144903608 106147132 92387411 20569989 137573133 48723888 107264177 101211858 20335517 80639324 1237224 30667716 13155081 48039484 146745155 127322484 109295199 48499456 150283202 88896246 33182769 61885216 62659150 64164115 49120627 83509050 95324225 140150671 107770387 95403491 112335646 29671566 140195110 13140643 146428576 97624953 30102235 77610183 34604944 69974976 130461201 124521104 48297586 77543867 93290655 30756699 88806478 145550925 87245626 21728835 95972548 132479694 90191807 107657600 23271035 14548702 27099590 54573136 82520106 60142580 127891221 77200918 91226873 70730006 72096589 114105625 6975706 123911363 69338056 53602305 123205522 121137500 79460192 34505484 79014045 53823812 79364042 60262692 62617279 84104338 148841995 32107048 126884201 6697071 103502858 44158241 7453205 102773278 131680832 89922029 31904707 92075624 68087605 78608064 102255828 97131169 130086217 43083819 102813869 154254896 153481170 110741458 145513475 5567416 81597496 68977086 40153385 105934528 14275903 12831960 99434301 55884772 98973240 77451341 7031112 27316153 7413357 24615602 72377860 105938881 90207412 85938870 18819035 136143653 126997350 27674414 54402263 49770223 63431708 34515812 22958882 133449871 155422004 116391355 55375298 59974423 104744300 36153783 90632497 113691774 14829739 63924180 155969614 75713190 111854844 135257761 81483109 154660677 94110722 71206104 1975899 47449117 106970614 77428485 120505087 16175279 73469283 115458617 97028762 32775386 112538977 75575932 101269511 45609262 20490059 100810218 141178017 107267239 40380734 118989978 64423003 19988086 136155081 28176082 21485693 104098636 128757625 26194665 68361577 129203154 106071053 58759665 48335103 94029912 144510063 40935150 121644973 64020726 134825564 95686123 155246308 137875503 41215589 100953106 60221741 152934215 109847777 101235853 117260286 140758139 115405578 117128380 42092800 82781377 8274883 3627969 80678827 102157855 116429603 12261842 120060561 30900139 120981108 47401485 147391893 118287604 78395907 93534285 140091600 39249285 110170847 79293961 57519359 29968790 81610981 145253696 115635387 112803954 85167397 8321101 97899498 9076406 7888142 57717305 92047379 24199873 26826613 111126049 46464153 141142304 46515191 67296606 99283807 47897616 154516580 32345819 24968257 90511891 50895971 127260083 4525900 70542404 70288336 93467513 37793345 84895771 58867308 136672333 150195856 95812542 155779615 118577658 29191402 155511293 152590678 74882100 91321597 155852162 26226401 135675298 22343678 116701818 107138692 134844636 122420167 101504846 27640735 82404236 140599807 145169849 119515528 47323411 45578756 64893818 112314975 119658863 109205164 71916018 54733111 82504518 29619269 105361124 62791233 73995082 33150288 142509664 131474192 24540432 6137170 40575450 22242529 24954671 52615046 51997279 113503211 61359898 57624336 27637650 83614778 139521284 126419618 103035567 99321643 27304771 99012083 134500779 29273001 75897471 112147578 12536025 69125170 106898237 117052083 4140381 47291770 83127813 86127169 125196987 111663669 144364091 121666075 120737465 53452419 19250177 112739569 23972530 99276648 64629967 85679748 111524811 154714953 58375093 152727786 63689263 33428874 151367126 15433223 36569431 147104284 79200762 6435286 117956539 35246707 123013492 21758439 143657037 59631756 142803071 43314698 110832591 98189148 110785480 57988388 127956953 89632699 7699469 152361719 146634477 71426052 92110039 146334423 94271535 154961533 21267637 12745453 9079999 92671507 130839702 78096674 145968480 10877978 4703327 35686584 155367908 10543063 76156312 40985363 122073238 32537554 143902326 144709010 84103570 119236532 111306522 138980822 76983749 100403820 56796418 38850902 28194682 151540363 65262356 43996600 134700523 123094268 109836084 65755044 75988242 112856227 103598689 119144000 22656824 23418369 93442710 66052343 45633352 139421721 83978093 142379230 50488557 65862147 113611461 121147018 84195538 144202332 155416676 126327117 83438429 56907288 38510071 78569238 47353073 19873003 89984227 106656459 84155241 108975109 33743014 18633343 153290958 144642623 125116180 127115081 62049513 132986747 138466689 26594060 126572747 41130181 87829087 132951836 1214485 70717364 99893768 101268697 92034460 63215783 374047 113070997 121936032 63343845 2855286 124168192 12240111 114963774 148127693 150543166 79420335 135251755 93073225 64709813 118140770 123664858 58035008 132602843 77922438 70836093 101495641 23713063 4080057 115902894 121957779 16085313 6429155 64263837 9478865 85615298 30680673 15443111 85438315 119479152 3183361 154479938 149935971 96541188 140340863 139737865 77059566 134548367 54984910 95705898 70343053 109961047 58190292 24106992 121768691 129128050 117067300 61812361 154797472 134888632 83655897 3895758 22161365 116284686 114672736 28814815 11996787 116135531 91804906 86299580 59555289 143234442 135562265 143790369 118345784 112865555 77960264 9319912 52924108 151610795 8635753 106198190 58400611 3496182 6042986 98770539 61744304 128943507 45694454 108184362 130179868 126415683 63931626 148011355 97365671 145483157 39254193 54024954 9028829 109029007 41012013 7872742 67289330 152108162 21241314 88778630 88522735 57853265 120566239 47073257 31024143 107040590 31539247 143485197 142774930 151163649 14015084 14853988 124525127 121810146 27790252 29364221 125972711 110431317 116735212 146372493 57920843 152011356 146265016 95711736 45316461 41681084 95851725 87194387 95161390 120656330 129232463 111299601 12958991 65069742 39525452 10530133 44861764 5725662 142304933 139206653 137784290 15695872 67571601 103368082 99839644 97335705 43601881 38582766 144215041 79102855 148729021 7616764 151997222 138208006 134849740 138893783 82256573 124153403 93295625 126395828 91351786 70395340 50951526 77255565 93726312 72745558 87620739 128991997 52319128 129989650 14028681 138450310 106651340 139391234 35211491 5845585 69119175 91526688 57070271 35377 135238235 141328528 100854397 90855510 1363940 99016992 121411685 103264825 113392036 3370915 55366365 17276654 34229737 81986041 8025809 15868764 28696622 140608871 122754163 38285404 94077671 30169602 107570945 51260962 92762141 90287198 25213781 45630949 40848243 27259247 132807644 1650075 30567081 124315645 39613381 13015170 28393420 45085971 52599043 80714666 133277682 33069102 155873948 32073476 27635983 148686404 139033476 9660919 134469944 58912757 29489173 53334681 79340222 59847645 33136339 128310982 7569304 58188087 127215570 73678056 17555251 82930841 129784040 68579870 104098545 22184322 60409454 88375829 139463533 138063854 60056696 50766114 119071824 19735542 154932244 54345344 153059213 43456608 52601381 75269660 87752548 83774154 144686978 105668871 132656480 17369022 19828380 98861329 138411276 22481524 106388313 88938348 143730869 111105003 136078683 36790214 36585513 9922062 60693824 84673849 135775801 129168479 41497414 111587258 33208672 32022869 115336144 71404744 26867162 37871790 131867817 151974114 130223797 282480 22665054 110354676 141145946 32204303 28609327 58094272 88797622 144164979 14767877 27882036 16641294 63752780 140929702 99039188 152590712 33342535 4087978 79452854 145327017 17458573 90957020 143097525 8369203 5612785 68160248 58422705 101380664 45287201 98618921 109816176 72152280 22935727 48838371 150472612 151950791 37796919 125936000 47284844 14000963 130440235 69421316 14958153 84905208 43161820 98807773 107736210 58786496 75556318 137514675 36485246 138301128 16923971 36345358 134409496 32288509 133572600 75664644 94819338 134156047 65852085 130884206 62075437 121144462 95914058 8638719 36785947 141682429 106828378 116668159 136455983 150371602 138497072 105639039 39841737 62781886 103846231 111826916 82679599 137501828 137343977 38373525 135447326 129474011 141485493 135097793 140968514 18565129 120305230 42667864 96550166 52307091 85694443 39381172 15304209 88011231 47505707 11912780 1944228 72009666 15745190 14741706 86482777 140083629 22596815 25024707 45690727 5513918 148241497 31509139 89370704 49663842 44320862 109336066 47975340 84814174 131910987 19581985 111592328 150598038 59477471 45258331 138393773 53672618 110043557 17984518 71658720 31667333 72635108 156033106 140597082 40498172 33589560 124815767 3820474 6626659 136999099 27375881 88166552 3612036 102568891 44120848 78221048 110971183 15359318 62013373 71490817 60284996 146432226 144314121 112263576 35181768 123095274 101128870 134566469 87949446 43237695 51515546 113529687 106020096 114182216 143279917 98612750 20671690 60079086 15092525 23821240 95684470 125579018 21903579 121557818 56685330 145250749 9545961 154834768 76188781 147283770 104323919 141764115 101818302 96211451 23507813 143947857 99547364 45334210 48929330 6898053 30414946 32409218 66379018 74230811 9340012 126754880 13927507 65563747 81012302 149981732 102900725 156032946 129091578 129819592 4816070 137011167 76666037 154721543 106955089 41711625 48250206 1720273 36292536 88179849 132945479 84295793 2991762 57012787 109962093 87539550 104072164 103303619 119311820 14908666 17791129 15324729 122375245 60590362 103424535 79584692 8823761 129173507 41805100 131435323 153423483 101210420 121474162 130256287 70988013 3672107 37424103 112596987 38924100 135325787 88333983 68056236 45603889 90151988 82637437 58175507 148531729 \n", "17165825 60941264 70115166 101505203 292701381 258053328 163987896 216264244 22918343 158362066 148040461 139042792 97351242 99428238 269777213 29953434 117859345 246600319 153209826 280804906 150885561 236864802 100577642 65374872 116296720 235876507 110153589 52001941 226376518 146294649 172405826 51978139 244881722 4274377 184302959 297107414 105743347 239820192 253974513 23544054 125773208 179216373 19049180 70822935 37680398 40462204 75043973 177805311 111951289 193494651 194733753 212942497 46205278 249287986 249188286 15631253 262314528 126930034 303043930 240420596 99684125 272426507 105571152 281770329 243006283 296133408 125525337 269646965 50597255 130907935 82092098 127144259 134889567 136622215 51567055 83555569 245371624 71818253 11491226 192075461 64291537 294472255 119112268 102636177 182738593 260237732 164377924 113816325 91276764 208541559 3653778 172611212 226300839 192376726 268050249 205129015 263690196 71208851 244354510 263275756 219080125 262821687 46037894 117484053 186876897 138940263 298040417 288546014 239786049 210517122 31869014 46667853 214596219 301953512 227633879 3526328 164681700 43247238 125011758 224161093 157734148 193772343 56857847 150804530 86753599 82942139 12371488 220607164 214126797 202455586 237801137 284061546 64752947 174208419 149823996 246561464 112071051 77079691 129696473 131522202 56450204 11863604 144106336 290414006 33253056 226448003 26599188 54168024 250689557 201359365 276461967 284917054 177254914 111800167 41607227 293738443 150144730 14289705 259563307 135772714 258018966 129321817 36403814 206391552 208738449 144005811 8664701 131877090 49173117 179033138 251124734 140747873 139013500 284691913 295106347 19235279 79773923 154506459 80127791 201127362 111131032 70580259 248429632 112435059 159539869 184504563 19222121 255087038 211104384 260099181 225823849 52797143 237179982 202841277 134645227 23918021 159905188 131466718 193361409 228384695 297773992 135332174 224054164 101759044 211555431 299261933 128412517 77779893 73174663 292309482 39694678 110928478 249790009 145872095 128138405 199359773 138817850 259548605 123191284 44394933 90510761 8368374 134810358 195235497 49614065 53873503 205088132 133452579 72529605 180264074 275815511 118675017 49309397 158673923 115494475 138760878 77182895 147114796 249335897 231898497 243482915 287094316 125486661 26105628 203211040 52519011 113391233 288243448 94790243 43683420 238937311 16523299 122643950 123379070 8763596 302675172 38939801 89628353 206667361 37118283 126298214 275394740 85866998 225770139 231298090 267055091 13509171 101748384 275889050 250250586 106512601 56248146 289089926 173659860 96100845 84020643 95342878 177648102 156642884 153486141 93957977 284132888 96846373 26083630 55103499 279875921 203711889 76692974 54221941 106152072 68422602 284258079 210920149 79005168 117699703 50376732 235912246 251163403 51826645 195426027 241901161 250458103 129749126 33526868 256947636 127205617 122385039 14382277 177516901 268827188 138716582 285870987 127486939 178625714 261622701 208678444 152999417 171355403 252942898 238464421 58921712 4291714 202050190 155989612 198029231 58552536 116204773 195472354 254713219 274816798 252968523 289138923 115743507 303787188 69998644 293594619 290257325 119042395 179237847 228695587 296228403 236969584 46039728 128810682 209627601 179873469 50724803 66864980 3450504 242537638 144345494 296843527 161967300 104699606 217957631 300829363 187166048 34416508 163133933 64669103 196075040 71274803 298901372 218457709 99381349 236027622 9597890 236956944 141781572 87254855 240563139 102511606 183839482 259449307 207496923 168951 82703127 208484222 29767494 52372655 129692678 33538554 244472398 86366968 118934818 147470809 251174193 175677380 140990379 210757179 269318660 250234284 236445938 127060010 11339757 209997419 104643371 22011141 279336436 223120129 74671071 39446920 159554669 17693718 148755690 214928107 51581830 249732786 128625721 259575774 212814880 84608565 105349493 231690731 140390318 109042501 122249989 216880855 252344749 76160608 57490680 113597500 277833268 121996893 89880098 284806315 175960502 123528816 142694567 185956068 82656735 181686136 66612848 191590649 170660176 300529135 247668431 120589068 130872149 196872690 97633988 18507511 192554025 184042953 102025082 2043875 76307459 90953043 198946616 145843534 67653975 22912893 252623426 17159759 16512379 214556062 242308373 217014852 156402941 23168136 200230141 131314139 208639322 173102426 167497534 177032571 246827722 222406115 73102840 121423847 88962036 153201073 80430413 204482291 90842733 239751426 187997640 83567789 177028022 82630985 187738547 147734348 242620076 235051317 194064724 270483005 57987889 302677107 88941903 294642508 111115343 91250478 69563524 86931179 29612735 188767045 128025955 243651501 280966935 278007421 60190389 138282426 207565179 266973996 259603526 265742626 95461101 104252073 56782104 268738259 129846449 203519746 151424856 172580450 280894404 268647539 170940347 193542831 236148092 99463462 46963102 138403587 135539302 163877330 66362896 138273895 123113649 54367132 259395076 266842462 83765054 253107736 159437211 52461674 158617291 243327085 133478137 271866685 231159456 147586483 43377132 55234491 265358928 9576152 218934236 138963420 298308955 263612224 190543572 143005137 37810804 224327084 90744555 88029574 252757528 151227406 169786675 149176586 37210963 56635656 211606952 214844676 268747155 268995135 72017117 191833167 224534648 155967346 218338195 113711622 54487166 36940084 87344753 251275344 151985812 295669438 289120043 103687248 46756740 26921583 266565857 163417455 192295307 62687074 157017928 245456574 284477308 125779380 292157108 67585097 138037638 218036206 168749009 283656036 58530079 88431899 221543296 174674375 130309350 106451621 74591464 217476663 221742186 184995978 259765799 260568772 93529823 291533495 221289427 123948009 120484838 91061861 182998912 251481763 178107575 94025799 206816344 64086011 152685209 37012518 295780541 77611674 217546417 224099444 145903484 113871950 164227451 235964740 258748008 240602250 55133152 15830130 56286505 274880553 114201510 122787553 24680885 224779124 60674885 104872456 238503596 105206926 147508358 45464867 73358045 212838173 171868083 56455782 14972753 202310532 127016831 80814038 163584025 189804922 225815594 82788417 267966047 114310806 125735077 225199555 46622798 128847064 151418972 276485216 51975296 160834637 257368760 83499155 168498089 155084433 244801898 183851375 135668758 121093788 248469823 194862177 31116074 178056483 194768609 136736278 197335453 302318673 175074380 204230103 131014107 115952958 35647389 209160093 148547029 426757 10109917 194447484 175778065 248270993 167059058 267876467 19654777 251856718 25822456 39745595 268128974 145081252 196938704 177175566 47737007 98829344 230885346 186499780 170417022 34674529 35847220 45295963 251897219 291836545 285824409 147992540 10101443 149828752 253835204 255551019 182836295 66102150 177907638 36869235 180721546 290021505 159247601 273613412 277574053 281729487 37042178 243844990 83059570 43379153 107006870 30782223 264289161 13334103 107814236 67887683 9554412 98931432 225848093 228959010 135870478 93589443 86946484 232292474 248368121 24771513 152635130 278706962 257316434 229944987 105396487 245511422 76866152 97296428 73430304 67053081 143284598 220475381 47476039 182466186 13289660 293775948 120176644 98272182 219691020 270173991 197264754 227588490 26185794 139174088 7378464 141057803 247676304 182367127 161795202 94120498 172205426 254127999 51282765 126074846 294360025 53745848 179942738 71455333 12930595 212190749 190600774 54644600 121882298 192710368 51553771 125877262 273470059 109165587 43131637 296349593 167853663 85842748 120748190 131426439 159655658 139233883 197081162 114414961 303449158 117902483 153386074 21423612 62991107 193582764 111510808 275052542 298494145 163014980 21837925 149245938 289075431 262154816 15597140 284329692 207023932 244384876 254351429 12797715 220737293 117699437 144680198 39605888 16041153 65921272 48163702 230321775 206348964 59390865 148117398 243780546 171196513 53893092 189832198 264960597 139621093 148245567 4809305 221232200 277688046 272893506 41674329 157361656 167691319 286747879 84650822 160606519 235190198 69263100 82730061 288044368 73485956 232767044 224490947 44856647 74722815 110021989 225898884 256608809 186024272 17226660 2071201 222915303 181172333 202432594 75400992 230560736 92004434 217068944 247721930 40827761 146718493 194950013 290777979 152066166 212466576 291528897 78294950 292256235 195010235 15503583 303566084 172949343 247469342 139453855 11731321 110058916 255791211 153292322 237377029 163947314 169189003 19006114 253053169 43604308 51251429 290700894 257406696 239573810 154255493 32300510 105180029 116858861 123320830 52490988 66594725 206303590 28770326 20213338 167490334 241624015 290011630 102946978 247417389 115775294 181169479 215246442 162865006 38780407 42683510 277375155 247860163 38276562 232116672 157845681 295840760 30502577 195586054 209666078 94373707 43782256 1087101 184524371 188426901 299716357 294570419 196431536 149026038 207105457 141773115 131348342 65016804 182476514 109142003 204962161 104501294 152650650 61027373 208443145 41885394 144470582 14871565 89331201 282876656 25396968 130719373 65969351 130972929 24921779 34100828 31705291 238743161 294776288 108431611 99022355 260246747 90275199 225216423 132290132 211918966 114645004 32451853 48398422 113909772 205979523 68459318 185121588 103498481 282631581 233099692 143747544 252624800 188205888 12087019 256060143 160914147 52418855 112611351 267894570 175531612 174018573 188729500 78963950 261632853 18643772 202811322 277224125 116112792 178140296 65643909 33500427 121262063 270117565 161813122 250409265 269544959 30636415 8822289 23541467 45417893 129223947 64488973 38394119 279083062 268455406 198536756 94569049 31184708 186067471 45345482 232693378 198628660 215785089 19085985 98120495 174242424 72684406 247628120 108665168 80522502 236432882 80304878 77449978 292534693 286887012 23185395 16689341 101492850 229125133 301065176 141155090 75225764 47810494 222525313 233907959 13838061 62459489 301496656 10778758 5240036 103598307 163558632 16918299 234142368 213792657 94841658 61047721 35077121 258638505 46599563 79997587 148879202 49817503 11044618 173205 147142775 215899238 127171919 216514469 283447884 164777979 4021885 245366547 300050101 174742677 170403157 268211411 219845011 43899014 187183386 134069962 222688281 131430594 298610970 159221944 227824968 211070395 75059371 288206819 159427187 29796943 109831194 131170833 95512937 25198469 156353638 260566393 206486856 45395156 179602050 248580239 85481760 192166057 1776190 235196632 205854135 256983811 192644984 243695226 105435757 97789291 111353460 4146025 113545424 29736282 195761180 164187074 119714771 283798019 222458811 155348102 298556123 125277194 140432529 30120415 43821910 41104492 227560313 196663178 125149877 119307987 194436909 232208286 241197158 254788432 153552166 204161038 97219840 156578359 227362151 216958529 221414583 283814191 180086132 29427097 156752152 181581770 240653758 295489414 201748692 36006932 12645621 232866147 46438383 114168555 210456497 80283781 94138074 214775472 198775718 18554282 231173387 217806394 137177172 4417302 30700274 80847867 178427661 263194575 233569822 17491727 8643957 137116679 37823052 290597584 175028226 230706700 200419179 30166777 83830060 31810577 82020825 96039916 119442042 114672476 9230778 5200922 108444584 5873999 273981320 44857459 237841267 257156193 189236956 203741414 46344577 207463017 22141239 44736210 169620106 207167514 150593308 90234335 78257630 127821754 258030794 103897931 19062328 84855906 64547462 262446555 261434255 226286490 264928524 112612028 17549382 235969532 51689973 110687931 227659210 225280036 103569874 246426914 293940225 48256668 128894394 131301681 205988969 133159850 89023189 88358275 282322602 108154101 156542167 219692791 245593712 75993703 99144652 121772707 118910183 177900496 30634314 183107585 18183486 37850289 234266701 130911962 113945453 169238044 287273369 280406494 41009612 99991867 61791882 226674804 219584214 196704180 229230066 21718833 169122084 289713308 256995036 202678546 14011326 92978860 60327450 151015773 267036438 276638174 155534998 26686225 137869770 148627403 175790009 156577584 44829608 164025273 201808975 210893526 68015059 226538500 245293827 182806059 261453907 126893003 102752157 213106059 240684158 73948234 213400316 32223211 37828758 185241688 276640688 38833544 162470227 63816701 252069191 168093898 218657643 10029138 97118466 98359819 121820535 251533304 77866489 142312826 150810402 100914157 257108248 212852415 287563461 3406907 299186431 278857707 123204364 226006020 186281666 295052123 156020102 153740308 207531677 222559641 78164847 93325534 187036393 196414564 135563388 258479949 13342342 140412534 16658477 303230454 255865459 229846712 297247630 256111172 221955858 176624026 100854253 90245345 155185863 199374878 128693718 144092518 43348528 220531464 93213398 266118109 170246986 150958629 182690051 62414572 200419528 281045533 198882063 170529035 36096498 131677574 249383902 57026132 272063363 217874719 198011120 93873281 38498671 57490224 242609110 265924314 104493582 285392341 219888415 252706592 246436990 122210201 35574363 184296656 239434451 240154508 20117374 199126298 116999195 185504397 133952250 20217026 265260530 100349126 42745552 271552691 245511347 67341805 204783793 170513987 135054900 165084318 76728221 275451394 157309435 44501384 29882276 35707730 293400153 194067126 6168790 107224576 191899477 17805449 213701257 155334936 252861118 223963603 144352184 294504919 290337238 257762104 68734955 281284323 199423679 242976305 186128427 84562436 164730225 129017686 65073891 230250415 210531323 83576568 52005483 63105388 144074381 219254254 253473841 195232912 137398464 118652123 196363147 17137536 113000629 148012515 123749198 17821065 138459500 291699013 100113739 73589684 170742387 203579292 18562 58053026 171629280 3782347 21759139 211302356 11084452 287578297 141567597 91538972 285602639 104545971 76812136 92661478 44473559 255500869 302357404 269782386 160036517 263804242 86352373 12792054 257996528 125474787 124453103 14698568 125269876 60976433 254148237 292465619 286320396 70506581 261466818 26703294 231301010 149602337 179275057 253499080 22915012 274103903 78871513 22344049 46319924 253395226 229067507 8856307 50999082 112118115 82931842 235596138 150343097 20795661 76922018 150065882 288889106 87492732 148120280 108555981 181716283 286609142 115274571 260545941 170757160 157625075 254415146 134760090 296316785 154844159 108715795 288365327 150378054 56101875 106982239 140728292 55628174 36072595 295789445 44852649 107850329 225631778 301414466 117903338 24488131 231018635 128289535 4338834 112618449 81731926 83763010 297702709 287358321 248564248 157238885 175798654 271021192 252666380 270633886 207465394 75407480 282936676 56857746 211042889 227175353 251103295 86813301 116447044 84421491 103363964 52363684 45202368 109952549 267553233 90753292 180177991 45970133 277625495 16565512 146518030 144274958 51703162 199399957 165451936 243049607 189021587 189393586 152497252 140400714 132208212 200877247 289843605 291537227 172723149 246760137 291968246 31740001 108255814 136113880 164569375 208954452 30995465 84916385 292106351 146434362 28287836 125995534 154733323 153764454 163516625 74865259 18671343 214295789 30778980 228064593 17783075 184375650 116813949 200209605 219134959 227974802 164928999 284334934 216124744 288738577 31478091 101857938 245350268 219403839 146686044 150733950 180587548 128185580 47596196 188771679 296943490 74760017 246090197 36238102 90956636 116162310 186875444 87956537 96243356 32449256 179896479 43070886 19450081 118491695 77478168 119300715 215996117 226062194 191949279 287585790 99931062 68990191 64499615 238509772 252859645 99791525 1006948 1917806 41400018 151042851 79072085 219902678 71052021 139395662 77250336 241180491 132990529 270480184 35952176 142248590 238320002 238035655 91890624 42352501 129081182 59627121 253605426 162896708 226072802 84345508 122070052 84805071 287941063 291149116 215933796 65569609 232331874 122481453 297855288 101418710 17572276 47718817 258006953 95527365 286595696 267113817 259367671 43830343 147848803 48944472 32792298 164728529 200521860 141837123 121243859 59201986 34075502 233922269 46760886 251633422 98219085 275516116 78566903 255711286 34436008 223472994 155417840 167184601 190630902 222357681 1892534 139381677 118235689 281377953 270750327 40867293 235612124 83241473 85112989 207375073 201133383 86093451 17938385 245290082 175185491 14656273 22987389 243599924 93872398 255109196 259120209 263927983 34484003 117337733 109879781 66301297 153955395 53264915 262086354 102228004 199883882 11344546 73725236 284172925 36329321 191968303 253054559 246936058 268679498 192977251 27028152 55807961 78297948 202784129 103490050 120260144 289495444 302060322 54272853 9842767 122161648 150555886 153502610 105281522 3148177 269882312 296696073 151941638 3130141 254902020 247210687 295342611 157048039 139280033 25765707 219812372 157629285 110591738 186343514 25740644 155996852 41611883 139005085 261527553 241995057 77940446 252821445 4441463 271603372 4358229 85633678 236459670 158775576 5914759 249053017 193692595 219491177 182956880 59263830 31249520 259984859 3943153 17864794 71669 77318801 51019043 54463764 195805207 105071606 174126615 214559965 242833484 51426043 156524411 55276502 164361897 82664657 72852316 132440467 125034847 116741795 72631490 170335361 215061830 203938467 285260668 116955949 211810920 42015517 24115752 132432634 247345007 219216935 167265456 116555713 188017601 249915445 263453655 114989099 72027349 198750509 265805483 174623209 187512525 32964107 16350222 260871544 244991040 143083362 257956425 37250509 83744169 65433619 67865884 274214440 84950019 72824447 190282347 162183413 135116560 210427421 65413487 165710097 268486886 111178796 24280168 114327503 303213158 265162473 21768545 282478733 170788550 257515073 7525031 301627162 171859672 112594867 18793028 183886824 201081143 116473299 76194337 41700751 103458502 210015633 162134088 30446642 73658354 85027547 167244735 26314937 161856484 12664658 98633722 99533818 183516489 156482426 166303993 84269433 161372464 32609772 8498792 35021965 173373586 230584820 192758973 255600337 35518424 85454562 221419579 126473526 283788992 155433290 283591696 80722971 269043025 238296403 173372578 167569182 246677376 275493738 34711777 223690769 16783466 141938120 262537540 34085752 280152571 184288080 224020214 74093976 126669526 265026486 240281058 176055046 282467745 219715697 225294114 211507999 112939772 54438654 14077721 269999806 261120876 299903207 222558883 156291390 109243937 52518398 103052519 103291026 279636138 234423058 88184761 175483962 226260181 217736976 275090106 217941859 46496839 158127735 291570380 87110281 81841736 39319370 98102404 203962386 148129262 205741207 139044259 16703279 200595958 228999269 20870061 88777689 190887744 116748401 282034621 207704375 256015908 120382207 6431293 267147253 224906244 100592599 152788678 202960572 47463556 271093270 223202828 112389318 219625930 296377578 290617055 5394417 102899541 97424529 122879863 105086273 91734063 84496226 48986160 48198416 137546437 216763408 177615717 56400926 135489496 153793024 190420171 126972510 168155995 218821841 92907545 230648350 224259425 223569252 209109994 200489191 7770565 86436095 226485068 259032967 244978212 163496075 19115236 135793967 247510637 65476717 195776433 18768325 55640958 128418461 257609813 115234522 40581674 156476388 244130199 244774325 119549603 170620579 226486139 247334399 235740916 184425753 184583599 6282902 279052182 195777041 190625693 39943340 19869385 191616493 53792664 285337926 129276888 240065893 239106258 7953023 70147734 25288427 48748982 89820890 185887028 212348427 77308267 29389458 100355243 78147795 52131504 290142268 197754404 8892915 164889558 293461635 257535135 82791779 59924393 118977878 171169761 267674446 245769126 268073762 40874350 39709547 285300861 163167970 79306570 131167205 132491326 118888587 262196848 169947623 3226990 89284727 239503477 293092815 176461585 28498842 197963979 37481347 119474677 280491701 123813550 144477087 183668928 103661132 62977011 270876982 265905210 191329702 93878247 111835736 62619215 269088693 272573607 196093952 165054116 41723631 282905881 166801695 230619031 63063428 51611738 168187584 83481035 188419931 118478981 12303631 33297975 169380228 222451331 123304515 122870190 26209625 127498093 12294056 108318941 97870372 187355132 35387903 42416268 2617023 97443368 207457317 73607648 132166412 230975415 256617442 82682964 95585517 36126066 254694150 189095556 285993600 15576500 202329157 108773654 61868330 272212023 14256244 210278839 110731546 59644549 45846955 201846707 2166140 201280209 223496146 250332445 38286239 59210690 150354554 281734764 101442931 110099097 142830702 248471349 207879653 293712060 220435874 141459295 3927601 271349206 203558530 242820205 187629980 148104511 299071941 127573429 86437248 303344653 119490909 6311402 86547524 60756970 56314310 205433729 182406178 56996480 281009532 198009050 35464154 194711105 13778684 207357850 164644709 194199094 270501107 35258931 142267589 168811330 140793586 260948623 75875681 95259139 281568855 279436274 263796920 279914812 128937911 19054680 242416310 123455148 216564255 34676328 75066136 192882906 240215040 32238573 114865256 160050477 245391846 196186457 212844144 190470473 33361780 273328903 155697848 28818839 172427285 222397373 251158826 33341933 285353152 85846829 194316163 145453947 26182322 15873355 257650020 239365968 153691741 193429717 255304783 179010475 39790217 157171650 31663211 132884953 106346079 818648 300238702 137977720 10312860 90771788 188446096 262645837 28591095 215182422 46729347 197362164 47576732 241653263 220122781 222608994 256629087 208266561 289760188 279940689 229826833 20541884 152610687 212766780 62325158 460937 61396324 232380909 173648336 267838547 136463990 64950274 183476281 46548240 65613907 21064343 294678345 138087277 183644975 258543320 138097696 2316704 287742798 89708680 195395473 39712677 123101819 260908994 125638107 302021806 247419327 228793356 211810739 200695407 121843121 123023380 170010165 43367340 287657356 167182265 135502314 30936845 285377035 123775404 173697501 258193585 103904611 177450658 256593692 199084654 45910021 290526164 230944365 55991734 153204690 54264883 207666201 144284373 131816095 79897328 105692946 240360609 15035940 19338456 199831055 277841601 255610637 5740198 69831 111470908 231697035 262542695 243562396 90750479 117373931 190714486 272316727 229679049 229098680 234553956 245331467 258934906 3329259 168360356 203920403 19734669 242721336 124507710 166265576 292472699 167182150 223866264 57042920 285531400 126109676 299602715 227884732 112252848 225296280 74620790 76881426 174114367 45335268 22217710 216812815 104134926 102317147 145217381 70483713 126588476 59792206 167929899 98268885 2106016 173152949 233810949 162711007 128379940 205333958 242391754 35842892 264774511 76712208 157086314 52597634 16684627 270280727 29005133 247035964 87249120 53450374 121383429 162054599 69849850 256837011 27131366 44345722 144276123 67220896 26607256 236071789 120890408 276781165 198131216 283705145 247831792 241244277 98541169 40055869 249789317 64053036 215309535 26749254 255777596 202318292 183487690 58494045 18845336 205420347 59451580 274014034 65420832 154254818 230482718 12463751 209909917 83103487 20578644 1459385 259485371 174415477 38621087 23044641 295043192 269427839 274324378 96894564 15285244 116080331 227201499 58231400 11882926 231426359 138532159 265846571 100844906 201907756 34093883 20539331 63943331 62424684 30877741 119927773 227057585 293148532 282403779 276644594 21449411 11501753 143344305 254898441 47912131 298437158 26810761 294549426 97302035 185110111 24429543 85218116 214485947 254381063 198939261 201710636 222496138 76472340 285942629 171587340 76730879 288436686 35342009 181080639 274296791 294831467 25406490 126965221 276501231 296130828 153702409 120745120 105323621 118576306 192002488 280842635 47008287 156947161 263069472 292513704 44844899 272316444 107807259 37058000 30722464 272213902 256606998 106168556 127650929 109218669 138247155 51858596 238427022 98779760 250535199 91852285 143182791 75380241 163736093 190507169 41407400 79291631 35262018 154264549 193821391 241213094 234481621 178452412 173868300 121705586 133392273 267434440 74847329 258808372 284764618 65869048 124867144 226790840 3134832 280173038 175126884 282370905 136394319 123419011 206490656 288084615 288761415 200462802 282162950 110379569 225595534 137147369 176323119 217591400 56484550 111787151 203372881 129342080 282004456 154305142 52906161 33031233 258427227 258747962 275492874 102733024 50942440 181493138 197002 40018492 23576271 277809766 91815582 187339726 138390053 147495798 241694567 301776270 236921573 168288406 293039082 48259414 19072118 18499213 100970478 103621307 230892599 44837318 2483160 284598539 278213816 293594566 217951632 161302683 1901895 32032955 170723478 231428475 233968055 180571325 172403002 166104860 42653377 124582649 120185221 222344142 169801291 77847244 179963558 118411665 85910498 20003882 57018996 208039358 297037337 224548549 289448260 50015612 276193548 99495278 101252993 99696694 83577022 42804263 47954932 108748201 242570600 181554880 46717135 14171623 139037886 253333760 248132435 61609814 50583468 239224827 147405583 193892509 280166874 198390014 145248465 226971254 46477910 256872886 177783682 247274880 268235491 10806989 11730801 241400617 250036681 101319240 3605498 158855899 165883454 254335025 209551392 35034239 86931903 127352957 21443622 130841794 21385200 95229889 73061952 218987867 50559427 44235920 216102632 254619028 74911915 90350843 62135078 219526913 112991413 73410270 235358072 103262494 173622415 123902435 247581908 177909276 83859172 210417029 235537528 85859691 207808258 116144838 140289822 174618524 246840192 163456850 292961778 81741600 277962589 136427640 298841738 210656371 60970239 267370512 206274158 172740481 83814233 150140199 88151071 225046528 37476070 232120370 45424999 234485694 64574438 152303207 178883741 175535459 68828955 147989766 186264245 190374329 216793405 67894162 92611829 182098817 299280614 53853586 80826688 32943496 251823924 162838264 28400257 285921609 65229523 80159553 197922553 67497778 259160131 148380761 220458310 283305620 219900072 176529738 7668921 238028911 167473732 238396032 159512184 168948725 88674587 250121558 53586215 172084794 301583499 271712661 287776930 125683756 298398898 126452877 300650098 70478483 188788366 38610380 172371684 165836671 83568711 96004795 29974341 208016640 229485572 123273730 253165183 243360406 264507600 251433981 204959213 97966642 203949342 189912111 213908556 218635010 65950477 13002815 242497549 72838315 53408812 288941999 71262143 237607769 138188840 295362398 217048644 249568956 229959202 21203038 49252925 233325627 100929923 133943570 87798404 243979346 295718520 220285756 47821714 281660626 230861117 188622837 122266181 82999182 240646729 140716948 11148008 71052576 96489998 286427794 184491755 59099105 264506629 106263083 58005621 35749395 104395092 89983487 223422392 29867763 273564270 196854056 65149098 8314837 197724306 67769101 71359316 85780481 20654464 47766372 135616001 104400974 60581910 278102307 295243439 110289995 31540995 290564113 303499158 245712382 283808939 90379010 153125940 149073718 28024832 229965316 284938469 97136732 175395922 111784907 98013070 143147898 301207042 121315901 237623738 252515096 215461042 164402616 189812570 53118781 187495093 7216608 282885055 127987311 63747871 262687879 101903103 90171752 245841833 41546086 20722167 40181330 271967368 100995814 80095088 228774760 173242233 206053145 270505766 60715990 98435676 72423266 244528131 166701996 36726250 1382649 121072381 76886904 84154785 86290486 204460071 287580570 178126870 144174539 9061815 250524210 263466499 272114545 285942053 159199179 28360249 43421489 283728970 248078599 247476409 290218848 50219093 1253429 15507502 268928583 35228555 92753855 90583226 175441554 206893931 272164807 271665544 142206807 250708961 269342069 256215054 91888908 136212508 76277235 194844098 226052198 62844610 220586836 25734366 95486542 45481978 5865021 104448357 235667332 271019570 239566913 284803874 198644443 112663390 164280067 17534028 262244021 67615938 99576804 138299671 182636017 192296526 166427691 224158456 59603608 288133710 98075335 96296564 256180566 32367226 174100128 73705631 227949649 222476636 50849167 86770820 104617279 227681796 73728997 284086136 66931379 99622438 72186387 253215244 252931529 210829881 212300694 251022227 \n", "511088515 760723677 240211657 518464200 298707403 506852806 842908459 308572547 755935336 418571132 180902030 26143062 281914245 203729110 143718108 588877149 643662591 654851477 655661194 750522801 162130535 100206980 460853668 11208567 607014914 478482198 371478144 279896408 881720229 223274139 28160286 526899581 681903665 722020921 284843622 398537513 893388546 512525448 427854532 698054044 662963045 236442546 15021056 22546669 679227130 240548180 322844822 274121061 197367512 491114874 238666804 177887383 600411015 259361361 223986506 867676541 123437604 156635001 113213997 514449401 931269497 501125158 35539785 688586083 814132507 418903570 634890244 328251408 162075301 519337992 37835878 618011994 717084276 458368155 726916643 909910292 783856030 755795506 66879309 236420229 323427491 389296970 268898627 201416118 934724392 365791736 440346929 764027677 597190811 391326500 817977908 418182449 566413576 713685534 32420017 452387261 890335706 130573605 425568916 364580617 486228769 173756909 869847841 588033000 644602825 249519055 728733212 47912185 399835937 156243525 396464619 155888987 794153227 199528947 891129261 19688008 912869213 410617098 610895575 246250120 107485218 143238283 438922675 341601108 206623375 300469481 771545389 392620545 437321344 242382704 848491688 767254944 401864381 528517044 217456185 374838958 593514535 621659486 475365518 927313028 673198943 911697581 164098344 645540755 414859513 873992514 481933494 163344812 657696350 144011997 607620969 200943593 768101224 72958948 789867542 693098198 351056364 840191816 406944263 745525869 124867310 762974758 912160165 551487676 280545831 743291198 579930683 92512846 379488416 555436885 10093850 486887588 486871556 182698588 469143507 658283222 763881571 412950303 461566925 653229659 370991159 944227046 733859475 324336169 40150843 10677224 692509800 327768914 147777494 808534706 190723446 195795339 324403570 930931354 166309870 932560253 905421370 607932767 555102771 696918597 816951275 431505412 253052658 290417893 255637476 306749074 46831917 118755778 638158910 761743401 662043969 237461872 26089878 54132665 919841640 291013219 72582685 276411479 708473423 823432911 383233863 742447731 164443216 191515452 702162555 839002696 801888904 582500550 250422317 244658385 208482962 402665256 15445453 485216890 116902743 389513072 686639159 157654277 388922543 324672801 337898997 460659837 848171885 860130223 53015722 338820114 38019785 862022031 560034116 266339396 229932462 148653492 915974622 78592837 462814617 262368241 676976988 411353908 321973488 638574515 372350866 149760609 749819400 373873029 299933467 489386624 244618894 27978292 131220871 560200864 110130805 351298939 698284374 213613899 6401972 403905002 143036232 73775906 53607069 18776457 854812435 28302164 429406423 332639808 140021437 933725095 356883048 628143087 712767125 821232236 702978940 817352874 366546799 627369597 843462640 160128416 635632591 542002304 685858437 360318372 847276269 868484187 142319933 711681426 365305490 940448861 769820121 565028050 760021931 28300963 86354586 166080711 411716279 12061368 161518869 396093676 257308542 787821635 48536696 270604776 538071365 151817247 574970531 206964137 10206151 129365983 487611097 417167904 641121519 57575372 331820572 680249872 16317250 176439860 886349423 358964320 421686283 453252876 553364771 573128131 24762458 911301992 155666083 397325811 176733029 374018778 308496220 678220312 305665333 394516857 615315170 250452786 300783195 298246389 50849289 47977360 192905936 304740708 505266104 258860092 339289027 435681925 451063696 447549184 150330324 473178166 910490470 752674716 654864822 341270394 557928384 564105299 774474812 150732362 628674642 572581013 437643823 611720902 351412941 807834852 614067824 391662953 468804508 832013775 776685565 659066990 270557339 259960593 391312357 119429040 480538488 428027989 317687888 240343369 588318875 709430238 218006609 228393215 121035892 860046103 913816931 648524244 238443452 273657611 600776316 767772027 166669734 92493504 615844854 314858290 166183670 736620756 295247895 621186083 903063450 654110744 453140363 101399009 657238542 371213035 45514051 603621764 176705040 482065494 549191989 76096234 303158045 788789948 493201574 923889142 928031618 410676142 128499663 710743657 28078963 224627195 310621628 712416710 202640037 350909881 569397805 397979395 166103672 196239155 921893441 76205751 583045734 921085093 111225534 483166358 323875326 511267823 938398647 359519353 925497199 562760467 215821730 147577126 156832350 226644902 236858414 945293281 504383966 491120466 542193221 619988353 173985733 379723876 522433540 459240781 796393348 113353955 393704334 66007535 808689878 52301985 904540489 146338690 474697936 488404312 568797779 492283626 411488171 642469303 788756927 589395327 859166896 721133439 704387766 265321020 262808774 320425621 688825324 589342428 601721093 749185010 71380129 797953848 543963273 20555731 46474302 89332880 801805404 210908515 880842864 27356440 371860869 447938606 417999763 646640725 667524717 84242618 82930626 464748469 868089511 369727364 828060894 654005505 273498137 545247984 704819714 938568559 724704030 765537613 168399132 698602848 853254518 680655910 631387812 369009428 84362730 866091481 299426795 11203712 266033897 549217560 189371878 413833353 91971449 117930114 880482620 183472327 7198194 359864151 269175285 664653352 328210418 26212317 513494640 676895934 10037568 722099381 126689913 57824066 521178535 865733253 474915049 162517944 610875536 791084009 766359246 255317936 798363390 467533735 934917662 663806800 62525839 581296764 923420879 131883421 832641858 379377160 220362311 908849780 127887390 877758438 896673903 715044456 76514962 244171090 839368757 466378275 761117645 743154689 852616118 726240660 447426603 886004818 729043958 326968812 527835625 186503931 545071502 880845415 17268175 373412289 826447421 142872895 188574505 74077187 314041804 44422141 923166411 62252238 28426669 76628026 461668142 582185652 822455865 437051754 324070129 66879488 622657964 721874851 550623861 871600049 262070984 850425324 342904669 912718627 188509273 577954137 77972105 700957827 \n68280655 89568350 104076327 103041896 61031042 69223340 7629511 61940786 88110304 28124737 92842795 98139586 100595028 103943753 79188604 91924308 21751939 82063532 75705771 16496722 9548746 121987728 1695347 52091806 101234954 116281543 23611889 51951693 20344984 67742430 24608957 32771232 64684756 89986629 109450104 93681406 101444297 59690833 100575453 17356677 17348465 17363212 97553090 2429542 32696951 32044358 97640665 7850594 42836610 112982831 85192406 92875681 90933937 114930940 73307951 31307188 9765626 115757067 60671700 100006799 97832989 6093529 57009801 40597363 113310350 110850153 57635835 2138904 83729196 54609519 96955847 70705694 74609662 110317175 113064648 108216835 63907271 65491222 26184892 119096167 39329859 110305735 40119513 58059933 25839028 83121136 25017615 66289276 13990347 48861703 79260573 63156964 16217896 47357976 88344885 95741303 19208753 68832369 17692623 118861482 1941339 107069017 6508521 104291627 82919738 108357180 51354832 64650590 82541892 22817967 34651433 52197892 23433596 101692542 48670678 105710007 19474055 13719399 68888118 38739528 100380292 18292757 70489771 105525966 17932955 40816266 51801816 79479461 69504491 114713817 87982429 31371167 68162146 110545967 85315592 30842859 60997354 56850742 54885672 108175752 23976333 93228979 93271656 9950785 86968343 32936781 48329836 78294794 96357308 82573134 108721049 101104954 55071683 4172082 204397 84235406 109760621 26383323 108648454 90361669 72002131 109507220 103982886 59969654 103348370 61099812 105720114 8787596 54224337 56536184 60599199 92361668 35261172 12243989 79746265 73955340 49577958 32410880 77152520 32158336 9042637 25730891 111523838 19361350 71234020 93201513 79671686 97887522 64754178 88036181 90968791 10237067 74297987 20042617 108053025 41622710 60196235 87888198 36398327 96137683 65851920 41902725 68587765 100006872 78170452 46098429 27367037 110454024 51191293 49578530 93053954 93000900 99333108 107766680 18612098 10693012 77702294 89641267 22985706 33037477 4307205 60436222 9553475 16000936 71625409 6767644 64361515 91549603 45328734 2803305 79446149 100230575 82001330 14455639 85262706 99599352 52569550 40420432 1458347 26994138 122680681 44369350 119820024 95122810 44628944 23059312 10055447 15254033 82771175 62781582 6633155 60690662 85016777 18863236 51891819 120544304 59929845 50211870 80394483 53546234 111814380 68156817 117453133 13286790 66225941 42925113 3695347 27423061 2342533 38570659 117670912 22432605 55015198 23949396 95189865 72721420 102779307 86585908 61541952 102434968 111404898 50410687 43481518 107359431 75344451 10684802 92952071 18639717 63927718 79600110 9833242 50645985 19459956 79264719 20136079 98427766 6265347 36099199 107259732 117566132 57313278 102388534 68029094 107589310 107244548 108970659 83056353 72198980 65589103 5190184 2824609 122265515 489307 103857099 649597 119451943 120372471 76034792 15306974 63575993 98026486 106988888 24044520 5825837 364348 16820158 78221375 90307777 34602986 28629039 48467132 925293 23698294 14279251 62876626 20792131 14037882 48883804 81468703 100948343 90835813 109901442 79390573 71924341 98299663 83919133 46820788 5627032 76426722 110247992 77943901 23530483 59470130 57638173 95005007 66473609 46479390 113791950 21615430 55843925 14017015 45223932 74793868 56666893 101457130 36185391 69978435 40612932 55867888 108858841 105158586 37750091 100568756 39927639 22545488 73856634 116098510 69665556 67095428 107465518 75314186 33116274 90802491 2614360 3662005 72022959 11388431 22271127 31446051 43325786 105437482 358991 94276038 17639353 30518934 10031794 98786774 15825597 53842764 41797177 22385558 70326875 65718285 75450795 18364235 35933492 30207275 41200321 114045895 78752971 80227389 48951171 66587941 118261119 85622614 94764854 28396099 119922868 60797599 83297925 104627204 111116467 69168821 63663649 109117587 29931020 20174412 46038330 46593810 5169106 108088280 83289663 69830537 112228566 54833355 114146812 40624361 99186658 122653119 12131481 26582855 106804043 40825429 14117914 39665338 38192263 120367887 90333997 24686251 37200677 40862489 120967321 82564141 15508694 5614320 4875705 24227293 94572845 18264118 113667766 85934449 83497960 21550326 26843950 5680753 107249280 114693225 2901111 113660783 93379505 96351488 119516836 113218647 97513155 106592795 100186793 117677008 121299840 97227993 79795423 122522725 35506942 94649302 119602314 87056877 11847953 47245504 66554027 49208615 85315468 17850910 119178838 64675829 24882864 48291668 37456052 73174979 49615301 62078891 68507642 55931959 24282123 23546692 98529964 95599388 40740948 120812719 47307254 32095495 28247027 21761444 8509844 15561052 65902772 108015754 1154501 54875203 2182539 66123298 57048527 85700760 110125546 12006554 5970444 24370252 80730722 12122890 57766015 34630957 119951044 75245852 53390969 69037292 63381435 47727612 20663508 37051199 120997022 87231612 31381915 78836824 87799319 35196223 53731323 3759998 42680651 103972282 27569252 45572461 51446720 3610544 82556573 53497167 3471430 75603065 88871960 15544496 111406287 71184314 71322693 56751924 79208229 58781647 35746386 16646453 79906573 73631097 51442368 20265790 114078680 50249047 38109085 64299996 101182359 95202339 118041602 10815745 29617228 79221655 77654570 10533520 94349513 88983267 115632645 6125147 74986059 4814815 105097362 73128041 32321458 44210090 121255409 16437783 37375321 3983497 32005946 12291470 50657104 99964441 69238500 14147443 5801331 104474597 23407897 19467189 119280465 36993686 13313944 50869355 89894721 83504273 21428420 76771181 110537516 35676282 16950059 99099725 103621799 16864518 49357134 24847848 87242031 93538844 105825371 51749753 24034498 12210680 31822836 115257454 112385054 \n166478240 511806684 451762728 242148020 151924692 683050586 125511444 480480434 39499485 390221861 82069585 282747915 51557630 36837641 243117053 706413042 207788407 127334108 65827142 666166591 670145606 257328620 474729068 712310706 453520706 31251287 511037633 127762899 129309850 492322829 95203957 466927908 163069688 268764045 370198972 533801477 654071850 599116080 392332412 472334229 551325863 384258076 193760401 487597210 273207550 83616433 693539330 90941922 149731535 289238891 91677159 21895377 210594725 675682261 176154053 189895175 560462562 511952037 34253696 598334153 225898656 173682795 161741694 402572679 356621959 436458912 336422053 272077215 577917953 310152204 259394128 277723623 118056457 471536803 650960402 675150421 469139938 212909134 59075019 475200 607400015 297287568 702076471 149892601 124331570 265628651 741047043 532575743 415910096 470732645 137062889 104622849 348911782 42918923 571577986 391513835 719139442 642712457 369099870 486665596 602707734 159979994 729911794 203738094 278826826 115435187 109452411 357952508 473239152 589393837 148377824 645740685 614160899 646432000 29004251 688128870 358400244 527346249 140810198 293371226 267634008 433613655 3391524 33034286 459684786 102715174 444873416 578672597 200865787 237655793 258876664 733071789 372668016 58988198 433486872 380641632 637168532 143522143 644328293 122538252 384304621 374395172 178868467 659509868 87607367 434635081 262041143 626082787 463769724 643834418 259853142 132857989 635722503 391515639 122236879 566736059 267524932 731050630 452858126 419303802 165809293 282156955 157676145 29826597 487582859 44917931 215966495 498685629 197125251 688843139 388537199 221998546 690000971 601621405 699382636 550963662 33092898 557128838 527344866 406824148 429353843 415572883 282005629 489483346 157969450 314100424 421482112 122359839 182982317 677613390 245482647 196246247 542106733 558188740 81995556 382477997 575836633 641501141 694027605 707477380 181211599 692500442 528324797 595272467 111619881 441268353 256035017 98301657 207590201 247353703 658855351 86366002 743516784 422461494 502851439 660220302 537618949 682786626 422794235 693431369 718064117 43644955 499189807 100815949 216955830 267269588 33614779 664642033 209885293 388285448 383842466 263392339 496813067 608997370 437924992 413545240 156013479 495326208 436329542 556970574 521144109 18817795 59308908 71725980 99361421 600070274 567317793 730989651 16637617 635451893 183924698 109116276 161377808 628447280 348568880 597923072 237833599 139279310 204242869 384283208 118391897 463844382 720695185 41434088 530949855 715302858 57397507 8632262 96165116 716533082 618541754 429997027 134171913 82199319 150488043 258467933 509693531 646951703 397867153 536045648 189047556 153622171 74340626 118986917 714183378 589653193 645076629 174968719 660147100 444666028 36171768 68440497 714219982 576333540 708176683 480129365 741443015 179546336 147097572 618948425 274274553 479896653 568530743 302256916 80450474 213482278 436586554 731928258 129220603 186573591 315239191 146630307 284459774 735665603 372676307 358390603 225324042 2021673 320935560 389054785 424387441 169828792 607762757 388086278 243939498 355061475 486916792 642348691 429386292 359559317 94960473 284741289 142915853 12689262 642268251 93430507 725926905 379882498 181597969 391908315 668451061 55533586 458491253 150844598 271866461 501454572 526639621 743013207 598138252 503802708 631411755 131290557 608258774 170001366 455172038 243004342 520588282 601638412 595069911 305155327 301188116 112584210 517285396 395251384 476921432 711046426 407420503 331855059 193947973 663231765 558924299 77983877 289084346 565433965 498588955 320150465 730895646 881598 153138122 369686892 178653370 416264415 334193258 509898566 299418302 553664296 636062323 241430385 378928168 52220995 449531245 345711003 424363097 12366011 132579663 232336153 266133053 27644293 490155092 445349519 173935994 605370214 645517168 504179266 462498285 411307183 85881220 636631239 576592111 246780940 613400718 443917226 192862880 255203764 227125247 582417141 104856040 366874229 28468719 109203416 722586217 136884325 511407383 6092444 527156170 77597324 369077682 395235536 227416173 111583199 201188666 393475542 290798507 287829483 662517400 94468059 360609462 33900997 179372255 508758722 250291294 349808977 265972527 491771433 143066815 124649037 309952516 425402539 260835995 696625022 48655575 602240775 165910469 51444671 86752193 510786410 423399788 356681115 121600986 106756473 160403701 429703727 590144582 21689059 508585274 642059737 300127159 252373094 728585129 413643030 23141547 96809586 455771605 258605264 340029822 596629110 717282848 125178824 738379287 638498726 698232087 354128476 613887548 506109940 697327037 85924519 277107583 660993229 105341028 151211284 216998999 304298907 5764696 402164844 675438037 226704595 428062808 212172862 363689650 123845058 554129060 316615435 462217508 455285066 270846156 18246650 48854212 105416919 185158 739724010 528148749 131452003 222023127 406667731 156282493 107993731 474066817 291495352 731101496 618066281 181945030 518604845 81175566 171950438 58160576 14430621 606822454 531005189 299695756 256715006 589300446 390078800 688426978 489839523 676582497 494611893 174947544 474419576 530743400 273712000 353798140 655956980 133087343 44047248 497225961 378374436 571878756 129263941 279637422 738528810 324280353 386099030 61017766 416828740 135450076 739751120 80030925 345846156 367886235 295279197 47402732 304404872 258271346 640802052 473066402 269295365 586024459 569361896 417133921 263538127 62215512 586386207 297666349 700837336 272525430 448203382 512345438 617676377 292146848 342823846 271495089 16084881 731653660 154310682 679878511 223682814 263196598 590534065 244156709 370724799 576882656 274153927 258518195 115804112 615833239 217266897 275431000 387869561 222929429 660588955 713351245 95468862 177321460 702100565 569334825 195288481 526254415 313234303 498620463 177443011 654377567 553781096 30782694 117082596 288615609 523749402 546733158 690170194 80997606 296654560 109445368 293649986 597664664 558813183 598235399 50765438 555754123 122567774 439257914 542507755 436516579 579352821 310024184 714898317 513571208 320258604 \n197470049 476264215 86088027 847082731 353054236 186310768 671401087 202775489 198899928 905843083 649699138 344732948 527051759 825268651 402583550 842616260 873618100 858385756 761637054 516138074 630232196 231515878 774550766 786220113 810293516 455405149 467034461 507694608 755390833 394070288 245998184 137419525 903073041 476965918 546109840 409450431 322082370 136904167 432185383 396142590 414077058 822390045 885198407 868484987 603960792 119837734 568141822 715223513 97396007 765217214 899479592 620964599 763468946 861723506 191104484 761176423 722584361 483084377 370547875 288597483 898203171 530931601 418340490 352515099 207288599 729700685 206585090 327086100 90038192 449196106 674429144 42424078 804324136 817591710 107691710 113121461 41127674 548289495 596948669 723314660 405752500 328486715 869012482 470464158 255089163 438406251 426950027 896174762 86854135 111352476 306712496 164718017 772606068 923236792 298776076 703362619 214744826 841629320 281572351 243666981 408893418 798159209 816685978 553683715 100924997 818381746 154759955 266182325 742550238 716546318 709869380 729048822 70669117 379899539 325593450 143140623 124805277 920017991 399561965 149238429 97303234 198582613 907155680 217101031 259552382 134390357 701919854 723760688 807357929 621479280 476041534 293246681 421826860 749775314 841521921 858401261 500536489 280085377 631706968 46975739 530264788 285226192 296495991 701475460 807836860 258116095 878992355 571169780 490258446 222525813 254945355 32018233 186629126 416326196 804851704 909518096 122556146 658737651 597331922 476979215 849369178 756637882 672753411 507445473 49957758 565174532 592911778 13388450 499073909 153398610 243283016 794604402 295232941 131895860 267870661 276356971 744928609 608091697 310138020 680566319 29398266 476553102 723268334 22032805 847677207 282152167 566355861 255063059 298209811 338315217 700250079 917613884 174103611 879334545 699233938 112683583 751175587 580071888 760717993 214275938 831379601 202329739 711821556 339237215 592141521 855605094 229395240 511898945 72468495 526737989 5022069 740267589 870729899 365859162 310061799 413393789 661611947 155869108 818889355 351814056 615233944 309240895 641796571 433557602 729394104 435275593 424585866 734948237 621415773 791095392 483167558 803659485 858287157 731936531 384860553 634603059 923241564 793128445 99037288 279686961 602177208 534122755 557914893 552964136 634544968 325121079 874666368 504343940 623911799 510756871 356092997 333017004 842530602 534926560 670225210 515879215 226220409 394467348 124100709 197789254 144972125 217834661 677638530 199888420 23209895 659762530 714205068 599856797 186940554 175817101 171123608 229764173 178104445 346990545 84354179 889488222 186738309 920390636 94763286 102722817 397615880 192590768 589099913 381065964 884351613 866266014 227216262 422891570 283357499 773482631 908856746 842436993 674925121 645801337 398608043 263250133 636174875 437063886 465043097 108725392 913270083 877601193 748344509 344192489 820982721 125192681 876136424 4205757 893319515 29541497 345199455 506335156 324296969 419758475 636012595 913093293 205132366 7721871 759464501 556293848 794466164 461227390 787360954 380537806 735482560 168478399 383335843 735210421 575622974 220851161 717545601 568390306 216395459 359104073 37330942 779730006 448443777 487075242 5937984 175698739 531935894 125633613 580376519 478195997 484278993 811496174 619956191 293232475 200271017 788251864 205182227 714603045 526975244 839722194 262095146 873889436 849641217 548457579 375558474 791330885 732670237 701277213 305375089 324350528 895056371 364885530 379311694 719359342 467463350 239698930 13819344 26708274 79355368 184081880 227110683 238233226 154703260 641603288 98743818 114944520 858644417 509038630 502376391 757440616 269353506 98937417 83283876 298909151 590319524 43047124 239552969 838530827 160047997 851697121 283893914 779939298 688452522 33730974 268795317 674775810 293560783 95101018 829817063 780292737 919920541 640941098 270496373 885123373 464692837 776734937 432777000 450080751 277185890 527661962 540292646 883120543 156485547 58027494 677828072 319602697 462331783 401803530 660333514 129710424 325478322 305327058 243946461 718047879 303168873 313331155 739395922 752333224 854847373 611198792 40101041 496891248 250950017 630542440 464825104 263202115 737050415 226203359 552331543 537851275 298225340 857672662 60526273 780838440 302897840 684789284 65569782 849339445 149895783 753737751 529833223 863644304 155549966 902589024 914695082 575597945 283261000 48433500 421855573 578358646 250269796 158304605 852642876 496876233 295902434 578465664 140966337 649566836 618342169 321716788 614939203 884687323 537728671 297605512 253514740 521420173 565925647 165031561 138348608 794705663 571368150 639791462 488852441 64193638 893697837 552987570 814247712 466384245 431723005 230356784 755614883 624115002 557997248 132749826 768601152 573300172 453824070 614358686 108600548 660591951 274626515 356495129 304146776 405654315 258483737 315755547 766285061 801692051 16812377 679081293 545764851 87230333 390845052 486981394 378905855 861040219 357675963 540973184 559607406 265773690 321517858 501359555 386941433 765473244 286569807 435408415 319638534 408092848 776035220 146034589 370448851 17930556 350110403 30726668 251770405 319500678 82083937 114110183 216604132 99324539 644295047 169110859 872852408 193437995 648676350 156793740 857002214 850990868 516523589 27170032 813978307 74703409 181580982 236718150 758061708 166474620 819211210 83671613 266277141 243935309 916868055 847507464 444691531 282739853 332187233 367481203 146159202 3807751 219209554 852923169 22108763 596740540 75244520 410387286 179329912 393326101 175503774 268900521 110990621 550295849 781216154 499180454 743565779 58867563 107198919 322288336 1060175 415154399 500354879 76744259 900929448 422391770 807249727 152872635 669148989 650171466 6093361 862928930 592405384 616861333 790419409 539375906 247855020 22104938 671130441 857989809 195915621 587481893 741761175 771379356 857741810 356887713 796703044 52063257 612972868 208949744 372342938 889574351 553782752 19809234 122086162 381230183 413477047 439315401 395693045 529796506 490429085 910974647 806567592 227448386 68680262 464039115 58487371 602159429 826424142 784921163 577756987 558867081 483315237 321153776 921397233 542174845 241051168 68262973 708404562 225871402 523055336 391872839 15859789 260796779 785449639 827503389 352260911 859848661 581146996 423467058 235861556 796091046 70178448 433662834 238134174 350397844 271926067 245898859 700495679 256754515 94600459 810118919 804230586 761172946 502229305 298712722 832811167 918128784 106049576 359548997 238990594 798582807 217327182 137737464 139839869 140684100 205320553 467290083 457082030 345460798 546228041 554299666 904942133 650762481 256291505 904903814 711288220 263981595 134478509 198773930 537235083 58978956 592464790 42891285 127549680 97061027 202451447 478686790 82504364 69378050 24808963 563064078 195278042 478085606 863161521 427510087 465803557 784263597 68042207 501116031 348442795 153271550 520052748 \n", "67314467 176979221 273222526 140971949 130844874 261490517 213931869 256998836 164312382 136606582 76833041 30035680 190684814 16673761 163320416 229728157 212250820 19219261 116450110 149244344 108563399 142649536 23257620 275679005 154304874 53352871 281276317 103760863 166362893 83513903 239972648 218353683 79882506 254716208 22602177 133914455 170452740 165124843 259395456 11308454 261099566 165798771 106467402 210881111 162593138 98725468 110369462 80657068 23918616 14073247 143589997 15598623 88913563 237929053 236284124 177332300 66479040 18265605 47396562 173344272 61485782 33435309 89040937 97795919 81475473 50734083 81772978 23982728 126942133 264658723 148873184 62325438 202934123 193580682 189901841 134453341 5350661 202904181 79321114 77118945 64926347 261924880 26863890 127718028 258460746 250517686 172196629 182101568 182539867 41125715 124378677 280073087 247664538 23169947 125637673 139708971 79336318 216611540 56267907 138345670 170053358 99614856 268835536 219420457 70048937 137837131 223883477 254678730 199081959 157548366 29379994 56728620 129807899 271794920 277459483 109208180 52026890 271263516 265799453 156537394 6442711 10672631 150142167 28805932 207551565 234235556 90448809 70830949 39097970 7051045 210677923 118082352 76534123 112479672 247471979 189629831 205816836 234466496 51601572 6420514 31173134 56946412 152553823 185356858 78417416 92299589 123213603 158513589 92702534 262657183 82661569 9412048 23279594 140146228 24928901 55687704 200581426 116660856 252129798 162915364 146494591 206922358 185078772 48264640 32069549 154616255 169567321 255066952 23981671 7285821 162387377 137141071 177841296 155889262 85114491 249558327 154840991 109610266 136772764 205967523 172431097 23350522 168736726 272576241 191148770 66288804 229514635 62568597 190894161 226761190 86855459 38146617 149253470 121269630 80855047 246275299 43135182 40414990 41357127 219688353 34484289 140075587 157851875 27827717 118539448 13062489 159336240 83935466 133967899 3293362 27900684 275438051 146101367 278807169 65024934 244007044 1493386 60984352 185157281 11618280 254582439 255827111 262216054 129814483 203325450 174388885 185393815 261786685 5886046 84601887 131397401 6570959 214129015 201874495 172087628 143077251 14209676 29360073 141792884 61125035 135092189 58070845 90578667 13589455 281176562 64121663 65628500 83594104 148588633 159755645 57727305 3123405 105843907 116873160 156490844 91645101 45306285 173371765 200736130 230831905 16566901 23675956 204590775 187706678 22825980 71672204 47606599 231248770 94969112 251267246 222293209 101019634 184795055 213123560 168057679 3461897 248127820 133073891 168440612 98797284 145853210 158372039 105195023 224333042 8496577 99988921 238406895 164753630 89462228 65900798 278222143 127660670 105947713 95604424 239966162 271110917 257472410 99361790 39312176 244055998 278600727 74139017 189727580 178343285 202382651 187856310 62002430 3739621 267074398 20467391 94792219 273874986 195246842 8603043 37347267 20958803 16697455 213808728 234163541 228572896 105424104 242694735 192774480 85998053 107318720 62890304 147645090 26643177 66276801 12603278 79821631 85533035 10712601 155770974 190649075 113655062 213445333 281358999 23859945 92156763 189395222 48638707 128000638 79340387 109902541 52605692 130036481 203478421 244297237 147584280 192805793 57991344 1948446 126152106 30038004 61128230 137440696 139784611 134026660 277267294 98446244 234691062 219067830 208659614 11936452 107820039 226663563 113532613 33136031 137137665 14356474 122617922 103208298 168448813 278711705 58979269 3115329 177504453 89153923 158662446 199951024 269838300 149620841 229697256 167100478 198666452 85472527 128156262 31821812 133229649 151178718 27841902 158353344 234180047 8837167 235373750 144719615 195774463 268422450 193669176 102259325 24697752 218840482 141113517 140728592 71248290 209739389 68525018 53712755 178522245 182463301 5529378 4520551 92871886 26173489 120539913 254320199 157670223 75260164 85856810 7665074 267329202 111768743 20909150 145693198 103858694 83173604 164519358 113573773 262554731 267021368 120901529 263044311 73269967 138454395 261677645 165559467 208941951 131895244 279546041 7889676 151359074 100379828 198233309 246035668 55577974 151562420 30895795 115259615 113455996 235380054 260177169 239268746 150389684 69688644 122640497 119512433 247913247 115683404 30314930 223690075 215462414 159687069 169033777 187707515 92627293 269486470 200914818 278526703 83561210 234745813 41501975 20334594 269017169 229530758 277898912 61197303 268983230 61274998 148524681 44193314 72756803 173182945 138872636 136089597 177185239 161869734 171613822 266335353 70899947 16708275 25266263 254581307 87701362 209999597 62177057 158705289 202053114 93093152 226981338 262789511 215339398 107007580 146211159 127729144 216125160 278239533 235957823 77497589 68196170 97912531 53182593 31272105 132974080 130413147 172722409 33118745 229573374 34791983 193904749 187608035 148387007 63896177 50309149 190098200 198413323 251070306 267036214 156441260 172211864 159477518 61022710 138905093 17060848 65315363 115971715 277952810 46994096 245886139 200172875 72892541 196848321 229138053 207712704 49212922 86068104 67953863 61162142 148301083 165094197 124998244 52778361 161209078 18989365 120016607 69346276 74524449 136214393 169844317 137986349 247349497 177128641 250181333 43227448 42875670 15537331 17433061 27415284 10214356 107939693 201438620 22503609 188011626 140153832 54733913 232964703 238777205 234322887 234937667 259414631 268729024 279204844 151905196 86501644 40656445 237974957 232736513 59685524 197135186 121537271 25162079 39808820 211957722 200791779 192247181 200919364 43213512 169519207 210862627 171019129 167823350 134096191 66771504 38700443 28684836 142737427 220889447 280766657 233189018 186876111 216340187 244362492 172457156 247762656 247325654 221143376 58903743 212078902 29625159 172153701 224466344 272490848 178865320 106910313 68043137 89455030 168766152 85914717 181033052 151650555 261732632 22584499 109265158 75978360 162006913 165778561 174785368 846049 131744605 268916086 88788707 2636424 124710879 41997742 93063734 34514419 8121843 129208574 177696118 99554925 228685053 246933446 35121957 136504885 144842818 134517500 230329392 180537756 16808277 176243988 46642972 174545510 108007163 221656292 17032445 252438923 237771169 198774411 122117797 56920887 43056220 162271715 29437265 87677908 162839127 4366840 190917684 213311966 63785343 243317354 196275260 248728638 159460039 262605578 221245135 60420784 134782257 24211260 166997558 109289173 239845096 94250550 93245743 122830368 207572498 11795777 203737103 174927758 211593649 183261011 58929466 83549537 260651609 66197629 39836912 15805795 84153750 51077835 280480373 67940792 17908627 253772490 64463894 171141952 189547403 162680284 128708241 35271056 227948909 146551989 50474033 6008654 45854495 40036237 191417466 270345568 2751389 213336506 22437469 114901170 193944553 144562563 11702006 132641027 174794901 10378657 37046866 210293591 148033380 118361413 78765679 265528781 146083188 222569307 148248128 228080649 15803872 52754055 160624534 198944919 167981286 243592396 181875338 180245219 192221580 140549139 33083406 248618236 132841941 131334595 205902254 60455555 221091057 28680651 182806653 199582171 202127726 20914524 240374545 42035612 220038273 199871539 187241149 172460856 61054924 76747462 76622684 179286057 177800559 29683986 59845490 176256279 158596021 161147612 91889516 25357027 244655242 267235227 184243383 118616515 253398098 52061198 207897665 236560297 54864684 163586900 75827231 19499353 202143868 221969784 72481028 124749018 120051706 231707628 106878901 79371879 128501981 208621825 32000809 245130561 131631278 230236890 233813517 150441659 248623733 2403959 202626630 201257224 32967168 2210080 244931483 190152819 163398346 42562820 198769571 17892381 123382906 215948887 173557124 64616377 267014914 79772802 210355419 217669559 104998394 112258892 159276723 248668920 217473411 94439309 54449607 36826897 70726255 107067957 110586693 103145463 10106191 184325734 16342176 3142329 29050275 118212278 134260114 162316392 163679618 147305968 11790860 271014099 14983102 175483958 178923418 48137806 84820295 262117985 37251404 176058341 280236236 251446630 8936198 24855244 76765026 101182744 242215915 44204186 112272584 200397400 73013003 102441546 29731524 262494629 155405088 31890040 61951175 237830990 45024273 217150504 188296206 166334103 145425511 165845927 125607616 53537084 52751923 254076777 94571246 159832374 267814191 134078796 262696713 230727219 253882625 207106902 46292314 7438268 208801706 257969226 105441095 151253247 162342212 118961504 63570214 215020791 139023010 55969540 272148160 194861181 23258119 80464352 68697035 141404402 244429569 87494054 279977126 63290490 221344997 142200993 209570294 122199208 88732288 268051918 247017600 215749858 280928193 149500045 165853371 80464898 124567138 239159579 20397533 239988266 167356848 76302734 184263704 232138539 121393323 177300723 23111770 246971725 208200171 91803482 271201679 211181331 128012010 201733281 97489521 56471310 161754011 195363655 \n717258754 259357262 115623755 164326572 232251222 91443590 439249061 571777357 702780103 299933712 563082691 300195148 185082017 341827225 229200739 474859207 40526265 716389201 480070607 342263545 310679488 158534631 627441535 680816364 143695400 62085625 340947804 581259754 232263814 145633098 726707937 415108192 489674117 94071335 196344148 526098211 651498769 358414757 715424740 359998446 578455566 427240375 403043387 331319306 78758244 301128928 499332318 328423403 76969892 319660384 222378501 616527373 531266156 38854452 183936783 531728556 368709757 550030701 393890779 14079823 21131647 141910451 316553616 44680331 107226785 340368446 506474156 53316412 336051139 668137673 627314986 426291642 49007603 564950043 176485507 568272264 608897847 362249867 243332554 401984462 69955546 89239081 356597624 253802205 241299968 265702839 62388642 225526175 51847271 109956934 158445030 391065432 652908398 435644000 172172581 471261157 353142731 716330738 209717376 244225437 198722778 417949091 164400818 598742734 351858324 661789673 459272160 576631475 507220271 104207648 210895345 262991303 48238480 85136352 181669272 558437234 24952941 622862662 145168403 388322519 161442913 23604953 482616047 207605969 605211069 722544135 144484851 482903770 80474547 128385989 642947524 465540497 704500182 413680431 541405787 510291573 571743339 213329806 613785378 27053792 565076211 222854970 16185884 524906475 241947421 429930229 237435918 137471486 390451972 167280007 701104112 551399253 661038099 701030978 272904180 661140476 413628865 522473435 229465478 564869067 583978539 330270400 51782663 596691158 654092046 69343451 35804733 32366452 452131614 376655964 165241223 697987635 159865730 488847884 338245335 40911013 376101759 204937066 452014420 506924606 603119038 498615547 206000948 104961231 523248094 458852157 351161521 79712709 657291940 425693862 673323891 476073560 644865789 468690685 146854430 318138298 124672157 220286340 685876662 151615940 596341882 376844136 116856692 189608858 94615058 127332058 376990485 329469942 570520383 653253157 31165353 569115326 529159431 35367337 303925363 418506246 501430877 571488969 608846199 208194163 470685802 629423816 644644506 95282479 417692475 509799291 430446119 240920814 580078109 601607163 530008100 355102836 350247156 227073226 218904268 355407548 645853371 619256267 58907222 606983314 130406245 287773325 328822905 494931808 547478184 62388901 201977493 374091629 124967667 128689909 301770110 55462219 151575028 257270374 556124539 39558636 469930865 393469903 285576381 35434210 693138350 595166777 366141672 157145491 39803059 573905888 477467967 3216503 374988660 164148221 417082060 33852552 564896382 322417655 677038665 672045447 236190532 703604347 178906125 607940372 370380598 589672625 252683373 596607716 149944188 454946459 46521670 315838025 693292015 635080465 511983301 367555614 661804859 690263105 127835163 31915723 38245981 643038846 640875885 388153587 727361930 207461680 44634874 187932184 701422294 379684709 398463605 478094938 93151764 342181784 606983894 140465659 608646247 357648252 690842917 25928807 270351937 203683008 345258649 424814420 469849507 311722607 325770543 542063676 691214128 70409054 708704464 180687039 513655116 252124828 568779658 412481818 233329203 77036030 502859216 305916545 51069613 684039831 164877778 457580859 461487584 568800128 699110893 132165884 127773277 565383309 672942846 179048089 188209890 71390507 115721638 254000032 550217249 237931112 710894245 20739646 262928273 229838188 67798269 218882509 285654116 650191077 687772685 73396233 256693106 302835847 503932515 719885831 401039937 708643054 37434564 209155132 1995188 446100972 586734677 613790245 491684988 117285005 139570740 702869705 16308698 712437113 644117840 414434108 607638164 339384358 335011493 259107910 587770612 606752722 700664576 264511523 15595686 218521895 207485240 271720757 722575477 119203135 20943166 361008149 702302815 106869919 689547603 354932495 530842061 473681186 158008391 111989711 181235204 681955127 519749 354037295 487770805 36773189 230765308 163656565 520302153 244183998 46567853 261287908 309006411 274184597 568394558 198051483 511161734 465391086 495562666 234175557 604766157 37124696 608613328 648938727 545558741 401827723 385695336 511342395 252562718 446072630 55183935 373506884 181579524 645973650 668063739 107523853 300909244 187837547 34774069 623279462 422975408 212917553 321903776 377594463 245958307 118295108 271336786 144475228 492490652 592661511 341692576 572367482 710941999 556112053 79547512 375865115 304104178 8616575 427758153 510422230 602764833 699209715 497775438 94856074 142571967 390516658 333271724 184764853 422624843 129792397 725172774 354756361 33866660 573125190 295004790 352379142 684974615 647682762 526724693 229041004 655807 409879414 710347495 295892207 170266337 124488827 1766422 5090427 420073357 192413382 429887893 394558805 487429424 728320536 625141234 264646123 117102766 250485257 180071109 413735082 218314544 404672696 363938638 256571826 109178863 219958146 614942220 112639207 345756390 411162005 143934331 337629251 409894159 116731076 256564466 76208184 706355756 174298309 698029744 294481860 443951077 256145477 97566512 388685922 474498944 344769042 39106767 463790724 379688610 512317904 303237456 538120574 607983916 53803776 41625916 373805308 677329724 510131976 443978680 33673235 288208975 147048975 131984184 479319848 139027307 550187135 685734648 700218325 700969524 338543469 331425114 72362904 555889312 168710561 61029167 579669115 603763281 55630872 184868492 36145209 360555106 695305365 682466546 672677113 727004104 726403519 661490754 348989162 259032575 411464242 460061809 569859881 263700060 269309428 481436894 124981782 679751203 128541018 96507862 657070485 137838845 362480541 244463124 430811255 611718569 613407105 614080409 62782638 459582115 173793275 432763426 79124797 474108203 141690380 537803514 200487783 551978522 121531727 649190536 196521283 385129012 378717927 567167493 631997388 511864859 517853285 498426683 676201074 280032669 25271653 36912521 31753536 486370774 713270043 656115627 687927157 714609406 116930270 457751236 282808599 102540188 600383541 109573469 680243279 265761620 596318113 427614817 710357862 62255393 99539000 692639667 2415811 113303787 521619510 53957485 57759656 588055150 645888198 435254414 55246220 708855861 263244259 78879664 384108950 5684648 137096403 401336068 390487325 684705326 673829729 507207886 83288368 399029522 641489349 491861405 156757220 265670071 673743126 209206214 164899223 467280458 149576448 344343481 289332754 512371128 589358415 252003866 652800227 117180956 708345788 634247511 246290662 612112539 625729176 401243842 637174207 589590762 36295676 615319265 295471245 337324818 146695367 502193683 353982323 650402463 687465081 259210177 540153236 424330140 259234117 410532493 605493362 354222502 459558965 261313204 679875413 229269409 325925278 580119192 137656290 422784296 501636672 442511871 81917164 405602830 13141403 560449765 28114855 352831904 229722733 292141745 490863329 48095035 339218062 178554126 711774230 112156418 599273137 164298598 133832693 103762510 158414460 59963259 560075989 161112970 153421438 224377205 127572955 701929484 119138644 507178227 552810449 160526686 123144291 704112726 618652591 240903287 121622687 642578588 499422815 203825977 219266774 711588338 478756085 25221685 625409530 619821858 258966235 679330641 438605117 583164388 412702160 556900904 418013895 690038320 82322525 332915841 523720432 105006294 301210972 526563920 589797799 658352153 390523278 284902700 334061405 461319559 693366320 580787952 469729647 314054706 181938709 90620043 504500154 668868488 279146986 486802907 536255994 417388224 364014788 644615210 108618859 387250234 83041774 79564111 336107208 45683903 233523815 680444050 55984859 146146528 432011719 563398351 660542775 11013050 706810015 4574118 196469070 373163174 55178805 549068775 384732408 361758117 264377173 412849963 54937617 235358770 561463760 288370756 275965869 165999135 572138488 92226366 163077301 571019368 155558752 680463674 560644847 60264725 130645198 174301276 410740654 183416464 58642125 243424165 298175802 40925117 550237773 141629613 249493478 395903492 59380691 134286683 718252750 319871334 336042531 640526479 66573976 413656596 96473602 427292339 174531487 677601717 314761252 91656648 88789250 429434146 557853976 182415088 400979053 21726266 \n329635475 652626729 646616076 236712348 489097845 99308792 207539725 646169857 335249390 243586801 75101155 110540974 463989365 530543800 645527510 445331742 307074141 238239792 389809759 185176444 676201961 105987898 199465395 23490339 568463150 618680707 571861972 346019936 376916583 88043783 327307009 443799277 92059599 570655181 608752589 310416176 370784996 381342542 636162598 303006524 438377364 113676169 119554275 74059936 189379553 123053736 29540785 256354856 213311836 629825326 619519290 153142889 403367114 518105898 140871160 302946830 488476462 579020987 220552768 311168618 175270821 112172314 6311752 390413952 466385632 489418759 11305910 638107259 416405313 42008289 72055080 506208117 123940731 279274522 387730581 156826797 620586833 330442905 570960164 208305522 165407084 664532527 651942376 226145225 570571626 515434681 243577504 236249702 637319328 5698354 630043270 413391705 570393199 35309974 517445879 565086502 159437526 215197455 304099226 330860568 637890559 38783152 242931326 148624789 297612102 621683039 160123191 34274097 184155206 52253876 360347544 29524963 302111370 181626451 182692740 351836547 451319893 141803454 611088016 23738185 192367408 131389371 342527847 78029188 318249785 250790969 416481871 374436128 296253893 357126247 549971212 89151409 120045247 327151339 241732617 519738157 382049673 600368431 553653276 552129316 345990110 107056117 365379744 231011512 422059782 477795677 349508552 348903290 283876095 414186180 246152199 415381208 383553367 259428507 453520501 576912989 473638207 46287071 184652836 137795611 518609747 361035288 391473949 337349031 442141460 661195325 419828892 433089790 368346799 523060516 561821303 671779501 5504359 123212615 322904746 360737988 169304093 298226353 561625490 657880245 630717210 593398149 328739053 662466876 467183859 492990992 233626396 611367945 540187912 489638463 493854986 264033697 407172771 528347765 303013901 198557613 457154970 135003251 89961705 470575327 201323156 501876741 525655622 474017484 536445279 512850426 319340447 385500571 546838882 94350325 94219692 632818610 388601108 382453343 366796110 341858571 429531916 447922195 33436139 80700275 505011382 494677918 456178799 360670688 544971000 390125713 649389507 415841074 579505454 89917225 94306161 317099573 244483455 215876846 264606903 105104870 642859585 633340146 65017466 604493809 607803495 54200088 472851489 565733076 440293056 412263907 464271148 562117697 73456482 396176339 484322168 679629326 11964704 167693916 262278526 481316451 473831128 154508636 130856881 496864676 242675908 287725233 230785009 363829768 286990989 273975872 391454025 67030638 201016224 114698006 114890321 240070433 280527097 379830298 625358920 505538997 633574961 652127700 8405684 132456770 89173476 320183174 388370561 332927912 359199740 579556887 178871143 538059315 432499031 335845927 410935055 34064751 41506370 195580546 356717278 254204946 566821009 314742610 374901884 447599174 298790020 437557321 623010268 471598869 383707518 279744572 441475092 376711967 29125788 483603480 485379459 91208361 119444574 134298297 277951735 76884847 26803769 142541064 327572568 82347459 495763123 344955693 336000382 677012206 249439019 61465285 570055615 573036325 455275789 336814045 676176008 588157268 559014105 535551161 319404784 196061486 588005687 195464230 284382613 385716688 427393864 55834967 448632523 515643320 77567848 416833969 649323138 165737935 449219611 492978414 199737734 157192736 274713056 328242296 427910898 552978854 252093699 375992925 428532244 162727780 345212221 274466991 336424804 505241050 411059518 335321758 104807397 488888037 269926557 204397270 271097644 175333366 274520043 469339345 597673858 536979438 34719920 103687240 77536419 70734942 414741422 392239207 49803929 420299390 27503772 222542926 194076490 501855571 240217601 498999666 670482629 622026971 69369317 373712369 290450030 60918466 362155341 49105088 661852616 137490940 503110971 130960819 54249962 319008179 420579815 202763738 216652408 579822604 73812810 293188392 522265812 277330405 401923836 246794100 515480997 387849268 333897874 457239953 164032920 303342234 537537736 271399537 81744915 222599849 292641797 676852408 323105314 314468356 161711700 323766978 269988370 221628332 656243121 675747216 428750082 380557443 616984347 317360505 367952874 489198855 426017694 213669342 260512674 500280384 354012053 241123304 147804493 207123265 87586535 395748265 47959468 410006538 3215171 49946608 205060745 47559380 16986957 580039211 211981558 210125134 671091802 108339320 624688074 207088552 406769763 528063253 669185001 327984204 412689822 7102681 484938235 250673561 246145290 582839935 342616277 107918563 421930239 50635150 446433762 258457786 451790790 74589302 233602913 642732398 3031754 407184634 348385781 493106257 348048456 129544824 116187335 512611280 553711681 623274911 414140522 237154349 270128652 618962331 439127544 442659502 654892713 26162811 523443751 233595504 554440090 367117282 582087456 390507335 646619296 597544858 408083437 150680616 465933150 503900646 447988953 502531138 204076768 482308302 83816308 397250137 18422165 575824165 52325819 47977239 152832429 346611711 93599298 116972605 633733371 19324372 21716022 217681750 153485156 411582800 446812535 615149900 201497547 574700474 82718658 213593631 297284419 88294760 552152154 431611264 310256539 479905942 23133338 423514166 26192447 402826706 349466241 444046185 122978525 443392007 70182082 656414455 18661912 173503154 286098683 150893348 289049669 499591335 99574965 209615886 463718697 493742409 364575900 226579881 497135784 567177260 94224280 228511976 231039500 553766144 501551580 529151532 273635055 473381361 385899237 436004032 373270264 436426347 82241786 547083083 412316915 616282002 162385585 244345902 272742591 360129399 415234857 375258111 493743363 208838269 431831519 636971667 349858460 556563842 623057716 389409748 52364587 334741111 296088693 224042639 96469019 276608620 143818411 644697388 671561399 676889743 120953056 527277470 334015998 444471134 280008500 221305494 294856473 126680265 322294902 569388594 473901381 16442462 500249163 46088029 433046043 269488055 176931364 238403057 380191609 506923066 316629624 302251837 222950395 72498312 472152680 27835798 561202687 603556860 427410272 23931129 307950384 531221844 368248303 525673431 360357006 498672168 656338906 498787855 677111236 526264497 474791421 129031273 211433580 62225204 266996109 183085436 30203867 631694163 165438403 642425145 126089983 417215610 256278077 33637834 496955071 359364753 516972548 617176968 76481035 355726926 51346603 73029255 522174614 597029885 574901832 54645475 22369534 490343183 288465880 263700176 165677204 405802421 522863844 183696799 657009727 44219049 419147049 207686274 86488582 424045499 316484714 654184915 447655148 106124733 651557633 189653586 222093361 4404278 289516818 17450194 304399339 436464210 558719730 316087589 116336724 588191443 466709443 41917303 383883047 376116728 218489695 299495487 623073305 414784989 633390325 288783083 599013215 67160039 630873804 124864192 178301840 309349692 522072143 313225817 110795451 659752227 455835811 212623435 609832275 349921402 15484848 176846830 483605222 53142739 331570484 656366391 435922598 646811747 441723290 162181008 195174453 82623370 241221483 199941720 335544460 326425763 378372758 268687553 68234518 680648497 354538927 661548672 287655473 308460317 177437870 474347318 142001653 156015440 651879424 625531564 285418141 114587955 489945547 136855399 599904880 558516707 646545346 223845030 322542360 323951105 540419559 189268713 648135948 363729962 470024769 101468394 519883624 409338067 197070884 18495321 126883449 268165755 587572495 23457454 519487649 328282785 607849430 129786495 577039349 673143692 302569931 50186123 615912525 223124031 66892976 179813503 535102642 556191900 495217586 421296707 129313059 69469811 31297202 275488279 47378773 268638050 294343380 213881544 418354646 571449833 555011736 636372633 16991680 576462047 429838302 498117520 109068301 205855996 445357076 503545635 177242850 581289141 487809269 507846690 79298342 420301110 98236069 664673493 518279229 677560643 456988260 464282086 435828816 79556541 110030179 381987435 155229088 429135205 674308477 126039713 62561911 141106312 630793280 496868206 22182223 162877891 176297201 129741301 588971201 206053050 161179523 96330914 96526461 251840638 55341799 217900715 288667354 251152671 284660710 528991926 147774644 383051965 115820098 226110452 437889184 100142821 369537877 154035935 487245201 357659367 602566426 609112859 449829652 342784917 288146867 672711194 295309579 178498802 676662360 47990533 676490482 339598024 11272619 190206556 597038656 388814567 540137526 149337363 423400276 178700982 31643320 444286125 647625799 560521734 647769511 134637041 258018907 593644420 292670537 469476690 552483331 536500860 54373598 578891742 514413335 164137405 403490259 182699184 382680618 679240228 309484301 456358961 2666692 129113544 432795296 626153389 158691584 187421590 314115868 239274937 489096781 461509353 \n", "118895603 447291396 284921971 353804714 396435681 256577406 185173867 56883501 280909616 117644519 513939372 338579266 230573405 343666777 419354514 289886283 506017691 16434396 464689738 271518274 63419992 253765400 394643981 482351442 507740571 275699858 293221640 385305269 484466615 151044930 502190304 198809320 412431528 502737085 103351386 101689711 54320781 333677974 122336837 519768605 332412974 278299101 303450237 273490565 42905053 474027323 235127496 141262966 432742314 352306666 431794833 377728052 213650116 517564701 146431991 246424794 77683237 287138448 9907385 64649171 92540585 494621186 523111036 460805313 494300405 1859764 247042066 349971799 251337926 206286239 420400773 128956698 445593426 272338449 395245826 263459555 372065776 196276121 326138014 458920618 38153910 29110673 263116218 85390449 484335177 362071687 291955037 267728266 226975730 9731025 179140594 407124641 189254725 263572072 394907101 300001294 25141458 450210942 209202205 380817081 359138088 463425340 407740331 289417851 499938600 371336134 142058522 189924256 149719889 278223016 1163419 255695117 57986980 276648784 293879056 381362031 28249355 475297652 273689554 28535191 11153218 477865131 471590347 194331237 327885741 71039509 40804346 267445963 164864655 271817490 318208514 467933479 351228186 183405193 324604814 320695624 104651216 37904801 59451289 420114294 149958205 178789019 484223237 335675861 4630253 420672038 372522751 364200011 323934505 508450244 237589042 362528204 64644451 413734795 224452711 512031426 287336717 511769910 422525346 374774316 353916792 149931326 369214360 246799595 329984062 6232633 416198947 411826347 203450210 353661947 465712875 203758188 298837561 327552295 41094119 301106970 101006994 415260286 53411750 420501475 483127140 179917877 235591658 8330571 174362371 42881461 194124474 181641861 430204661 498876684 362001059 142750507 274857829 38503780 268801942 499182895 299908932 259791662 171497700 465470198 379637186 449179379 464305392 197125983 205370092 504555172 327175027 385676806 287010338 224418610 442242288 143546920 455460541 511009167 235983958 17878553 20841886 133322797 125705624 33081867 416577967 277272916 369391925 44019805 182821746 245093227 116432784 60269114 322254663 201172388 84973766 379750890 405654917 176275195 404221990 387997321 511886338 200493497 361412529 85809400 322735123 90786460 4275538 247098555 249746920 109505659 101507581 171754060 499123687 149427074 456417027 360231188 319143104 132033380 222969728 400473154 106490639 122576648 249129055 276261211 61437939 194439437 176409470 130740571 141641375 423422080 321963559 326133367 93787730 12802985 17901210 335798538 130664234 154336055 103638064 427380294 113746670 49185840 70291821 358969840 379940530 72789250 211406676 477709321 356697190 241432629 509671199 110521604 356088739 101865802 223440914 78315407 152485050 398540164 335048770 188935393 60568995 139439550 249909158 199807059 61068309 116850420 123852277 484276657 465908398 278922996 520119661 379809030 147221108 249034142 72874189 488869087 7911400 305844257 106498584 259190762 288619342 281465721 498959166 482515153 55711866 118560832 169813743 19211326 164463755 518684369 329657887 31844372 247212341 460405485 73190095 242357896 227452333 154481614 52580006 47103704 472387710 182407461 446243561 265896410 413385197 62116208 418431887 476149678 415016359 482503684 87237000 307514074 478236100 9350693 13583244 229886980 368149823 517571242 348409938 343657273 277518565 194894672 387327087 359916368 402164163 280369549 262721630 264403690 300835296 28515436 470160570 457211726 455718067 133522410 70017289 324683699 23807423 375492764 226460148 323859777 180052178 357426964 66105177 92083303 42647755 110914212 308505443 200206160 396457007 365928903 231063577 411092978 156792252 306589750 459218145 36987782 476509270 172519275 47402604 85916261 207330048 475872348 298848773 154998008 276766588 320956848 485716329 119896942 245610560 423722353 1740909 204849467 428811616 346515745 197940695 175873517 486912644 310178879 99534111 327749024 48467750 98107331 445802005 236449885 64449243 343497988 407980393 14710136 57652952 228922773 330037879 363649105 200312907 244555088 317003762 432236405 386956834 300825038 169956912 112979787 74655403 369431450 389488107 79522713 361876616 278307790 85359084 495001108 166129856 511650547 343550667 184215270 435802653 500815871 215516330 245566121 285765303 306021291 164791005 357543045 336128964 66416557 232124817 441229686 264132550 407611241 466694154 128835578 254743725 271733933 419042557 289760471 519465629 26053250 62517350 470437414 147299770 355702597 334537220 382216196 254517529 313648346 246117978 332354130 73894924 347695248 112303974 436723688 256307711 100328048 502518369 167250535 33578090 49013092 120997777 88232340 169564121 499727945 476367808 213349544 309156828 122558347 265126476 216850902 469203066 55484090 26180346 506765152 159890016 235675211 208052556 424604969 158021288 214582816 57853984 384186236 510368731 144820775 311234432 21337910 64418365 203303673 510942998 53893809 378377358 332455553 155103166 508508191 153404939 328374651 276449358 100459754 122020116 502796652 292409848 199546408 467881867 494124170 377848156 144226398 483164928 67614855 135491920 384351659 441735496 369157759 49001171 355204135 300769233 167257531 25682073 139080271 346435221 320746937 99669659 342533411 452395115 333961143 334966696 483487698 408089294 236104082 39044733 210034307 7818717 322750374 495442819 482476741 493091423 176637201 404436566 282208727 517771921 137720889 237301964 259145307 322807335 452673132 270602923 508392567 123038817 204090324 39797677 137247606 118479037 144569366 450486428 340966535 467377916 494353900 50708701 184793161 189025863 421514912 293118729 519317946 490297562 184304922 189488855 461704357 140335403 314532021 376861699 176351511 419980866 442060402 244889608 266581252 52149806 98465680 298345677 512218315 30284474 397738861 71809725 325646443 363108824 206712459 339080397 424610210 218707985 425135421 503608884 269999491 206941684 35209013 503129938 298576499 94293406 463703279 427695495 142537670 364323877 196992710 404902025 198477357 343808449 149266899 103971346 227277676 397542554 178297635 277456618 67135890 479778656 488645634 39731529 175996191 75945247 140720461 369957667 143275792 292541069 3387640 481070621 400892028 357676309 27829365 157304137 394282727 157916976 375205303 323448056 433757435 84120329 247419796 113749833 470374964 509747510 117598987 464243781 258982904 191874418 148332477 521749900 497702635 498989795 63720758 113214991 384555588 170384446 177577731 488157985 87003075 222716047 142257200 2145766 83080161 388856537 101443159 449720440 156012074 68775936 271785780 340021569 244798606 59543362 409765924 183116610 352300413 99146504 312282052 269544833 459333881 211195354 268356852 22154252 101611134 475687954 147462098 326538425 97809582 398630320 199875716 15998871 83248935 36923155 458778177 410610946 375244394 133168513 247657747 475659752 51363551 287545888 238242167 335310180 360716242 67160608 50690638 492566813 494689494 307474318 228358814 286991306 157086525 412629011 165392624 183025481 302874989 418760984 61247814 272404841 231169328 275233850 193544907 487079544 203332088 451159703 55229025 182923560 306855666 296134332 85015615 357940122 87160806 317360408 389683766 145076740 486959656 515588114 450011239 399674217 336210978 513375912 464673141 430878032 355611028 163082066 61368636 356272566 64344583 420045366 307307245 522702521 89296163 40343809 431300526 158832203 510983326 284080318 253209338 301592452 11514015 344432640 390308713 435725060 221890866 137411524 384545258 32086971 240447483 149218443 268413539 460140384 3982992 102160848 168628579 135137876 90959860 445533420 189171892 324644362 438546773 289977197 67091551 486910060 49353018 190919245 106528554 413318446 234127816 372980207 102558744 324726270 76515037 481963839 170325211 395532138 407777902 70896976 64657533 237284337 63160970 451330950 348609294 270279319 398100778 188415380 98985969 416792410 103124032 251178683 477746536 234998334 278588537 398387122 271765528 443414197 379388762 441719039 33382775 485241242 207744170 258504964 39481982 308968301 285801349 113397180 143269337 140984353 368452925 378376186 133318373 510129894 399500181 256864776 260236635 110258209 69877661 241453717 489702080 45193702 311127368 64840806 430192590 244065328 263337150 1896998 225446013 286361834 265967890 347929820 189141072 166483539 348356158 284804522 187518055 501117432 223304474 246757119 329808769 323038833 274314350 427359011 498040875 499896797 334774328 229501340 273511537 384998366 187863755 154616208 239925713 60506661 178554632 48664074 20974890 57266360 261074927 471713798 517246670 518185599 287094928 523919130 103714898 203868423 362095182 375550738 113490408 216083456 402982546 81690862 140065804 283138268 455304577 72711430 155083562 311813472 292719570 261245214 81945797 25219031 446701499 389840847 127529230 499430374 169862540 290284459 344690045 203744439 449529773 92222174 42245305 450252021 454704066 335960405 256956777 49787316 202218194 52791955 380028150 428065397 321480492 58584752 489997552 106364945 304791463 149516161 247590293 465224673 403833431 238560513 222921123 522969500 103883904 437578826 513873805 393645688 421034295 235562399 260922258 37480147 459959666 107472078 208122205 197006193 423665208 269404677 357817934 234810553 444899065 21226662 491746748 77650902 186574807 226878221 355071413 47650390 287068690 434398856 455091391 365430072 370238448 459248658 274235522 468637807 302548959 375224351 279145734 506868209 172549265 128825443 186541907 348834702 212176184 485091562 317045377 17286520 350570622 26280287 95117042 359405624 357125578 189847752 329176012 140454741 276162062 168601212 469239880 172434122 357394151 228835073 500530451 470127571 51320981 263312162 90473442 158035483 506045960 346208531 502012644 168355329 516903223 204417430 402048560 243105500 240120614 25167623 82932868 442961408 32994496 6611928 294180838 97224535 420118026 443577520 156279987 40564443 402427345 162612099 403251925 46995779 115386806 251599366 329796542 493268211 466752462 42394826 307980495 368728627 254032875 306162532 123763098 233953824 387858062 214990633 5448329 111644904 479619720 118996772 297044271 83662017 370696941 462312880 252082188 356177545 29050906 480189040 218447616 72891304 494221132 390873855 13931898 403845969 391748970 68044890 212975889 438890423 66775328 475407807 311105874 141967703 308735034 402737867 244528961 508969233 463577056 123139411 359099721 285752628 10807886 297936472 271531677 209852055 290829047 320524365 355375794 450780174 385765626 7937418 469251824 435150436 158084589 124184035 393279023 14178864 437367484 147316048 136858061 282647987 165168271 321739432 168153751 171106807 429193299 290538853 489756360 183614035 89441590 101725910 313943482 425792036 11064520 386203588 503146628 255850515 515166406 191625476 265374842 20766706 210221217 213660521 204826328 422787979 337775893 220010589 115024018 506170931 208060181 352870371 120748731 365921490 476709661 109775852 113332954 168901379 200099186 50714803 391437535 224699758 508708902 204868612 462092173 389514488 225362797 380311872 60276374 360230049 264448723 141138977 516018094 107022128 340205904 392158350 141014319 487404444 32696785 43450547 398378218 325417387 480326428 519271812 423899510 364664096 256962028 89103408 308341617 304959951 219841504 66386263 399207587 112123016 113746585 520909370 128613842 364076498 375363094 102457023 381993059 78221150 259072416 376049396 423904378 103507114 423136924 330799049 9523484 175729790 494521994 225590121 \n46132875 177224958 144287146 9229847 21751812 79939326 75403564 59426497 73924915 51553050 152001905 94668718 50092491 152481358 21879648 174823264 139735696 167893867 81761030 1489061 113943297 52666859 121118876 195417055 186269090 20730473 3104410 103087087 62768376 35774431 154299656 193712798 109964847 112656581 73240135 116948545 98154449 201424397 165490055 7225788 49876646 71718542 30524404 60515840 102395293 22674295 14302103 35739731 130789364 70489381 56256405 103603853 42312145 105197926 190729780 27420077 202296247 61166074 151902244 45197191 153534908 161575279 130192719 90836152 110512935 16968422 111042336 131420859 77489893 199068784 5594944 165974639 86159810 168676012 47253971 142339516 66979664 133792887 197320258 70857576 135485059 184686336 114867656 88932052 62202011 57604473 196727086 8402722 23565424 133365512 16345056 162607883 47458567 129511324 14150125 190542588 180211975 146774915 131307534 192919831 6222962 21759625 3612864 39035070 22510856 134480585 187199007 5970040 150095399 192506178 146613460 93771061 128481148 179647335 134263790 93728174 106384542 11619787 119727806 124458381 140770076 112330842 104103643 22546555 162552825 189539215 152835214 94407289 197282724 69768785 53785957 31628146 83834538 69208500 113647780 61028448 148529227 66146486 63726686 46991307 171990371 117900526 201749322 23691988 8113975 88125004 14702387 113718379 112280831 126641027 184860170 22606388 149793932 105681912 32301047 110343773 33895283 10524274 150089989 163358823 42823625 100895996 153694831 198979177 198684881 106330848 14683681 155091483 120381157 20316246 74133256 33303826 142837805 113984496 104974009 124400576 157241611 122316888 152710612 193800696 83031683 29514753 81580133 126829838 62278290 12368223 180127857 177900668 87779810 22971886 124589044 105462358 178276307 157791420 149613185 53884892 150990441 83166590 166660396 101623609 30747993 155017871 81119715 171601330 23481422 62960007 27294960 8498601 190939127 84788168 171613571 53728644 56305883 64507919 129057227 93142106 121286327 152410831 47503885 146638420 4630590 80680061 188459625 141706923 77979913 156758513 51009884 36343291 108680273 46722695 59370572 81361954 109398072 152530600 46670196 24851927 163317627 63345829 185976848 81179801 104003117 2549140 109632140 60884695 80264850 46232186 75840844 201229610 91406998 201700044 9044803 10011962 18684256 54819988 70494174 196513448 41016045 148893580 40736763 149689871 153162975 174620440 146849287 190244389 4729040 160155027 179106105 13889838 30006776 138171565 194780815 20527365 48164162 175416586 184351602 166552839 10341079 84209894 38462442 178613534 186227226 27347951 16229407 163201958 158707185 139447864 29838844 84276301 13555928 15241485 34783090 167389148 156340871 2426393 197697759 110319535 177324363 151939352 30651560 175799160 121939988 85656794 39928917 86085059 79178227 164740867 63540768 161472132 43513500 29529883 110119827 86657261 69305060 189589227 80840608 125966306 120169388 67181005 135514034 8233318 166418945 12006419 2901012 120186395 163272974 97687309 67595112 35341299 95017255 108948971 108751829 198371143 193676621 110490136 82646405 200321028 149896157 104733518 119011346 158050078 70128894 172830042 90760348 32553813 48008072 196501695 93100921 19763052 111611314 94702795 78878582 18750978 84560696 13455958 124260842 41632532 74562155 44546591 142716060 61039486 201305641 174355596 163781842 192766981 71529293 51794100 134619889 68099107 24327646 135121090 97560622 22058664 59105566 199522760 94722513 60204644 84552067 111612160 187449290 104820527 22341367 124223453 8476508 185046903 146900595 200359973 66743792 157110225 3171765 140408333 174951952 121145455 59895615 63430464 65391697 175253245 35432219 76459840 61388741 200137190 162830551 135161431 109107496 198157852 25662974 159488527 186143557 198160916 42679329 8334122 23584011 141019605 83063717 174235754 120317865 100288962 41821229 168293345 20960698 181081375 127864109 117805769 162852480 10865164 31936461 110341734 196830360 141531064 101691009 195001079 147748072 78993574 17742584 22146049 132776466 51103355 154346145 144570248 17583291 15650528 7075792 126298390 35767011 83024692 43570446 40311755 10882960 167515312 63984811 110019687 173165107 86717636 20369698 32644137 121229950 198391441 159889757 183589906 194806850 57571854 150684430 143332408 69175854 161761656 82477968 86114850 60472020 56634763 148893205 117253013 183821238 173045607 104842520 190631468 31483472 185873543 82846231 107837366 123040842 39460173 144672281 5240952 134486285 74806465 16291082 136432292 184667174 132390457 11911809 10027235 138095306 119807669 146702244 189856639 190849280 31061603 172521999 182977476 35276998 190352171 61879365 178174848 146101732 35650758 153902124 122344449 154418480 163390557 95367038 93226974 77543190 119308307 123573600 79978832 76987567 97581007 171494842 15269981 159632891 160059232 57439954 170519092 182302851 99717613 132774399 58457571 158196886 88162728 149744987 31847797 11077650 145995735 44375076 65930732 55092954 25137401 78041495 201093172 278112 103819953 68320768 69236120 17912526 64740179 22424333 12938246 165710432 68726022 2436579 122612870 86797835 66093826 170816235 95411050 137302837 77736859 145657980 99052149 37769364 52070228 58741072 172834690 188140684 14356110 97538523 88850545 118570580 188888185 63163434 144323894 34824588 69341610 142288202 23470755 135601425 106002935 78164563 56471528 54520046 69312110 33691089 141059557 110468672 45216222 125581115 85194347 202336285 19076071 163922400 87470414 92116857 56800931 37162818 71539100 22317464 27634608 72272046 63423076 100935710 115970981 48467060 44308970 84549376 23666396 177041962 129862788 59815296 117229008 83004744 171779467 83695426 118454767 103858973 43923058 78465181 65626606 111899718 103404348 110311871 69434412 133480162 59658514 78051998 28992719 192128119 182318520 158067668 110278426 13445895 77853553 195681729 106603731 150395384 3390736 135793620 166828262 133716551 140332418 5434204 70066934 175948288 7581514 153900440 189456300 28739140 185856506 104685575 116400210 49710561 28910776 19265240 122790322 158526089 36166205 38533040 199016634 199556188 63539561 116884060 124408704 42118471 185168380 57545600 61808964 174073481 122373590 112433744 182628810 198400665 188301392 83059921 44264609 176320177 128525903 122614999 132974135 82673156 74084821 178945892 87126010 10192784 181653702 818991 113944637 100567622 10934868 29192357 11683910 99586247 38527088 115570071 160926950 9418318 90335772 54169903 6694504 170448078 96651689 113219238 60767215 79187889 167399393 3437135 52757218 146460483 179818839 134091880 125221371 180902845 66434006 160345752 13558727 16163794 106308587 180172954 26165938 41335799 144833585 108154704 80390046 60415779 101962901 164773911 193053130 178181009 9281047 155458300 201588086 136315497 92943008 49698168 25371208 163697909 14309600 174445302 84379993 172861849 24677603 188196847 160003481 179058993 33920105 2986708 101182386 93272558 156622632 126909998 190446147 12043652 178493009 72961332 131517392 93804025 86960242 130983625 62045523 162098029 117235272 148474167 73077247 134659533 133479595 119197235 34370550 79784214 176679443 140346029 178444686 51319525 99598841 102438212 51963751 69405237 188946969 134555729 58560511 6698624 117255106 143759537 19427890 41040828 160168036 41650275 28389362 182222489 138592682 182204493 194837219 178769347 185867219 174504639 140214109 104659433 60779867 104927174 20518785 21463894 167436860 126682630 34700304 125868669 66242493 191905117 32842120 186749151 192541884 130472076 200028121 135900415 155694084 134142907 174867584 55293180 20814297 154343416 51522187 194332596 44398711 180198028 188868976 81018928 111958092 28407451 178102825 52837880 139419300 139310705 8187675 175392721 176132820 75819869 122525564 144434033 7311291 133538535 77887150 111866885 131691320 142727840 34068978 119572422 77110238 160242643 92616428 102801582 63980234 31439373 167816757 82144528 168042229 83149978 49320408 71594353 104087308 119117211 192745863 156860267 161973211 125688683 52553221 180323530 68419376 126381456 65415815 191676971 124259657 193832446 169145012 167616810 188786239 197926441 164687604 19096079 122460852 62900498 183444074 79843282 128128626 122219643 104689128 193188577 167113126 83231099 91848458 45827536 16073921 26788012 44317689 60484582 189223690 58421442 39758061 82585669 136759484 39304505 79089568 116043997 122034457 105635343 25579958 182694372 131636967 54110161 121910135 69156948 25661529 100648119 70684793 132228661 110615999 170243349 157566613 90003710 174372863 167527197 139728204 41952720 7741894 102181975 200542325 100785968 166876066 95032884 89836457 202354534 150491314 24166374 115299470 21878539 138014182 202082289 95277593 182978026 137939804 13964564 5270600 48341023 38300310 189265504 40065249 107747734 184768057 201871817 152603797 69810715 104401165 36026795 134129512 90432649 4282035 139740845 82579091 111016933 104800835 182168018 27193503 128158654 45399914 7711287 105841832 104376966 27004024 139737310 75018617 23505599 164357936 35047578 41774504 128803542 73319940 202559473 128924083 182531438 170002930 14295250 181519692 35561560 118343402 178695891 198103467 23507705 68479568 19601705 103856975 131661201 12690710 157630688 130490464 53026786 177633447 110697712 185449761 89939123 118862562 173581460 188666364 94040736 132184660 120763895 38290734 21584528 201000924 81168864 28118077 39451113 132194843 175446811 117519950 72004319 78435632 50536118 177861875 49290964 17946376 163678679 4878017 12444594 98954610 200692071 51448313 58012510 14232251 52421792 127551777 73302992 122105262 24170763 149431124 53148900 184698570 131424927 4589313 44694496 4141683 82132874 56132605 21405509 146232104 107565734 70777010 58418710 146285187 96782195 46380594 182717498 127607305 47538290 188779152 43142396 49773559 185439366 10099481 28633226 15578214 115378926 92295944 188633960 128760877 3749100 11177457 83604144 194560848 54282819 183875031 195172591 197214147 192686329 13880238 138148577 112632238 160468480 145880182 75661469 44455831 141415626 164374843 8184904 152283412 90921710 57762115 10568698 112485118 126850745 113848220 73550546 32617025 102230344 49264637 98845230 159904189 77304865 153640608 114890250 16822224 142057008 16720198 72662068 161993109 167730046 150793633 159913119 93312705 36395308 34872912 110140947 179069655 129778047 20702262 62390147 51972697 116974566 177320802 15289028 157035469 148026347 68510597 82457584 152020069 115135631 131304171 6610382 107703108 117850779 64735651 65126864 103208050 192107795 115442020 26802659 97363444 20057875 171383663 84634883 107673163 158980533 192461587 84054593 31135734 60044073 14417073 157404511 125053115 54310936 84560189 177670547 162579608 83963387 151894141 113129764 1279329 47168585 65755542 175334950 137230351 37353502 35241021 128433673 67518777 125406775 104115742 33912382 61565490 67799826 68910431 192176291 163550655 104699500 78202907 39720373 176102614 61814191 35695942 8014635 63585709 105200487 167606133 144138791 85410735 133723723 48069520 83623375 37046584 139557837 116599321 2046040 198256498 121074613 60732707 25831152 136393115 149766149 24541924 180805176 4260708 176599705 11901457 75206462 64306251 124963830 23156220 35451990 99279819 177319754 20206540 145980353 1056358 51010051 3999637 65152944 108819450 129562760 137541956 635112 52465965 116095244 12422847 52892706 74350840 75723287 37987089 116858522 175919187 \n", "422280524 429174138 381458333 343456002 400539722 935217109 791048585 555867707 643151906 479318895 15322965 68899197 811675884 537186016 418632188 761423980 700060781 56555275 835187367 264076576 882981000 717412536 187417203 21183593 788124453 385722312 122117291 668684396 346253283 77390199 409027449 783737385 566021451 458778285 732606966 580689860 902223458 178537605 384069591 265707222 659194505 862479593 683134602 550962164 537453115 172715093 53601053 241412083 178111914 589734054 851064687 421304992 319196166 77154915 324527037 91104989 392708585 64332719 274573779 462338964 198606351 554032724 738851106 506684711 759975600 456964731 456380864 885397460 774121947 829772490 200010283 648287004 791839612 212709520 741482575 895315166 658996878 363026450 251174970 562898136 133789555 428990565 315484950 363506584 301853774 395439748 562478819 106964665 628687988 793791216 143460924 217934991 866181462 355290489 640784683 591492371 812280911 341871032 162370861 97901229 793035509 847753740 198001490 25031088 104359785 792130034 237401687 658894185 8015604 146615787 320699340 211402689 924179759 705434293 682377605 731068704 78096564 382069237 537128074 807144744 305275514 882388910 915664970 180848782 626088956 654103479 45068500 314381399 659010253 615764583 278229459 550345428 475307155 401709392 110582296 39523694 702518079 468411177 415985655 106602985 715413812 24975459 531539549 76069455 917277379 761606453 386584168 233859323 736559600 621396055 611669887 309985009 853212475 84594587 639898642 562629372 286325059 688998887 33333548 626233416 530048990 23052670 258128841 757569098 629399803 432474313 842858457 114478978 505243980 21379294 858168364 343377140 921177364 852252391 416751233 68272497 87603408 44419132 698736451 232625455 228709703 933317139 783254657 375290465 744433635 760227511 623832635 920113492 32010365 29295966 301422207 651633640 50449675 878862133 862754041 336363641 721371748 138820731 573034424 329692063 857081185 260012619 593087806 499265249 879021383 591957502 95615264 884284217 366947311 752158311 763598993 715793698 646629413 610645248 684703166 244915001 770497546 363064901 339344583 848292718 192530407 327433713 253337240 172688763 390454733 88763033 374542439 703614779 443872784 339677107 455032997 652714245 396726276 196914373 626974822 406544525 478351845 245941056 221060517 465211588 33046024 765497771 61260240 296721137 281155467 589490020 917331311 452930338 275915122 294719085 742912514 880913977 535828629 230158071 592371481 842937768 321031637 621606061 129358668 693911696 660261366 928388065 582451910 670511351 775173927 227006839 192863150 729022440 637241354 12263627 296183411 639837741 711641652 472881265 84942034 602075071 937192514 487389713 86391684 133255356 546644838 563466981 540883859 767239078 598196957 857146074 361322013 222725802 903844457 60647411 868358293 436691104 806221803 649283490 686303088 877832856 935144905 901524460 534994534 32577536 419521896 187923980 916760306 801285260 281609775 254629727 705701681 209329737 628691036 242497211 863963354 881619117 837421684 625897392 121606450 809530714 886458725 757484149 254989557 264993889 95066679 314977560 712352844 65180401 569810468 877474378 731662559 936852010 692718697 144046942 699070964 736240077 774397378 637730471 374826919 584285087 374482665 225268002 852712175 355230139 155477116 666579052 428540277 430511648 26171460 367595718 214017277 412952992 148939075 104343837 225382925 719832633 928742949 470370230 520487112 524330430 624320263 335030866 46050834 385378884 488592254 80816878 222865803 237757864 691587494 667287368 933746326 749783255 319011284 582313446 110161792 625940617 341850356 97612529 908551090 87782091 488907882 260896495 543516514 426759389 429222190 125271034 212039245 256965311 713675417 279988038 328907252 252017713 472914731 734661444 579629523 536043484 672717555 219163961 351189816 158572725 561970470 201153393 172192936 63030320 105967080 365640216 61147861 890226551 443422521 640233908 515553163 582221372 218083276 255325509 240878116 660713140 799934846 106639354 628500518 288410097 316792138 107597948 605789787 795262293 340799758 879129443 762802294 87160713 265884215 652038102 672826214 854113615 26217761 12635738 623501755 324703208 292019013 879588825 910185562 769262238 748905848 483045227 626895818 327898476 845636797 752658539 65335527 355693426 247160432 453319774 357993527 465689158 559692057 734211577 888771124 353787504 654959018 702630559 594093031 212148177 690912861 452207332 515597514 25840469 660242566 288053284 554947786 790239362 735212334 544925397 718154144 388599592 426712786 272178444 540396450 937093303 633373583 883629052 517800536 298577954 328161991 539378677 158240567 708663732 566373177 267454701 764802457 489787585 889259870 601477450 941675593 92364155 78742472 96471547 138272442 627972326 731527945 643262661 797013162 811362669 544881293 284388286 129434473 286352524 162836677 360672864 909052286 242782377 836001049 537569428 97749051 776914571 65189680 576488042 263745859 135728843 816991627 901526746 765687559 628569288 769182229 669488838 235303197 654774927 869483120 167513655 97137421 427747930 472719066 714490017 425555195 765902471 458031142 540913325 728395260 265874792 609319723 536317576 146638182 670692319 914107572 682767371 524716396 725238208 125218150 133309948 174519358 703351581 770741370 688056820 371620113 488743897 41216285 121197692 641213011 791403844 534296494 641998989 446999252 806339859 451315428 920535757 818181830 770310402 299119666 194782658 774739241 628914428 440556307 492910569 141907581 847184284 370255026 106565708 693883526 117619770 426262548 696722367 66721213 799598968 378603019 402765617 63742903 559295640 453299301 291561270 608626937 133063305 813777698 209318990 450610387 8714608 200179911 333053071 635820892 452204347 911679422 100770667 591572460 742758460 184908181 915781520 771150661 858281161 522961531 728715558 256645853 644817950 102924772 939103422 619422567 875994095 848226889 64329805 814934552 661958345 447477911 896315041 712954008 585947336 183735314 927387156 901694340 626699471 422612314 638673078 100190024 433135920 186091773 33906733 833515707 249177874 522536111 901549265 353459897 27812068 109490237 853343303 931239750 659803957 488289399 113557917 816519792 376547275 356776206 341600318 124732758 400404241 942961192 81068444 494429170 152843786 375664293 831460032 597280022 776846478 399457850 791617607 494966122 17237844 630975952 605079517 877515972 812442263 872850994 884502637 783924621 352388676 755797519 604384041 840520785 573811896 887150812 306329315 391576245 287736372 940351162 897712240 935214285 489330656 525157357 844973900 9328149 355836864 577050371 942556200 890919945 316266479 704391186 264243981 901175793 166231317 908734958 59529124 222562991 428239508 144687154 27212535 361032667 131822189 660521662 742674266 606089644 72321104 703899421 814286957 526383035 631215669 90868668 384645203 145296569 861702378 904531579 43681547 541593528 809556579 265803505 517650796 207772706 333093286 14273389 468081209 763126235 851747409 712642317 621428943 843396905 83397412 548555879 439469547 112524659 29574714 424322571 693798260 316217555 938739286 417747267 884505307 86883758 203008413 745733532 230969094 728554282 682443544 237340122 615983833 927282235 196088695 546092827 518658700 850432102 463770268 527120603 320579916 31953550 2064378 459460294 592571373 878830566 474595849 571279554 790076523 686267522 393857767 337901736 834185039 305436127 703301668 46145307 908265719 924613790 21282263 65330552 319612825 252167220 906373991 129187105 378708978 755912630 807011303 274885952 23809709 727083698 742002473 116977204 161172287 803231397 928888095 287379001 339899441 603911304 821611578 37440516 786344710 451126182 937293967 917979817 724179572 732757439 247940353 174984259 73421452 681508443 581592512 288459765 928541034 196857868 585651261 382289761 285300898 154287368 30881538 942412425 279956839 407542795 288428665 339780207 823065738 614163501 523275635 98513648 830819295 716867278 372850371 135386732 520949804 206008724 465557453 283750683 363223420 467306954 473188639 615034895 675123705 543746171 851860322 808039051 931091238 921018490 188744093 299737102 296977509 112592426 580000735 800544815 512788192 205349522 309503447 92936084 699335966 57488513 136963244 107940793 233348790 500190825 222686425 495472440 152468052 939196310 104033619 224410539 620185800 750322116 870749394 344565705 211722980 488409561 864802634 89161555 100116480 219018384 400338403 854621404 132243203 818284728 371008092 937693628 174055519 784312380 56086319 717118424 227087728 164424828 924539243 890067173 532443807 22455191 620009517 560162437 813615777 259354277 4438109 328973760 425866636 410652608 12619075 894622078 628549781 723600243 409145358 907312490 903003175 858441798 532081187 301698809 593817048 402918593 398174976 368762681 467814084 88387553 568766522 121581656 859169151 43261005 842382992 91211631 674997248 769623799 437001135 159676198 725407767 279165524 44279196 17085796 615148470 377693886 396075137 855098145 898587142 576178819 776456884 315922705 911284430 499166986 274952483 786412914 328468237 773490032 166027770 491395611 475456067 547843883 226262470 579319991 42828241 794935371 546082434 913537198 914179317 603789109 626578083 887975789 712217608 110104297 383156004 381950490 740041263 483388414 791094800 56524929 670688908 154289967 324585885 821379911 419150035 432250413 219568082 41712690 620248770 590424848 104461519 745889760 555043382 210458299 870590759 432368358 594894487 406214961 739018936 568284465 732792814 534562554 531614479 60303619 148561174 307821216 557845405 810057666 562892559 260873600 472515539 806149213 102219384 107767173 502285061 610761634 644723311 217551216 345206419 92955050 527080575 413650363 710809279 562525390 559197471 478500417 642840381 185877652 164942923 800477517 781003361 84320999 582151298 566686092 894049615 738166907 282497099 872456220 94284113 537057328 84136677 855248 112576591 686442728 149127034 836321183 771980286 801085296 903406063 528803359 237929082 64077794 397290268 92480892 590496507 72017066 911207282 433730730 648771394 481424630 672182313 15086629 862409254 577149734 576515540 502863683 718181809 8097632 80815938 648628840 300744003 862002556 475850342 403357176 711848110 422195640 673975841 163868989 397041470 747304501 109810674 430343594 161616179 270739744 738852293 890728407 360964105 557822962 83344371 132044557 704342864 912855760 729567945 655846992 597271216 260433237 445189552 375469499 747285807 638824936 409100489 233657202 225525493 510132790 333180275 501769056 793534848 491997813 204437231 846349193 139464251 229896477 138044121 850370726 935068855 549467603 572065559 815199731 933446263 751950021 564011876 90490770 187735123 159363273 210015942 10635257 784766448 111704190 930624908 242603918 520384060 155841391 450729714 790709461 310014128 695843913 224621874 825628365 750836631 137218832 732524152 462287534 585900445 709745134 662772202 819444616 86531524 430740206 388777602 131792204 255421326 218157509 9489805 781518851 235533310 832616967 817920363 115900353 175016197 707588726 206977790 674305755 70326405 783888029 119013993 777669808 516905384 529137760 419761975 66742314 232836158 469731481 809149729 840274464 365456430 901012499 933755755 493687113 904089367 873035930 719197468 925863611 773309914 714388013 530673301 835522171 382054375 74962206 537018025 711680112 712572787 610400681 565377650 63565829 686072926 883643202 90312470 475496373 372700449 936448036 215935777 646819634 726828346 887043855 526058631 299203658 313350136 377528004 377637840 792167677 773132224 60062940 577030071 900109695 409680917 750082481 835509928 565602053 463979629 22894868 394378467 923226057 842460888 509957398 160855795 733717376 788824303 276791995 598143282 498138065 275016670 872453040 184412256 760583238 784887035 454170734 460734334 203365395 602101782 560340497 482817021 650154095 125524037 857380730 675948600 568193397 592782411 642570553 851329712 761031777 398570701 682842745 706472192 370919505 171067728 806328825 453744566 300222916 285903979 687037895 332025736 345979894 264382805 457548015 694355797 623787070 849048483 437527166 77194532 568391987 397339345 169281536 215023927 782152921 233378661 464793507 37019548 136941370 162425538 855961231 888084610 157986872 15936073 126275652 337404359 9514199 644823007 399668219 688730753 512365295 615768880 235936918 570343665 148026229 296995334 457777841 379222200 788851674 86851622 452938007 929410136 345319708 574899396 736978431 271233329 580338555 753688877 415974349 427850885 501110040 370935507 859369180 349318811 696002795 785765649 553809753 682440944 89351111 513805792 145229216 525726420 200777276 47728410 907452713 692143047 895805826 149439927 405505646 487311989 471331041 716509386 453163622 454334971 341391273 482877868 319887341 852562275 248353456 889095684 794504680 337555813 816841437 331627601 743804341 283685210 505508038 448904991 257690859 418187979 385967593 30613125 182197347 151818446 875061061 673133623 743417515 314475582 137049179 102085077 448195310 789511729 900307033 903885240 762107550 51712374 9855926 409333985 196392289 419408404 374176480 503060962 807047148 301226741 374588200 844181153 665899509 408032619 309888679 905727723 919834812 43481773 451555462 526023675 436281306 674553308 614373771 729681063 91351273 873351775 260603955 571172170 225200800 659309170 433921430 80448702 296775992 213686901 437163904 108408333 35481178 728342662 539604413 510046336 877074908 386001250 19655120 927120242 676466352 273778704 632074103 417032776 304021817 490356337 897902315 54224454 311101349 274190661 422516595 721386769 365844466 728427550 173635169 699562362 297625714 371030694 354685636 29162058 75511424 399301133 823612137 685673995 463700872 856163769 544133149 151982094 67610961 666312428 31958184 154058789 856580033 497697867 348436403 217055437 217695109 825451849 375968497 539613221 763836156 630103001 699688143 283437995 123905924 904252317 144610502 118808989 707575945 519485503 739660673 436720409 733219466 81530203 395725261 14700526 638603300 50809525 530116629 391457117 160144456 7877959 362809621 378053467 867625377 215216655 429061464 474782947 55103770 548803259 689999955 736026662 110053099 478077317 691727590 23634797 712567181 177419914 410770070 883503729 689957713 233556791 895619889 909104018 207320920 85019231 457398033 877063548 265585558 590081755 494299431 600851930 412006180 731490002 291669317 56761104 591478203 877135548 618442582 420055191 830664096 743434522 430493538 518539836 646684856 902154834 362190792 578763269 543880641 1615520 156616100 342780759 624949690 934439799 216706842 161848510 118159812 175751554 650589349 107844106 895110770 851771909 58198909 165823070 435403387 466747998 153519794 782728449 402781407 784310066 614102736 883371510 744696762 569514952 871921781 108569111 334712283 117983631 529807509 781429645 209468725 637288982 784063714 308594186 752629088 716759549 903061719 15623625 389863403 740824204 751191735 652874819 483859279 704144581 169106732 79499665 227222857 61521600 799372720 439996731 873281493 370653354 900463828 550422649 804878543 124660303 133087773 859670615 43535187 130636104 889535220 38684441 241570039 558474147 559463659 375717340 240028754 382601709 724896827 62846738 417412499 31236742 647241686 109589653 441923514 569225173 449746750 747855781 470789867 447434018 46096538 92612334 97213217 407056076 272231920 278459882 749392871 694554861 383259276 868235635 499321644 541795703 279332760 863184237 350153978 247967734 569784494 152176460 661309079 796455428 499887528 560342634 311966375 351430702 287842858 358019509 159199536 829187290 527293309 905209025 920330557 260925772 523884607 858235130 526037564 536510104 409848469 377044163 311981791 275392446 203733335 74092164 138265044 211663928 297575312 811532524 809478749 561842664 818270376 785955047 498276822 96494584 445482222 538300008 919003082 663638614 250359432 390231141 177458504 199787547 49542518 302602015 53312145 401897830 150425960 315758558 574550766 760856538 289974475 68127534 602224606 7327760 730558612 509071006 230436616 910303774 583780120 927491487 35458994 304226962 607503840 668906126 4004007 180262370 413168533 827013840 127397948 26913823 143497064 489549620 888698428 665957242 798319613 865080493 66016520 678481728 566664322 12031505 594252732 539052609 73053416 689866994 541304053 369224552 705602603 753951199 659757350 743790413 414578504 212200743 541634085 903005319 516187490 452511708 502014036 375812610 156924547 504458346 779749266 430056302 863284359 572945247 137397231 239079564 231482853 809098296 285148162 897301826 504807615 536562242 165167312 145672149 609256317 359618788 127331627 310190464 897989963 415128448 801394718 193286613 749033742 372651723 832089801 492413604 29203193 162583708 823710991 100274176 551374720 876611181 414908977 504344437 546074288 44933656 209207313 217363288 936482953 223262260 679060154 46413272 504006505 702957660 655535847 296394149 243987358 407761234 671629431 94075427 306747143 853778573 85685893 275614296 291283935 665996267 243073142 814710291 708131963 431133643 678332733 695929225 725272492 45895300 941596012 558011995 565025286 610198731 193356158 16944880 712594926 399606125 332662375 557015793 871206662 679047437 476236459 604711728 525147394 193195174 922017922 767181240 762303234 719750762 16358529 671684263 301175582 14401661 284018372 442055442 661940743 707728390 576334810 283579359 577181456 336651109 797436211 612036850 444019492 519318791 247736269 704692633 928660560 450875023 280323662 795539314 621135658 232813514 377890246 388692649 199735249 89021888 149702859 147504115 655115036 220172983 824889702 800225174 33890940 172404277 108207275 667687739 851552233 873735061 253245 630602990 859448598 479824603 292206136 100334176 478584624 85357053 25529531 123247677 103421203 570480730 931964054 884646828 297864917 829013181 214597884 450542026 667619925 610032665 601712453 148297805 587324320 550721576 7861960 160391758 794939435 449172023 337608548 309766879 21500251 693480277 816504540 504420319 689178950 378304949 303538149 864332688 623760537 849810755 566488277 150802213 427025972 196222006 269538722 127400071 88924186 303864059 581751173 790728610 421494059 908989542 3008300 785186171 193682050 291414943 68615718 225857236 87215476 125330804 175342668 932097611 659809836 578446760 923435928 55389343 463893824 508570645 698936778 135352968 215961591 60320143 602907497 141311253 55622074 585750968 257669869 459960289 758285838 720008785 611697874 392960635 908730460 106774832 709511456 270828849 913962296 230543625 307159976 184709129 620497965 162220113 394410445 658561078 809195909 710261361 520415251 115204133 460832554 501461385 172055260 156681329 103495849 577165242 769004106 652429972 205100479 897133692 547895848 182014744 63816711 738566876 456867928 485078176 488947508 16317495 266572517 332613382 163542984 92490536 563385141 735923753 269614009 410009009 926059568 634841363 899779772 265647258 700088230 690478664 286323578 623482147 765416606 394926475 523836696 661773690 825269705 853632679 253375172 138176311 589422082 461780989 390082141 317369793 914445548 532752898 411643703 868506437 471779101 578761746 153232259 61522004 449184298 30919486 452614021 71206146 226590555 494807964 323353492 314358550 433502113 426825269 489825373 189365098 104383500 125119730 284767042 717926272 480350047 313316599 820529821 562945670 451202167 589725222 827844049 722579768 295241886 466770853 918241179 394348107 492910347 295464751 124357243 328023458 919653198 604519179 410828211 602456280 160583333 860889906 931863104 385721062 273541578 692887054 708739181 426593758 535605654 260595686 815658893 299620254 123250849 248647599 290674195 686033990 141363241 89915929 56091503 825597284 614788500 95256369 22673329 857299772 407729637 231762648 264138925 901566619 556115408 727931653 87942372 239765669 339956182 527917900 205368941 92355115 408222375 885620049 142669309 852590671 843060466 51730958 560703459 870424467 \n", "239117857 397726620 167469529 101318601 388661725 408726401 38048924 234094904 144039613 51585015 29440271 196475248 598283434 266895154 329111234 176926744 554693383 433833290 49265587 130675648 72450016 473834994 401102554 268880315 67674192 331563268 283579963 232909278 532995106 285202487 133321895 569933216 258856660 106958077 36399769 614784419 502761579 446959058 337499105 597692044 607527463 488259098 261437063 47318993 281631945 98504592 7434482 152333524 112046929 239100716 35748846 415784390 395636484 276516518 477571945 113018524 593356635 586849915 543205946 100958383 539945789 441725849 437171978 23010408 297970186 567591859 52509470 449994719 499372932 30561302 395758955 92946874 306335639 175090051 372630568 263285080 461113137 275888611 152609103 365373895 203814995 594291372 262345781 266247444 528992526 514187544 391671697 33163168 107951131 487651891 461630224 409329398 637916714 219760889 22008989 260174140 246258655 462249897 5977255 15802847 40175847 95636121 595515508 53914927 358470246 415224839 86054884 77499022 158929123 508036997 175669271 190561459 214237973 446619471 220973627 323521239 134232130 149996250 267713332 164050195 355748555 518226939 179324515 138613585 352023159 529758856 586566443 318313261 146325290 434414925 119848136 151706523 407118176 622549101 165042483 595164327 171617740 36256658 82105874 98242710 248468466 409515879 172557637 330068900 463463775 327776870 274882399 165887383 259255524 263444713 157632646 374353295 136916422 88138431 85270456 607338155 487172507 166130147 602568980 542047671 315485246 341298946 595343002 519775840 208564319 79866320 494023018 66159491 433615806 74718725 607979175 274038056 372770274 360114034 272413354 424024255 124552286 288060049 281890404 508101924 341972285 541670840 470578931 50117291 432808060 359145797 358063759 276194194 337082209 610590294 152789396 338977120 480242316 554306045 221713899 457079527 47841675 205754330 216703875 379770620 546696316 639288659 26285559 131602303 370332642 339713512 437405023 14409377 44967542 232209460 167304950 284774124 529730411 317762252 579889687 203672907 405619826 262907098 311923911 305208997 212356072 585440451 113171300 19000625 159466391 169828140 550111389 320442189 320862341 233557544 137016202 256911157 266692047 39074780 553979594 614745083 436803109 212556712 122845194 393719651 455271074 309654897 261693868 111363349 293550113 468316377 377761638 569612522 135885446 575893890 356665747 587780632 146824596 304751298 378614494 177320934 254599508 365124267 421352664 519753961 585541892 316848608 180491244 175442557 227173891 490994413 159795960 562131915 513432930 565564599 636459479 603070426 102689012 257584455 298933619 270070047 626873451 478798704 436270658 442807169 354188892 510185243 638799985 554679160 284490035 100930316 43892029 120269897 597280572 20429509 47759697 556634479 177840182 236169832 627362949 576118172 431907237 307349395 413516443 101828055 383658516 202819054 130993691 111763647 461154687 484563463 324756031 578721551 593227658 561607187 345923337 444438154 435215238 422042940 593045861 519758280 640034004 2754548 120591897 558856942 283833069 474763660 39604967 202822005 629307611 46776351 310612965 288923940 390866596 36362206 65279535 13390035 42643471 288629986 102164520 103912213 428645234 366572397 334300628 626483422 589615916 399763221 464819445 247592694 182321393 537376260 421437753 352981961 43391634 258370119 84039140 285883683 43583503 161257690 132620064 500606320 186853280 235885763 85817726 515239571 241194248 290118746 231329195 393804574 178683574 22163944 513448717 379146552 502939352 9857125 406257709 429930856 377008070 79307291 302643100 286191288 547426087 457026961 46186614 559246555 13092376 227022480 93676741 309069693 423882370 387936616 406592535 4146931 313661496 209682714 569774684 364111045 593466930 549502926 486786012 75696174 153144593 41145831 167631692 315763603 504345873 44953485 536989732 441856125 188540524 571669800 557750107 537531934 357176445 450056123 493196144 150717177 486264338 379198643 297745839 361278924 46600204 437698838 493833949 59755290 74841901 348764367 310152457 379761567 152613685 111789967 31091427 253470235 636074411 282830018 183504889 618791028 158859435 368607497 182898271 145129326 564460277 225865560 352441684 520177529 351249536 130317674 273010552 447361017 460496406 582567079 296426859 144672681 97296475 103550047 92264329 62312945 586986881 509291365 307526737 36980452 189994598 369879587 160487265 522666877 95901752 41842353 497839318 640376522 171622622 341160059 60059786 440451591 385812887 40746357 376281996 506257917 291653273 116768375 372686358 308384522 106921062 72429238 227818018 370982412 93308523 552886558 453702827 375701699 344861606 213258402 493276316 627383776 548132972 143895846 620026218 159194946 443384489 57656379 27018908 583781211 536373881 228061871 372758132 128363169 466593933 287936014 154518681 412805202 176567811 631316884 586754212 218255010 553389388 348671798 290883539 545458549 160942814 267636891 466829250 56730281 412659690 138573501 473279614 565282058 419781165 437823510 85199969 263258754 240187205 4943626 216020015 509306384 212691348 586172635 345620114 522826193 224883795 8543617 139536050 506613426 410852213 618624291 423206 254289301 35315054 622006697 616711102 593868055 476624110 537797788 124620511 97735141 441803062 152575925 151666828 475915064 436948511 94933674 108593534 245342389 326923808 289346800 125926658 52912113 214618756 636272536 480063236 464764574 166471707 9315878 553051023 149967371 421124222 71889352 522821754 20520901 324036820 108990475 600708746 447702987 191803637 352086379 75357619 609534975 394554291 28838797 434057755 403911042 153438955 11311931 254855844 496854887 373020150 480162922 257011491 113912402 129360657 445845912 111194339 263697880 606216138 227396768 107633045 40334588 186681475 512669083 336780653 466898437 593989419 345960846 18096556 428788923 580596458 526306055 486414001 538332215 140845150 400943162 60483969 146512783 163246830 192120963 568079416 542570475 628124232 545354557 607665071 74532651 48602122 610556595 349681073 112531570 541087926 220565215 396754549 265588896 420774414 86404178 303821325 39408301 217751770 623942145 529812381 264584418 484697191 537173129 384952614 581865578 220589320 382905441 312785225 469712541 290482408 357919097 448157155 402792113 231360615 167918632 503608018 548492014 358659113 269863119 96782761 596159468 79384967 434942880 533446585 476030740 207850820 112557533 469997992 372544080 517056206 421100704 181998664 524668540 316841496 551853749 126679090 355386736 361519017 591902514 242306128 594224674 265757006 479360582 184779049 201762747 486121133 44069707 528837294 283437525 295009654 73038110 630317550 624891485 295872381 129305451 453158964 200016701 401501482 628076063 151622294 154608645 368903705 36467904 522910621 473136692 92027276 344938041 210390919 97793116 579316136 7131512 331991787 60384592 294982181 489355634 125935338 180791184 123758776 621431206 211964512 100134039 596530419 152237974 353700670 266126020 214087183 270628784 5998840 389872535 91518705 224146841 293884040 35524659 214670227 411583596 636214369 138461211 527995003 343221224 53384268 449094815 236079167 444268685 356184626 229970625 635552247 446922928 416532862 301003491 331224345 459599752 322234925 244398146 312386153 469820277 322609837 206263818 201138888 134124512 134295467 535109456 503164962 537769621 595193130 391617261 609923706 466731310 268886384 154262158 254594866 51529895 437124223 241185682 37608292 206108487 428498525 328418959 392170880 504958974 79071934 132186133 249831604 138983913 494895965 189465047 376960119 60298603 298424415 400145552 527712858 519061317 603084191 607480979 447372532 298356534 154334297 444122760 185690678 360691652 524313318 618421450 329628026 287206968 3528659 537848569 2564932 372556217 455848395 27528765 600577721 547140446 123079067 56192804 365923253 575843401 412993046 557107218 318942758 158832796 404764927 439920249 80742340 416745626 504203516 134501998 588424575 307624819 88861869 169440994 528829077 167555446 586409296 431604572 509256146 477881325 498852434 379556525 283098078 406356574 383069225 526285610 196581046 469233938 482713283 479127341 125927560 586720310 359851313 599024305 501852749 262634987 501334657 258566715 188800558 571710692 341370152 431358196 561399499 203224256 202958229 31575834 343040219 39607855 398803859 112421891 70271439 328985186 227188671 320242660 405564293 596707838 452054713 575828613 305807186 154282772 504436914 219729646 452330027 140035005 598237328 351762945 173090935 638686272 186929602 143321266 528782081 384181443 213491925 467697713 637106198 35789059 167313667 295524874 4547224 423041088 457592319 285624853 379443624 18631969 397791823 235120301 456761059 199998096 240913617 558692763 304277227 478821340 45301838 574574993 183993735 55036705 474463171 478897646 316805636 492271648 148797847 375925907 153329082 388251578 225691158 51591656 283227746 364113422 191751221 223723664 208027412 297495277 573781889 135479298 442739399 423548423 446704570 521560787 224784959 538921375 107115024 177477895 433437937 182788914 325467338 306351814 333543151 330955685 13809479 107467767 521818123 507059164 473777867 270952132 61475391 435061373 637731301 447161803 310866224 607701888 285382893 627717103 415329694 74618543 193882107 92197940 153523402 322466425 157707914 232558857 235355454 511203726 447207072 399728424 425475091 110037328 197901547 402396658 188415155 222179820 188424291 312910979 635183267 602611858 521501669 87065767 103031736 342181700 607901340 165537704 45263110 125265070 360864875 134669868 235039793 54652753 146930545 611454531 456241888 448999959 457270245 558056679 180017554 583479063 19282866 466569191 199023999 349905697 101537738 160390686 330371920 591892360 617175496 320158976 191716589 4547296 16104475 158441731 580840729 254730700 559150236 497332612 285265695 125322513 474123073 389525057 484114623 232035233 45088372 73866355 617309796 94639389 357744830 152008195 290878027 626892841 400376267 274283194 526188675 60915719 624440924 526646631 538410179 100564758 225642058 420783809 182556814 503010652 159413440 152737258 382235419 578868279 479474197 480302286 60115870 130478034 309533543 280073166 232683626 101706404 393619518 187158476 226286607 517450863 557033860 179659541 475524964 618593435 594638322 253034608 430845083 394935229 384376734 479719571 154128553 473591863 96898695 380871682 387129153 529823387 574841742 389980898 632174810 288122295 17357611 81547842 282629698 62372318 318507753 17619534 561692392 270663946 421201883 374054039 607543888 366106251 225140693 252708993 619429223 270410837 438608072 155140586 306132151 107660260 30655156 317032397 399743162 208045658 507788044 294588714 69618381 155580413 175885673 331495834 172645652 99854612 48187759 586190632 119275028 166945141 247952184 197527436 474712117 292834101 585343910 131133120 74586197 393788714 231214547 312020214 78130892 39727844 53504686 76747428 232442007 268024599 472096270 6768648 632618052 213116205 557228940 203872841 205037385 135705713 93265732 246332838 245325957 122550959 132855618 441547888 46385715 504401143 82901825 47411132 263751490 633343706 581067894 559120355 65331648 143757360 254917816 519536402 171182963 113904792 151489086 501473591 247280938 72920794 277975051 121683935 493679868 49646793 586534675 232139517 453080674 238626914 541688575 407731661 511498127 299315227 612497574 59162703 130007721 53636507 298303653 214603278 500954574 178808616 518640311 261561180 82598975 579119159 95426971 182018677 318814044 236151878 199649982 341098722 551554535 447835446 70190424 95306321 296941243 184407486 280889580 316773274 566114158 192126321 408363822 577583280 379096439 330537187 572614983 432091637 134018668 58551881 126089995 548699856 255466804 107280166 383765104 1152554 443717144 470045948 37885379 469060659 520843760 233694166 94707958 568640114 236519303 619114610 404673567 583868640 434511561 84449793 572884124 310612452 341523391 502507316 303973996 556292507 536018119 265946020 381886784 38854693 559978231 516805860 320885339 418431880 518530869 461521773 334131620 73652077 199044395 625060462 496285496 284129665 113746142 541035602 179463528 230792779 272266412 110911479 608909547 373070358 247664180 556798528 45743429 440273745 366836906 462684958 31408925 434959820 626189303 312296148 108196379 315248613 221980268 122061313 612614542 554031139 277353443 261198033 156289 94547906 219043592 257236271 280326032 259135945 257345459 30973584 139101230 143827688 358470535 390922560 186866324 391936067 449298358 307916286 45192516 55896756 229903039 575026833 65944243 636042010 546209121 100613881 532913686 12737589 361002639 340346412 286962438 326599554 451132881 199814930 33353100 123971343 573657713 90573991 631805592 300002816 485797074 9171304 46474792 123847129 467988777 201941210 289081600 111498182 65481045 126314257 254341989 116389151 85777636 559791055 512700696 75328982 267151121 398138607 579363784 38169013 171562426 249381666 410461101 636960589 459630873 587230598 418221271 334349227 409454092 416289982 210360310 195257368 239641597 490035306 88448286 30021727 616099099 168712631 510502474 169553579 18784218 284289823 296852640 415858276 461999447 90334975 71690580 185881566 326284130 283093018 327311806 591872674 472795312 604920767 640244477 487616233 210936898 607115955 124541438 91608868 590178166 520205514 413931424 449210187 6154113 576554977 547756181 89250166 42657921 475758411 346496249 29129252 634762880 506133305 567375166 223869047 450227572 354328772 294897571 361775447 268013533 549397995 455945812 565404365 299113343 421554862 216015211 23728425 356053502 80321482 44261483 319772695 492490861 384263788 357696222 598635289 298994838 595622590 292950585 116364228 284296315 410495728 560417380 147268131 315849940 80115136 541890353 543793450 49030965 391221033 270066008 105605523 290578575 168777585 227700674 263478366 397683983 7785059 337904486 608988419 593675131 599209445 443500353 18653605 137795210 100033929 325175664 123655063 222784265 604683740 374176252 183262854 72142007 545290933 137302028 569547739 381648589 569738136 336730857 140205988 332377574 371852014 137865522 77874982 571896449 97724258 310303268 620277397 198118297 408917456 491447874 34642235 281601301 404897967 172521546 587473657 86483796 481808732 469843524 409894104 518670357 565707246 485990263 111629979 70503275 504861718 621450856 108494881 352533245 36673095 212554045 20082204 575640376 121104019 614681706 26258418 226318558 535717563 50729132 38089062 622825057 614645499 10836269 459175975 532832282 484130472 109583275 555116689 170096533 163484449 104875830 22454265 101252986 293588715 262530249 494306303 639237628 91774210 620846182 512570794 600181423 596728986 368691388 349156760 243480512 533669581 634676094 150790190 190395087 607364191 503893553 560418959 214388137 76089156 303015735 326479209 192735058 580817962 203776249 574552349 244228447 529700169 478716749 512875953 301625067 235376661 74524826 457086868 464034533 175988490 12303898 409302087 618957471 587484940 544879236 436181366 96766580 618264633 185674645 297344769 60978613 257380428 445370927 91791221 613484514 487805763 559726995 314870946 326764973 175539412 421915692 476441344 490953913 219185885 71636083 100132382 181127273 232209082 375137648 326802488 154520546 146876901 617459930 325969845 528702299 513260553 624684115 293682998 556666198 46465144 253462113 259595373 8002995 310944461 593454299 30328114 562726936 139632679 244662051 620326196 446525153 182352881 290224710 344917905 389507323 100962376 437488980 154249209 595467340 389056287 58475623 139709630 159890419 331321916 543666140 299581008 168933145 562278137 640306643 285363867 204654095 59170656 263633120 432022009 290867646 212730043 554351114 157238654 619199152 551353309 495154809 28772920 401915154 344348771 205851007 253509062 489175908 560685922 348886958 494293900 268681145 312011210 251805332 455271222 297504133 61850328 154429587 571119709 296337436 137189597 425316811 343763627 315418584 432440806 597915804 340712139 170998308 245412281 227373576 155821146 59484517 360856857 164062282 112846330 191892230 582399140 452727209 363117785 153305185 557371261 40975226 216081846 500438192 580303268 167903686 7465408 299501299 171038466 120357434 244953323 285257032 473174318 549526052 473888359 478901216 45076869 3496722 123088875 443567248 573414430 323605817 118292720 250663699 207795246 574998225 615917695 352390916 581431588 514991943 602593665 258862571 302446752 330032713 217768615 594249452 7499441 425635101 63323731 327276582 400564276 459716421 77315082 569930835 531731344 483588585 117911076 380159941 174142593 433389540 254460473 312293928 102292206 598073383 49530451 113331559 101400258 265339035 210498669 369609111 16385344 515447965 513383219 368374355 355454309 202130611 27731672 227400415 424728278 53022270 582519392 506913469 90559317 9513703 371150311 518972793 272004397 88505964 232309505 33372111 217807873 416712653 16344562 194473097 71063096 350167211 259081888 386575334 483930114 120610276 186130841 389716585 289921467 581531661 539048407 132939611 615879095 205480235 475115718 530706008 624572600 485554011 400523687 255509781 207404674 464102426 560794754 92627396 378132968 219680806 301291859 89538243 529578067 82064720 229299531 582362836 372843219 304433791 272696555 583048838 396134387 202476552 50797674 125798943 598812877 7331002 472695577 458504978 610390923 130076987 296244017 36066189 353300105 48854600 592471760 406533725 607715654 423229630 68930705 491740854 84246922 299225824 601701373 218057547 255031001 236883322 119230795 39540890 266121715 163846518 273618818 561063862 487267878 330569635 320984889 119114946 158376798 357991538 571100247 460905400 588724218 319644627 291789456 74492682 35253104 587631886 67335434 377860408 29553752 568874070 114740343 198858616 175723751 452503268 569809400 476647093 360493712 213191540 229656246 476577791 182990075 239229151 636509146 129669396 305775404 349577322 289300955 485672522 218082153 190137915 98565715 98747915 408508582 420061368 630723982 273381068 331009408 195535466 542665998 484586279 400439900 479955929 86448864 508034105 4201199 436048418 47265123 522929861 437612378 407155848 19202798 177487436 404795284 639862245 557742191 89907820 403268160 131782451 312148990 154562142 567171938 594255754 548498952 541256216 75871719 110475585 241010951 609600921 304202119 439354845 428106300 458764823 598607043 241432967 519931213 209104328 19296300 383013354 196440465 478344614 230167789 429301489 276546798 456670776 72101756 182938976 180026875 234029693 298564445 464739924 116979360 218286595 286082420 451457011 572821906 326289879 178761057 462677227 367341007 298285902 153091800 279292464 310814076 207228469 269077188 270435123 63832912 636913355 180916872 320790628 210609591 501915189 63772779 188160539 584488471 114855400 483837806 348693462 580966716 100344733 332806886 363476374 589634149 385146544 330281676 325217860 620216977 263075995 416291031 133089639 203811185 404047383 102102474 193739621 158396267 97524320 552171273 639076471 565414533 100730722 166265786 13615695 349487394 278138750 573273904 91590147 339450983 117589749 189054918 354318360 231882728 517587635 143237717 119120420 230186317 216069422 242784595 281450659 178984412 208425988 467224833 115563547 320348244 123082349 115560155 622404412 620753524 151192349 170277641 27608933 85558662 399506048 425474422 635969028 581645577 176908394 549554296 581542589 611266488 293378842 296824850 564228005 141237620 386540264 77688817 282670895 124523837 341835751 50237812 543859957 556045496 335971675 111331866 523114248 163043811 460190430 422539784 517995975 75779151 261459459 560007912 127342605 163741343 616079554 355076231 372049729 590011015 574231970 635502340 413112394 489894839 417684379 333530114 175989251 523265062 5654446 450864542 320436428 469593056 430170361 172728586 420309413 234643609 607889026 \n", "592263961 165475722 583773909 396780837 584631892 422075521 317497560 630690766 137348180 139392851 43586425 624876969 82513931 461445043 464652342 58959834 627052440 422620213 421327831 326390917 499998056 171038267 609745700 434147758 144613723 10987579 148347295 51888196 128848986 118082712 596286457 601680256 54421870 375295996 356364306 23271968 3347452 161208508 450928563 178923541 266284500 43828961 58608566 410987476 485580126 249320822 659296275 418893789 42908164 114099576 631380329 327881992 644791717 247407900 338845373 193424651 256860266 138091489 333532422 6246601 620632490 597497565 286558556 403268386 276915754 328830329 631966301 252675040 649180894 214146899 469385114 135335119 682078563 47124682 624481071 597258046 25662160 451440486 147925226 108032374 22785352 481343127 638731823 36052908 251402193 584527861 283785840 608442706 635812415 529262621 333749682 256749399 323480175 282746312 586987675 79843856 60177119 259202967 497002691 443069107 329429995 630227602 392390562 232819008 256377503 240221083 372959429 307411851 502907583 122805944 562662302 138709504 377658342 488935744 379990256 423394419 598187160 194543181 510553953 341195591 192939625 397957902 336014562 532625134 295796935 506476676 452236013 47092107 330288595 489330072 635738979 331669479 651399604 77109172 517879688 341858715 145249950 406949015 482473428 581934078 228453040 136138782 159868579 249882792 45496510 623400569 668555729 551117692 93477610 31097792 679046496 487005425 249067704 643576386 556105345 647824104 394198621 507757736 646869380 300223253 447065561 659813478 397849712 297003728 3029540 277943593 394234597 429785075 102223544 203143277 24634114 34231110 35525968 173196313 522402348 461195149 319317173 485572898 371489523 669155379 220169404 224200467 79614013 510275566 610880869 47088835 364245809 402232048 144460787 61448590 56815921 654025856 266543474 259227711 77364386 256011703 592451146 222310280 608983825 164073601 399472114 538429614 512863933 584237831 528811033 636086646 586124761 317603213 636716070 341053786 284653273 153833286 189908702 412673792 366603125 39889003 115242339 650937304 127967378 79666303 215813024 224181798 138318221 7130547 545437940 166741477 581925784 589631538 454986763 232379941 15081758 7478143 500054891 226384352 545350420 606503004 674183279 380715191 274562337 398058014 22220511 481603110 585203287 477942202 482200770 366883497 354867025 510768994 486202091 307440188 172822238 683477198 602242578 305533349 666524384 345823518 457051598 320152317 67430987 209085231 375914633 429024283 482833226 316147281 213433043 399438610 399333794 261244810 22377231 408301035 17448010 345817560 676618121 157559416 469247596 95491862 273526767 343916148 508933794 114312320 137502825 411801688 437261260 463775181 242903505 524425863 562301975 435313736 14582941 634749425 667563245 654645322 463899092 252893083 528519218 141158475 169508198 567893245 625461803 476271451 60532720 20208140 403979829 655665341 369070323 55702391 271340272 5082184 349787740 138470902 213415523 359217050 470216995 54049606 17577211 280912164 490447033 461244133 633165015 569707027 48426495 682624889 75348454 274036130 596784047 465821123 574279932 275660011 586028693 303950057 18955421 398775481 640252522 125252884 50509444 592337801 173088730 15768600 426213440 591281135 159048584 290858125 19319081 145478969 239946754 318148064 169806293 462634113 641961414 397558981 363909347 451899080 213048488 165363652 669934986 431318074 137159071 388925094 532031617 394916362 85564481 177102337 566292996 540193275 103579471 281292056 683525393 299880662 190263721 239135026 596704725 70835731 264340484 170838571 39068635 250881072 187222379 411260631 176274708 97853805 684598638 312876070 477667966 121118931 200693911 248880990 134473214 432698109 50123533 82982741 454688061 576520918 465856439 664403576 452729627 214085195 278769213 298278438 264509743 17424148 17240766 549352924 597516378 628605947 646807414 639271858 180296396 232072964 294205321 583606044 204862661 593638971 287350010 228693862 618759945 59273546 360030231 54876869 549666458 480984282 174933444 596956244 229092264 64933222 514874410 527925138 475599754 394476638 563710221 161401113 608714223 307277918 178544198 386555707 316267649 475841641 333406501 279834267 40579 268453840 433914824 652988516 412684432 34665737 141321960 84334699 535383435 609894596 419701779 308817084 304067727 578686983 203449897 439796161 64015702 255626174 463988185 353639390 539838848 142567279 590417511 509818196 102130776 577330101 633108795 493378176 535115464 587089283 545429538 187102877 523187319 273152853 132286870 87796932 7832501 23376894 204855586 369546617 537114270 180493699 306156472 386574060 19783963 663305371 538093818 666103921 470181504 244149524 342444224 494123836 222526492 667637684 191685931 359492183 384146579 293582 623264165 263786154 155900580 616319195 481615847 408104985 646783923 558391020 474488600 308115506 166870574 599472509 183306479 357257927 49639403 118250445 309253922 449467357 415841382 531046063 62530684 67054506 532517078 243196435 602444556 656655569 348020185 302783011 496686220 96685179 487109471 588094747 391618348 264900975 448473079 201050200 200953381 425012617 140589121 147603411 175108086 578030456 83533667 324687041 298464551 230748461 610852420 211428498 289630523 192528346 631673476 454045556 619279353 145814621 474863681 90008844 318253111 594910474 47842620 634177589 280544867 48667347 18337946 88049713 488624679 596394871 525061546 183822917 388593472 378028887 386399492 171791137 263444853 475985865 237933417 645149283 466969840 452014683 314041056 560780859 253788178 491229761 213942702 645800885 251075502 51996885 659678664 473174243 479935521 394176201 218431080 59244415 204477277 34162937 359389615 557007974 612466424 167500413 471632889 425557568 246637822 564088246 423481288 364722788 642030791 348208091 362192722 280801635 78975533 202472134 419656473 637102228 33448777 55286973 39341873 256086248 19366540 511659698 632021137 415267579 369389176 23439840 627173783 595633142 115783984 294098849 486707060 296267311 133825527 73787719 261028425 477913828 13142132 557999648 257559326 569885862 36120349 196509188 200886946 535091941 256615482 481208228 521319537 636170616 659198970 266108963 43928393 581910581 539815488 666820480 508091779 546297189 9094440 352927357 97287009 56756885 492309243 635775157 228103297 88630416 656061353 68669292 463154837 257439966 241207445 160364995 648605829 650201422 87445349 309704872 476911262 169535778 28425570 113879245 34959691 2524833 511582311 561940623 437225192 366650479 224104477 311484993 659687776 280352117 167667715 438074766 25070407 110826762 253123089 291877557 265645100 57116322 377297011 486691058 128647978 427049013 473327868 635796003 668740595 398133396 97277805 352617555 168468172 298885401 545063458 232828907 482330792 410164250 218191832 309111741 129547678 33114859 240339424 595763580 174482546 139717406 234765813 60754066 504174950 76373051 641564092 318971897 422253021 631887681 500516389 250322318 620280224 620015535 412287357 535580521 233706185 35239490 219727118 550155679 319346484 152495603 58343099 174469519 419280325 155109463 326137026 563109548 396906336 56431944 41862385 474637262 53729735 464682056 549005446 675496683 538302 168000355 159132867 95822376 513973916 429751621 3543773 485152958 538391234 56068590 382031756 47741221 143967909 566704729 134582252 568513285 378756836 46226840 649445812 632250274 342007586 74973745 168521603 7600994 106030861 210286576 681347998 629672802 33270877 76630664 611587581 447723030 155614728 570301877 536177939 224447826 444876597 325192701 370731184 236873518 288841881 187666019 43229217 503065061 62980314 29104608 669476065 658611478 71003235 173260623 101150275 322900839 163646040 677428854 40307996 369780720 106686549 316784094 296448532 567719334 268729346 297317152 6762395 223927355 32639145 196863951 122739026 144014420 204772491 80659548 176301522 367657873 588697079 318715906 547289858 18944311 225795599 518000746 464608050 221624399 101861337 545957859 498568088 333838331 402217235 12244614 316286253 543857377 377154524 654809794 320641967 303160025 453233668 112470639 429924348 621322915 408478716 609139015 645366216 397097009 608330751 598578379 459493881 352413191 658004080 59136359 75292005 117361744 117332059 448513710 375702561 9793386 632799789 189960496 604238974 509771319 23561571 165963159 488008683 339759418 135705800 506115392 513412942 275313943 172664739 130251853 620125244 679382590 644688304 86718264 637457949 644671722 12731397 606475490 610917122 323954564 124604768 153042595 521043247 617025066 617258466 122555835 169706638 611481275 311504114 289570020 648321548 105094554 428829909 211131907 391976518 527055894 278625259 115502867 556272057 96067083 405916212 499527624 125746032 345869544 205314127 602186431 657598226 61370675 171279067 493222681 259362338 341736004 488114317 520559096 238923340 137254333 73532730 64144757 630962246 606319760 30448346 314265799 512643458 502136433 211320181 152337071 220230666 667342347 363528960 172117515 202790833 363936903 91558756 347534054 182859483 227648726 368793621 616782585 599354615 674532264 140409920 573193556 56829877 169824412 489395006 48621084 623502271 586360424 615872526 304257676 340687161 414185127 44862769 74935521 160936889 177778577 635048920 258762645 627030649 116696605 283571101 159911576 389123487 169801205 264834262 383339513 592827869 468206568 488625356 508306343 127872683 639955087 266953235 459124049 213777630 100451369 318892186 306076280 253871280 432102801 450922145 450446969 649495512 498106869 635565823 683158578 58899842 398085184 572468116 309901410 283266403 185989454 486040432 134741563 20176445 330147063 637409029 111757320 329183337 55037945 129393926 272722862 529340362 481461069 489396504 47089959 270047190 170216830 626519096 612613499 243190521 628272173 154782401 273589317 318266707 20186068 479284249 567195867 386252099 334565625 640158723 359603910 326113296 13171799 43777135 269289243 501677862 590912472 68335062 91544906 398656801 255442813 414488888 142913411 487556282 650720560 431106787 558680073 181493061 417323392 641995398 559979567 157998536 654874978 531171052 397476091 217702464 226746801 539925677 317966941 147493079 371905322 481811118 656677822 338204581 267171639 535771968 337905332 521651400 482019680 649719527 413072464 382869999 661952491 292958555 647693755 405244437 136509184 133397899 427703694 111035241 420359039 3529490 79851899 337472554 641193119 285209760 333072662 353985140 173454727 454631792 383584257 594725314 405287743 558885584 409809738 584014506 495493556 672399147 438855896 15920725 630160371 596239786 522446550 275078931 28719190 400602456 592609235 315170408 551181972 58860694 96779376 560619843 351535532 240041816 518941390 472869064 159208582 67860623 532110114 466254251 376163776 26623879 531918177 92957541 498853015 210586380 183224288 588878007 175201961 582090265 356897883 235861507 397396584 156545314 634464983 619635997 320137200 632837285 410464597 666677397 167535211 652726115 75644589 606310699 643290009 20535152 371010501 535083399 655712195 365906187 641472206 398923937 657310639 117754350 99840379 148996430 273336999 110085311 382417215 644756786 632115880 550334722 608058581 75078956 186326705 92282050 529265223 122432492 407792220 247170603 517909034 611435890 378726045 196948489 460512215 353567644 375211066 619001912 4745015 422320370 679130912 106362167 55793079 638499991 267911169 206263475 85449141 103529193 294012972 126372642 611808525 497490849 41567322 144524997 147432353 670499058 227190157 525818225 596391900 400670711 338530118 27249178 489479872 441091523 504205327 195271212 548362220 548804177 583342493 354134880 502986957 480438895 149313583 525484079 540519333 77393434 318775545 297697318 310656117 28281055 607742108 353975774 314399896 235844829 460485304 167869388 297886050 581833516 377329710 466227605 593951668 633952639 446178224 121560635 230917063 485257890 456079440 546635367 453670969 67283536 625339267 84115170 528105404 236594946 452198223 186698077 666507544 95693582 360107993 249809514 352436829 214952216 405282892 650396897 401992441 574227991 239411741 107569645 51447735 207722220 444374104 80308516 518806899 566192830 198193750 677300254 334598522 634498327 273752891 242289046 618096952 300489169 297571161 422858518 407817727 102729811 192939887 29169959 519807542 556233096 233912093 542902680 671564970 123446226 640381742 79219074 678043267 659322057 30944946 507223009 295925083 546666631 243863122 378738058 322627072 146952737 272328044 292420846 422974234 552722732 206477152 107337451 587949105 563661815 31120394 295042515 135384440 670527793 242451580 188787214 582738374 160275975 449867690 382390561 40741133 153309306 646428766 83804746 240358642 610994122 615106103 88603587 588006361 370027178 139413251 454067872 449809803 35281524 362923308 149211708 433749057 640294231 252138420 550984009 272919810 358802683 216804970 581437508 168979961 622196038 424742000 668111784 26783851 375573278 10939577 306393948 338953216 650354359 521564738 583895671 169080779 442014377 482166704 207620618 460926826 274145695 501667533 376026077 537556995 461314351 572658725 285486476 338588995 207153397 340653001 20188460 179381244 621201745 481977760 495760592 281590716 522357707 397978640 2855169 227313775 154402799 232455892 501406418 222756419 453590429 294798749 197228908 244063692 411841254 159202059 382918245 307212776 517828800 311684046 424886356 556013934 13941980 181354145 151211342 390167614 273970973 149205763 203733770 682710915 555580618 83067227 152209142 424542639 400665554 598279992 124610067 359906625 474307679 184319898 98358769 313114900 665284305 143024740 345403667 109604172 249798320 491981841 223526298 330131524 271879521 452428387 175135994 613324428 147832189 679330844 319110785 210712797 423393486 46349356 260617131 577004711 60669250 340964194 269902037 49340037 93334534 540942946 402879342 235034958 549003465 201496891 662314047 456519932 270692421 463328791 414311012 215282268 155610567 501494121 608446220 324606399 159562002 574924406 437973623 11174731 76321880 416269277 228534000 541480514 393344152 522459095 165082499 227170748 584544866 573149796 673795089 87775449 642179365 178930599 267403590 395226787 223595129 377912666 498479527 541574576 479656924 273970941 640840081 553764860 250910142 124990555 579838838 361438518 514671452 299920604 577034278 136898412 421561512 419688864 186652700 79118244 554838225 238712117 88716541 639510024 338284016 481654617 230050489 165345946 609949862 347745623 215102389 456248239 64729961 660928083 338511518 121640591 28672392 242017730 388910614 514890516 684538306 671054424 303280566 479639496 361041112 536842674 259593975 277144504 402072464 95281194 630193180 167701812 564268637 232550580 466652658 199094185 150524490 133799971 446013246 236348737 452865571 537145885 246277046 129347557 623985898 567277025 623348954 27339914 45267749 542392969 437526188 127564887 512706768 639982954 257821581 470657801 505153326 644918284 57221479 568767997 408168138 297243802 631987317 16556720 620079441 465936181 296285096 96470002 208729280 234617024 296270345 207401586 140147988 490917795 670815381 124507022 641630542 324047335 671769442 502671670 27725252 123802987 155442385 372948635 594479124 574290392 351076804 287722256 22761560 473783694 71605343 129399959 385780688 258342242 590626733 262734176 426394319 578050227 431296931 443162522 262616768 465484806 396940490 431088807 184938369 103413044 233899435 609743485 376674242 557596893 429190005 197135139 386922157 114579267 646948422 578682075 571078423 175124562 451344015 259072743 399655413 375340649 488032138 525417535 401269686 622925654 59862912 508868984 159712960 394123844 584456313 199720484 508864362 601237081 443696288 303785408 507703016 482813218 436402054 262562729 100113077 292728698 85958718 313029011 407621753 343509608 464117233 276844519 298208037 569523371 456159039 424055101 236094173 355542082 139121800 430382975 431578286 481711002 476854024 108321154 684210941 620647275 493708150 68564693 584697922 179427533 29453065 358794217 41218838 587997143 229523694 169059324 541759569 320116773 337291908 344629166 423389452 56282657 678982344 370530198 586040221 280614062 209027310 220321338 46058505 228034212 292581967 583803745 436247530 413036013 468962726 495897277 72182219 338490025 464086293 589906467 622445894 127154171 278601275 203902291 267575354 7833760 59746096 259694574 582834051 443379384 142674774 595649454 494120923 23422153 170576746 100354451 661717825 154146995 74240988 350470168 616142852 666514124 504896255 361769428 331226985 531149456 59651131 542945906 468424490 255825325 503291987 529140081 530347459 550927766 605474402 18995414 373529611 63334642 307424634 245001205 652368128 116024578 296544229 169231899 548591553 353465078 180795802 464000460 5532744 101638110 407133136 515312957 670846205 350142872 329688516 497406584 589229437 179170689 81816005 317834790 31336873 75082985 208933510 136855373 657099843 607265354 131050659 674673706 418029619 10601492 442452956 296538614 261441058 267485400 227748902 563489999 307140828 585834665 459583684 120677886 155920584 401342453 584740564 473657263 613088537 600254756 532534546 570066117 451424702 656719325 450139315 581008953 291688126 81304965 467798757 86875294 162508873 90457293 171583262 410985107 165397707 213829162 582830259 188698227 254737429 162555295 389302808 554207644 587596258 303638742 590079704 524755046 552282348 624425887 16522653 511596911 86404988 322828812 352383805 491887706 349780253 25036848 393178432 191568074 342272152 540253003 82092334 549310202 626769429 310379733 141051428 43544949 380146753 345363478 643316165 108497224 591695270 362554187 290588277 427756545 471836573 253249496 106354132 192420221 19549131 399917687 338674702 493971661 75100206 177246036 28242906 124922361 521128882 108501228 295322623 257082397 287014755 538063754 377910308 381228977 487552947 333584942 295030771 122478760 165072 454060594 356240713 355539291 360435729 666834362 532765583 66049249 476922842 538291582 393481809 529521755 570971393 194460675 120833022 291001538 256529380 143555118 557428635 534745738 321012985 233549549 433601670 327715998 586513895 68989812 593875567 36840649 201126064 132919346 104290478 230825801 179101027 15838626 87657821 211251922 373630893 607434041 170429966 172369926 616746082 433965030 564703354 682824167 287768348 479123699 273609269 363518826 566199075 624509644 553529758 435499123 83200452 451451012 513864396 557473105 544402221 462416935 196350566 315018384 343942319 136614753 19549640 44367986 664509729 631078181 525234352 152295190 182641151 629411619 192854650 188569945 105868469 442700138 318230227 493744451 365551080 388360681 261818520 661879806 571682203 69525684 336921063 47404604 35093356 44841783 478168110 679351865 228298701 288947018 416757248 5276896 431020569 160043622 397715126 16699730 76477007 145616428 628855931 6931020 88341840 503493075 218405341 562850514 440225901 298663121 500419920 221326068 535618455 652177998 278477470 540720866 95998773 620676882 599203619 404164821 676827867 161574011 406829346 354565299 504412171 16022801 672018307 255715937 285291271 97403370 626195010 544687112 529827176 678120065 307403860 161294014 554353690 524396434 586580368 473782506 536895895 156551385 662698909 72742195 373891020 631270494 122307551 294144769 598974457 214248328 561745263 678338466 524331996 306586328 371625952 530940409 618008045 295587638 623451370 96618711 307685174 446615877 157657498 586304350 662838089 616208887 200530148 553566609 600069784 300405261 128670566 39661946 203527056 65685034 557057302 314202852 487842075 576167177 257922005 108243230 179770861 184619877 242630273 250017406 304134414 3417515 554524412 567366638 491079560 333345814 311878735 300311678 65614283 245697492 540958190 584324104 315237061 501548763 171584795 534662034 52638725 119254205 426851316 142635388 399403911 446326877 449492582 206113598 59781463 9739068 \n" ]
This is the hard version of the problem. In the three versions, the constraints on $$$n$$$ and the time limit are different. You can make hacks only if all the versions of the problem are solved. This is the statement of Problem D1B: - There are $$$n$$$ cities in a row, numbered $$$1, 2, \ldots, n$$$ left to right. At time $$$1$$$, you conquer exactly one city, called the starting city. At time $$$2, 3, \ldots, n$$$, you can choose a city adjacent to the ones conquered so far and conquer it. You win if, for each $$$i$$$, you conquer city $$$i$$$ at a time no later than $$$a_i$$$. A winning strategy may or may not exist, also depending on the starting city. How many starting cities allow you to win? For each $$$0 \leq k \leq n$$$, count the number of arrays of positive integers $$$a_1, a_2, \ldots, a_n$$$ such that - $$$1 \leq a_i \leq n$$$ for each $$$1 \leq i \leq n$$$; - the answer to Problem D1B is $$$k$$$. The answer can be very large, so you have to calculate it modulo a given prime $$$p$$$. Input format: Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 3000$$$). The description of the test cases follows. The only line of each test case contains two integers $$$n$$$, $$$p$$$ ($$$1 \le n \le 3000$$$, $$$10^8 \leq p \leq 10^9$$$, $$$p$$$ is prime) — the number of cities and the modulo. It is guaranteed that the sum of $$$n$$$ over all test cases does not exceed $$$3000$$$. Output format: For each test case, output $$$n+1$$$ integers: the $$$i$$$-th integer should be the number of arrays that satisfy the conditions for $$$k = i-1$$$. Example Input 0: 11 1 998244353 2 998244353 3 998244353 4 998244353 5 998244353 6 998244353 7 998244353 8 998244353 9 998244353 10 102275857 10 999662017 Example Output 0: 0 1 1 2 1 14 7 4 2 183 34 19 16 4 2624 209 112 120 48 12 42605 1546 793 992 468 216 36 785910 13327 6556 9190 4672 2880 864 144 16382863 130922 61939 94992 50100 36960 14256 4608 576 382823936 1441729 657784 1086596 583344 488700 216000 96480 23040 2880 20300780 17572114 7751377 13641280 7376068 6810552 3269700 1785600 576000 144000 14400 944100756 17572114 7751377 13641280 7376068 6810552 3269700 1785600 576000 144000 14400 Notes: In the first test case, - arrays with $$$1$$$ good starting city: $$$[1]$$$. In the second test case, - arrays with $$$0$$$ good starting cities: $$$[1, 1]$$$; - arrays with $$$1$$$ good starting city: $$$[1, 2]$$$, $$$[2, 1]$$$; - arrays with $$$2$$$ good starting cities: $$$[2, 2]$$$. In the third test case, - arrays with $$$0$$$ good starting cities: $$$[1, 1, 1]$$$, $$$[1, 1, 2]$$$, $$$[1, 1, 3]$$$, $$$[1, 2, 1]$$$, $$$[1, 2, 2]$$$, $$$[1, 3, 1]$$$, $$$[1, 3, 2]$$$, $$$[2, 1, 1]$$$, $$$[2, 1, 2]$$$, $$$[2, 2, 1]$$$, $$$[2, 2, 2]$$$, $$$[2, 3, 1]$$$, $$$[2, 3, 2]$$$, $$$[3, 1, 1]$$$; - arrays with $$$1$$$ good starting city: $$$[1, 2, 3]$$$, $$$[1, 3, 3]$$$, $$$[2, 1, 3]$$$, $$$[3, 1, 2]$$$, $$$[3, 1, 3]$$$, $$$[3, 2, 1]$$$, $$$[3, 3, 1]$$$; - arrays with $$$2$$$ good starting cities: $$$[2, 2, 3]$$$, $$$[2, 3, 3]$$$, $$$[3, 2, 2]$$$, $$$[3, 3, 2]$$$; - arrays with $$$3$$$ good starting cities: $$$[3, 2, 3]$$$, $$$[3, 3, 3]$$$.
1
Codeforces_test
null
461
stdin
[ "3\nGARAGE\nGARAGEFORSALE\nABCDE\nAABCD\nTRAINING\nDRAINING\n" ]
[ "14\n10\n16\n" ]
[ "3\nGARAGE\nGARAGEFORSALE\nABCDE\nAABCD\nTRAINING\nDRAINING\n", "1\nABCD\nDABC\n", "1\nGUFY\nTFIG\n", "6\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\n" ]
[ "14\n10\n16\n", "8\n", "8\n", "2\n2\n2\n2\n2\n2\n" ]
There are two screens which can display sequences of uppercase Latin letters. Initially, both screens display nothing. In one second, you can do one of the following two actions: - choose a screen and an uppercase Latin letter, and append that letter to the end of the sequence displayed on that screen; - choose a screen and copy the sequence from it to the other screen, overwriting the sequence that was displayed on the other screen. You have to calculate the minimum number of seconds you have to spend so that the first screen displays the sequence $$$s$$$, and the second screen displays the sequence $$$t$$$. Input format: The first line contains one integer $$$q$$$ ($$$1 \le q \le 500$$$) — the number of test cases. Each test case consists of two lines. The first line contains the string $$$s$$$, and the second line contains the string $$$t$$$ ($$$1 \le |s|, |t| \le 100$$$). Both strings consist of uppercase Latin letters. Output format: For each test case, print one integer — the minimum possible number of seconds you have to spend so that the first screen displays the sequence $$$s$$$, and the second screen displays the sequence $$$t$$$. Example Input 0: 3 GARAGE GARAGEFORSALE ABCDE AABCD TRAINING DRAINING Example Output 0: 14 10 16 Notes: In the first test case, the following sequence of actions is possible: - spend $$$6$$$ seconds to write the sequence GARAGE on the first screen; - copy the sequence from the first screen to the second screen; - spend $$$7$$$ seconds to complete the sequence on the second screen by writing FORSALE. In the second test case, the following sequence of actions is possible: - spend $$$1$$$ second to write the sequence A on the second screen; - copy the sequence from the second screen to the first screen; - spend $$$4$$$ seconds to complete the sequence on the first screen by writing BCDE; - spend $$$4$$$ seconds to complete the sequence on the second screen by writing ABCD. In the third test case, the fastest way to display the sequences is to type both of them character by character without copying, and this requires $$$16$$$ seconds.
1
Codeforces_test
null
462
stdin
[ "1\n", "3\n", "1000\n" ]
[ "2\n", "4\n", "1167\n" ]
[ "1\n", "3\n", "1000\n", "2\n", "4\n", "5\n", "6\n", "7\n", "8\n", "9\n", "993\n", "994\n", "995\n", "996\n", "997\n", "998\n", "999\n", "730\n", "418\n", "550\n" ]
[ "2\n", "4\n", "1167\n", "3\n", "5\n", "6\n", "7\n", "9\n", "10\n", "11\n", "1159\n", "1160\n", "1161\n", "1162\n", "1164\n", "1165\n", "1166\n", "852\n", "488\n", "642\n" ]
Recently, Monocarp started working as a director of a park located near his house. The park is quite large, so it even has a small river splitting it into several zones. Several bridges are built across this river. Three of these bridges are especially old and need to be repaired. All three bridges have the same length but differ in width. Their widths are $$$18$$$, $$$21$$$ and $$$25$$$ units, respectively. During the park renovation process, Monocarp has to replace the old planks that served as the surface of the bridges with the new ones. Planks are sold with a standard length of $$$60$$$ units. Monocarp already knows that he needs $$$n$$$ planks for each bridge. But since the bridges have different widths, he needs $$$n$$$ planks of length $$$18$$$ for the first bridge, $$$n$$$ planks of length $$$21$$$ for the second one, and $$$n$$$ planks of length $$$25$$$ for the last one. Workers in charge of renovation have no problem with cutting planks into parts but refuse to join planks, since it creates weak spots and looks ugly. Monocarp wants to buy as few planks as possible but struggles to calculate the required number of planks. Can you help him? Input format: The first and only line contains a single integer $$$n$$$ ($$$1 \le n \le 1000$$$) — the number of planks required for each of the three bridges. Output format: Print a single integer — the minimum number of planks of standard length ($$$60$$$ units) Monocarp needs to cover all three bridges if the planks can be cut into parts. Example Input 0: 1 Example Output 0: 2 Example Input 1: 3 Example Output 1: 4 Example Input 2: 1000 Example Output 2: 1167 Notes: In the first example, it is possible to cut one plank of length $$$60$$$ into three planks with lengths $$$25$$$, $$$18$$$ and $$$17$$$, and cut another plank of length $$$60$$$ into two planks with lengths $$$39$$$ and $$$21$$$. That way, Monocarp will have all the required planks.
1
Codeforces_test
null
463
stdin
[ "4\n3\n1 2 3\n1 3\n2 3\n4\n3 1 1 3\n1 2\n2 3\n4 2\n4\n2 4 4 2\n1 2\n2 3\n3 4\n13\n1 4 4 7 4 7 1 1 7 11 11 11 11\n1 2\n2 3\n3 4\n4 5\n4 6\n2 7\n7 8\n2 9\n6 10\n5 11\n11 12\n10 13\n" ]
[ "000\n1010\n0001\n1001001000100\n" ]
[ "4\n3\n1 2 3\n1 3\n2 3\n4\n3 1 1 3\n1 2\n2 3\n4 2\n4\n2 4 4 2\n1 2\n2 3\n3 4\n13\n1 4 4 7 4 7 1 1 7 11 11 11 11\n1 2\n2 3\n3 4\n4 5\n4 6\n2 7\n7 8\n2 9\n6 10\n5 11\n11 12\n10 13\n" ]
[ "000\n1010\n0001\n1001001000100\n" ]
Let's define the majority of a sequence of $$$k$$$ elements as the unique value that appears strictly more than $$$\left \lfloor {\frac{k}{2}} \right \rfloor$$$ times. If such a value does not exist, then the sequence does not have a majority. For example, the sequence $$$[1,3,2,3,3]$$$ has a majority $$$3$$$ because it appears $$$3 > \left \lfloor {\frac{5}{2}} \right \rfloor = 2$$$ times, but $$$[1,2,3,4,5]$$$ and $$$[1,3,2,3,4]$$$ do not have a majority. Skibidus found a tree$$$^{\text{∗}}$$$ of $$$n$$$ vertices and an array $$$a$$$ of length $$$n$$$. Vertex $$$i$$$ has the value $$$a_i$$$ written on it, where $$$a_i$$$ is an integer in the range $$$[1, n]$$$. For each $$$i$$$ from $$$1$$$ to $$$n$$$, please determine if there exists a non-trivial simple path$$$^{\text{†}}$$$ such that $$$i$$$ is the majority of the sequence of integers written on the vertices that form the path. Input format: Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$2 \le n \le 5 \cdot 10^5$$$)  — the number of vertices. The second line of each test case contains $$$a_1,a_2,\ldots,a_n$$$ ($$$1 \le a_i \le n$$$)  — the integers written on the vertices. Each of the next $$$n-1$$$ lines contains two integers $$$u_i$$$ and $$$v_i$$$, denoting the two vertices connected by an edge ($$$1 \le u_i,v_i \le n$$$, $$$u_i \neq v_i$$$). It is guaranteed that the given edges form a tree. It is guaranteed that the sum of $$$n$$$ over all test cases does not exceed $$$5 \cdot 10^5$$$. Output format: For each test case, output a binary string $$$s$$$ of length $$$n$$$ on a separate line. $$$s_i$$$ should be computed as follows: - If there is a non-trivial path containing $$$i$$$ as the majority, $$$s_i$$$ is '1'; - Otherwise, $$$s_i$$$ is '0'. Example Input 0: 4 3 1 2 3 1 3 2 3 4 3 1 1 3 1 2 2 3 4 2 4 2 4 4 2 1 2 2 3 3 4 13 1 4 4 7 4 7 1 1 7 11 11 11 11 1 2 2 3 3 4 4 5 4 6 2 7 7 8 2 9 6 10 5 11 11 12 10 13 Example Output 0: 000 1010 0001 1001001000100 Notes: In the first test case, there is no non-trivial path with $$$1$$$, $$$2$$$, or $$$3$$$ as a majority, so the binary string outputted is "000". In the second test case, $$$1\rightarrow 2\rightarrow 4$$$ is a non-trivial path with $$$3$$$ as a majority.
1
Codeforces_test
null
464
stdin
[ "2\n3 2 4\n0 0 0 0\n5 5 7\n0 0 0 0 0 0 0\n" ]
[ "6\n190\n" ]
[ "2\n3 2 4\n0 0 0 0\n5 5 7\n0 0 0 0 0 0 0\n", "1\n39 1 1\n0\n" ]
[ "6\n190\n", "1\n" ]
This is the easy version of the problem. The difference between the versions is that in this version, all $$$a_i = 0$$$. You can hack only if you solved all versions of this problem. There is an $$$n$$$-story building, with floors numbered from $$$1$$$ to $$$n$$$ from bottom to top. There is exactly one person living on each floor. All the residents of the building have a very important goal today: to launch at least $$$c$$$ paper airplanes collectively. The residents will launch the airplanes in turn. When a person from the $$$i$$$-th floor launches an airplane, all residents on the floors from $$$1$$$ to $$$i$$$ can see it as it descends to the ground. If, from the perspective of the resident on the $$$i$$$-th floor, at least $$$c$$$ airplanes have already been launched, they will not launch any more airplanes themselves. It is also known that by the end of the day, from the perspective of each resident in the building, at least $$$c$$$ airplanes have been launched, and a total of $$$m$$$ airplanes were thrown. You carefully monitored this flash mob and recorded which resident from which floor threw each airplane. Unfortunately, the information about who exactly threw some airplanes has been lost. Find the number of ways to fill in the gaps so that the information could be credible. Since the answer can be quite large, output it modulo $$$10^9 + 7$$$. In this version of the problem, all information has been lost, and the entire array consists of gaps. It is also possible that you made a mistake in your records, and there is no possible way to restore the gaps. In that case, the answer is considered to be $$$0$$$. Input format: Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). The description of the test cases follows. The first line of each test case contains three integers $$$n, c, m$$$ ($$$1 \le n \le 100$$$, $$$1 \le c \le 100$$$, $$$c \le m \le n \cdot c$$$) — the number of floors in the building, the minimum required number of airplanes, and the number of airplanes actually launched. The second line of each test case contains $$$m$$$ integers $$$a_1, a_2, \ldots, a_m$$$ ($$$0 \le a_i \le n$$$) — $$$a_i$$$ indicates the resident from which floor launched the $$$i$$$-th airplane; $$$a_i = 0$$$ indicates a gap. In this version of the problem, it is guaranteed that all $$$a_i = 0$$$. It is guaranteed that the sum of the values of $$$m$$$ across all test cases does not exceed $$$10^4$$$. Output format: For each test case, output the number of ways to fill in the gaps with numbers from $$$1$$$ to $$$n$$$, so that the chronology of the airplane launches could be credible, modulo $$$10^9 + 7$$$. Example Input 0: 2 3 2 4 0 0 0 0 5 5 7 0 0 0 0 0 0 0 Example Output 0: 6 190 Notes: In the first test example, all six possible ways to fill in the gaps are as follows: 1. $$$[1, 1, 3, 3]$$$ 2. $$$[1, 2, 3, 3]$$$ 3. $$$[1, 3, 2, 3]$$$ 4. $$$[2, 1, 3, 3]$$$ 5. $$$[2, 2, 3, 3]$$$ 6. $$$[3, 1, 2, 3]$$$ Note that the array $$$[2, 3, 1, 3]$$$ is not a valid way to fill in the gaps, as the third airplane could not have been launched by the person on the $$$1$$$st floor, since from their perspective, $$$c = 2$$$ airplanes had already been launched. Also, the array $$$[1, 1, 2, 3]$$$ is not a valid way to fill in the gaps, as from the perspective of the person on the $$$3$$$rd floor, only $$$1$$$ airplane has been launched, while $$$c = 2$$$.
1
Codeforces_test
null
465
stdin
[ "5\n5\n1 2 3 4 5\n4\n4 3 2 1\n4\n4 5 2 3\n8\n4 5 4 5 4 5 4 5\n9\n9 9 8 2 4 4 3 5 3\n" ]
[ "YES\nNO\nYES\nYES\nNO\n" ]
[ "5\n5\n1 2 3 4 5\n4\n4 3 2 1\n4\n4 5 2 3\n8\n4 5 4 5 4 5 4 5\n9\n9 9 8 2 4 4 3 5 3\n", "1\n3\n1 1 2\n" ]
[ "YES\nNO\nYES\nYES\nNO\n", "YES\n" ]
You are given a sequence $$$a$$$ consisting of $$$n$$$ positive integers. You can perform the following operation any number of times. - Select an index $$$i$$$ ($$$1 \le i < n$$$), and subtract $$$\min(a_i,a_{i+1})$$$ from both $$$a_i$$$ and $$$a_{i+1}$$$. Determine if it is possible to make the sequence non-decreasing by using the operation any number of times. Input format: Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$2 \le n \le 2 \cdot 10^5$$$). The second line of each test case contains $$$a_1,a_2,\ldots,a_n$$$ ($$$1 \le a_i \le 10^9$$$). It is guaranteed that the sum of $$$n$$$ over all test cases does not exceed $$$2 \cdot 10^5$$$. Output format: If it is possible to make the sequence non-decreasing, print "YES" on a new line. Otherwise, print "NO" on a new line. You can output the answer in any case. For example, the strings "yEs", "yes", and "Yes" will also be recognized as positive responses. Example Input 0: 5 5 1 2 3 4 5 4 4 3 2 1 4 4 5 2 3 8 4 5 4 5 4 5 4 5 9 9 9 8 2 4 4 3 5 3 Example Output 0: YES NO YES YES NO Notes: In the first test case, the array is already sorted. In the second test case, we can show that it is impossible. In the third test case, after performing an operation on $$$i=1$$$, the array becomes $$$[0,1,2,3]$$$, which is now in nondecreasing order.
1
Codeforces_test
null
466
stdin
[ "2\n\n18\n\n25\n\n\n9999\n" ]
[ "? 3 5\n\n? 4 4\n\n! 4\n? 99 100\n\n! 100\n" ]
[ "2\n4\n100\n" ]
[ "4\n100\n" ]
This is the easy version of the problem. The only difference between the two versions is that in this version, you can make at most $$$\mathbf{10}$$$ queries. This is an interactive problem. If you are unsure how interactive problems work, then it is recommended to read the guide for participants. We have a secret ruler that is missing one number $$$x$$$ ($$$2 \leq x \leq 999$$$). When you measure an object of length $$$y$$$, the ruler reports the following values: - If $$$y < x$$$, the ruler (correctly) measures the object as having length $$$y$$$. - If $$$y \geq x$$$, the ruler incorrectly measures the object as having length $$$y+1$$$. The ruler above is missing the number $$$4$$$, so it correctly measures the first segment as length $$$3$$$ but incorrectly measures the second segment as length $$$6$$$ even though it is actually $$$5$$$. You need to find the value of $$$x$$$. To do that, you can make queries of the following form: - $$$\texttt{?}~a~b$$$ — in response, we will measure the side lengths of an $$$a \times b$$$ rectangle with our ruler and multiply the results, reporting the measured area of the rectangle back to you. For example, if $$$x=4$$$ and you query a $$$3 \times 5$$$ rectangle, we will measure its side lengths as $$$3 \times 6$$$ and report $$$18$$$ back to you. Find the value of $$$x$$$. You can ask at most $$$\mathbf{10}$$$ queries. Input format: Each test contains multiple test cases. The first line of input contains a single integer $$$t$$$ ($$$1 \leq t \leq 1000$$$) — the number of test cases. Example Input 0: 2 18 25 9999 Example Output 0: ? 3 5 ? 4 4 ! 4 ? 99 100 ! 100 Notes: In the first test, the interaction proceeds as follows. SolutionJuryExplanation$$$\texttt{2}$$$There are 2 test cases.$$$\texttt{? 3 5}$$$$$$\texttt{18}$$$Secretly, the jury picked $$$x=4$$$. The solution requests the $$$3 \times 5$$$ rectangle, and the jury responds with $$$3 \times 6 = 18$$$, as described in the statement.$$$\texttt{? 4 4}$$$$$$\texttt{25}$$$The solution requests the $$$4 \times 4$$$ rectangle, which the jury measures as $$$5 \times 5$$$ and responds with $$$25$$$.$$$\texttt{! 4}$$$The solution has somehow determined that $$$x=4$$$, and outputs it. Since the output is correct, the jury continues to the next test case.$$$\texttt{? 99 100}$$$$$$\texttt{1}$$$Secretly, the jury picked $$$x=100$$$. The solution requests the $$$99 \times 100$$$ rectangle, which the jury measures as $$$99 \times 101$$$ and responds with $$$9999$$$.$$$\texttt{! 100}$$$The solution has somehow determined that $$$x=100$$$, and outputs it. Since the output is correct and there are no more test cases, the jury and the solution exit. Note that the line breaks in the example input and output are for the sake of clarity, and do not occur in the real interaction.
1
Codeforces_test
null
467
stdin
[ "9\n2 1\n4 5\n9\n2 1\n3 6\n9\n4 2\n1 2 2 2\n3 4\n4 2\n1 1 3 3\n3 5\n4 2\n1 2 3 4\n3 5\n5 5\n1 2 3 4 5\n5 4 3 2 1\n4 2\n1 1 1 1\n1 1\n4 4\n1 1 1 1\n1 1 1 2\n1 1\n1\n1000000000\n" ]
[ "Yes\nNo\nYes\nYes\nNo\nYes\nNo\nNo\nNo\n" ]
[ "9\n2 1\n4 5\n9\n2 1\n3 6\n9\n4 2\n1 2 2 2\n3 4\n4 2\n1 1 3 3\n3 5\n4 2\n1 2 3 4\n3 5\n5 5\n1 2 3 4 5\n5 4 3 2 1\n4 2\n1 1 1 1\n1 1\n4 4\n1 1 1 1\n1 1 1 2\n1 1\n1\n1000000000\n", "4\n1 1\n1000000000\n1000000000\n2 2\n500000000 500000000\n1000000000 1000000000\n3 1\n1 500000000 500000000\n1000000000\n8 1\n536870913 536870913 536870913 536870913 536870913 536870913 536870913 536870913\n8\n" ]
[ "Yes\nNo\nYes\nYes\nNo\nYes\nNo\nNo\nNo\n", "Yes\nNo\nNo\nNo\n" ]
Kevin wrote an integer sequence $$$a$$$ of length $$$n$$$ on the blackboard. Kevin can perform the following operation any number of times: - Select two integers $$$x, y$$$ on the blackboard such that $$$|x - y| \leq 1$$$, erase them, and then write down an integer $$$x + y$$$ instead. Kevin wants to know if it is possible to transform these integers into an integer sequence $$$b$$$ of length $$$m$$$ through some sequence of operations. Two sequences $$$a$$$ and $$$b$$$ are considered the same if and only if their multisets are identical. In other words, for any number $$$x$$$, the number of times it appears in $$$a$$$ must be equal to the number of times it appears in $$$b$$$. Input format: Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). The description of the test cases follows. The first line of each test case contains two integers $$$n$$$ and $$$m$$$ ($$$1\leq m \leq n \leq 2\cdot 10^5$$$) — the length of $$$a$$$ and the length of $$$b$$$. The second line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1\leq a_i \leq 10^9$$$). The third line contains $$$m$$$ integers $$$b_1, b_2, \ldots, b_m$$$ ($$$1\leq b_i \leq 10^9$$$). It is guaranteed that the sum of $$$n$$$ over all test cases does not exceed $$$2\cdot 10^5$$$. Output format: For each test case, output "Yes" if it is possible to transform $$$a$$$ into $$$b$$$, and "No" otherwise. You can output the answer in any case (upper or lower). For example, the strings "yEs", "yes", "Yes", and "YES" will be recognized as positive responses. Example Input 0: 9 2 1 4 5 9 2 1 3 6 9 4 2 1 2 2 2 3 4 4 2 1 1 3 3 3 5 4 2 1 2 3 4 3 5 5 5 1 2 3 4 5 5 4 3 2 1 4 2 1 1 1 1 1 1 4 4 1 1 1 1 1 1 1 2 1 1 1 1000000000 Example Output 0: Yes No Yes Yes No Yes No No No Notes: In the first test case, you can erase $$$4, 5$$$, and write down $$$9$$$. In the second test case, you can't erase $$$3, 6$$$. In the third test case, one possible way could be: - Erase $$$2, 2$$$, and write down $$$4$$$. The remaining numbers are $$$1, 2, 4$$$ now. - Erase $$$1, 2$$$, and write down $$$3$$$. The remaining numbers are $$$3, 4$$$ now. In the fourth test case, one possible way could be: - Erase $$$1, 1$$$, and write down $$$2$$$. The remaining numbers are $$$2, 3, 3$$$ now. - Erase $$$2, 3$$$, and write down $$$5$$$. The remaining numbers are $$$3, 5$$$ now.
1