After a hard-working week Polycarp prefers to have fun. Polycarp's favorite entertainment is drawing snakes. He takes a rectangular checkered sheet of paper of size $$$n \times m$$$ (where $$$n$$$ is the number of rows, $$$m$$$ is the number of columns) and starts to draw snakes in cells.Polycarp draws snakes with lowercase Latin letters. He always draws the first snake with the symbol 'a', the second snake with the symbol 'b', the third snake with the symbol 'c' and so on. All snakes have their own unique symbol. There are only $$$26$$$ letters in the Latin alphabet, Polycarp is very tired and he doesn't want to invent new symbols, so the total number of drawn snakes doesn't exceed $$$26$$$.Since by the end of the week Polycarp is very tired, he draws snakes as straight lines without bends. So each snake is positioned either vertically or horizontally. Width of any snake equals $$$1$$$, i.e. each snake has size either $$$1 \times l$$$ or $$$l \times 1$$$, where $$$l$$$ is snake's length. Note that snakes can't bend.When Polycarp draws a new snake, he can use already occupied cells for drawing the snake. In this situation, he draws the snake "over the top" and overwrites the previous value in the cell.Recently when Polycarp was at work he found a checkered sheet of paper with Latin letters. He wants to know if it is possible to get this sheet of paper from an empty sheet by drawing some snakes according to the rules described above. If it is possible, he is interested in a way to draw snakes.

The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^5$$$) — the number of test cases to solve. Then $$$t$$$ test cases follow. The first line of the test case description contains two integers $$$n$$$, $$$m$$$ ($$$1 \le n,m \le 2000$$$) — length and width of the checkered sheet of paper respectively. Next $$$n$$$ lines of test case description contain $$$m$$$ symbols, which are responsible for the content of the corresponding cell on the sheet. It can be either lowercase Latin letter or symbol dot ('.'), which stands for an empty cell. It is guaranteed that the total area of all sheets in one test doesn't exceed $$$4\cdot10^6$$$.

Print the answer for each test case in the input. In the first line of the output for a test case print YES if it is possible to draw snakes, so that you can get a sheet of paper from the input. If it is impossible, print NO. If the answer to this question is positive, then print the way to draw snakes in the following format. In the next line print one integer $$$k$$$ ($$$0 \le k \le 26$$$) — number of snakes. Then print $$$k$$$ lines, in each line print four integers $$$r_{1,i}$$$, $$$c_{1,i}$$$, $$$r_{2,i}$$$ and $$$c_{2,i}$$$ — coordinates of extreme cells for the $$$i$$$-th snake ($$$1 \le r_{1,i}, r_{2,i} \le n$$$, $$$1 \le c_{1,i}, c_{2,i} \le m$$$). Snakes should be printed in order of their drawing. If there are multiple solutions, you are allowed to print any of them. Note that Polycarp starts drawing of snakes with an empty sheet of paper.


A sequence $$$a_1, a_2, \dots, a_k$$$ is called an arithmetic progression if for each $$$i$$$ from $$$1$$$ to $$$k$$$ elements satisfy the condition $$$a_i = a_1 + c \cdot (i - 1)$$$ for some fixed $$$c$$$.For example, these five sequences are arithmetic progressions: $$$[5, 7, 9, 11]$$$, $$$[101]$$$, $$$[101, 100, 99]$$$, $$$[13, 97]$$$ and $$$[5, 5, 5, 5, 5]$$$. And these four sequences aren't arithmetic progressions: $$$[3, 1, 2]$$$, $$$[1, 2, 4, 8]$$$, $$$[1, -1, 1, -1]$$$ and $$$[1, 2, 3, 3, 3]$$$.You are given a sequence of integers $$$b_1, b_2, \dots, b_n$$$. Find any index $$$j$$$ ($$$1 \le j \le n$$$), such that if you delete $$$b_j$$$ from the sequence, you can reorder the remaining $$$n-1$$$ elements, so that you will get an arithmetic progression. If there is no such index, output the number -1.

The first line of the input contains one integer $$$n$$$ ($$$2 \le n \le 2\cdot10^5$$$) — length of the sequence $$$b$$$. The second line contains $$$n$$$ integers $$$b_1, b_2, \dots, b_n$$$ ($$$-10^9 \le b_i \le 10^9$$$) — elements of the sequence $$$b$$$.

Print such index $$$j$$$ ($$$1 \le j \le n$$$), so that if you delete the $$$j$$$-th element from the sequence, you can reorder the remaining elements, so that you will get an arithmetic progression. If there are multiple solutions, you are allowed to print any of them. If there is no such index, print -1.

NoteNote to the first example. If you delete the $$$4$$$-th element, you can get the arithmetic progression $$$[2, 4, 6, 8]$$$.Note to the second example. The original sequence is already arithmetic progression, so you can delete $$$1$$$-st or last element and you will get an arithmetical progression again.


The only difference between easy and hard versions is constraints.Polycarp loves to listen to music, so he never leaves the player, even on the way home from the university. Polycarp overcomes the distance from the university to the house in exactly $$$T$$$ minutes.In the player, Polycarp stores $$$n$$$ songs, each of which is characterized by two parameters: $$$t_i$$$ and $$$g_i$$$, where $$$t_i$$$ is the length of the song in minutes ($$$1 \le t_i \le 15$$$), $$$g_i$$$ is its genre ($$$1 \le g_i \le 3$$$).Polycarp wants to create such a playlist so that he can listen to music all the time on the way from the university to his home, and at the time of his arrival home, the playlist is over. Polycarp never interrupts songs and always listens to them from beginning to end. Thus, if he started listening to the $$$i$$$-th song, he would spend exactly $$$t_i$$$ minutes on its listening. Polycarp also does not like when two songs of the same genre play in a row (i.e. successively/adjacently) or when the songs in his playlist are repeated.Help Polycarpus count the number of different sequences of songs (their order matters), the total duration is exactly $$$T$$$, such that there are no two consecutive songs of the same genre in them and all the songs in the playlist are different.

The first line of the input contains two integers $$$n$$$ and $$$T$$$ ($$$1 \le n \le 15, 1 \le T \le 225$$$) — the number of songs in the player and the required total duration, respectively. Next, the $$$n$$$ lines contain descriptions of songs: the $$$i$$$-th line contains two integers $$$t_i$$$ and $$$g_i$$$ ($$$1 \le t_i \le 15, 1 \le g_i \le 3$$$) — the duration of the $$$i$$$-th song and its genre, respectively.

Output one integer — the number of different sequences of songs, the total length of exactly $$$T$$$, such that there are no two consecutive songs of the same genre in them and all the songs in the playlist are different. Since the answer may be huge, output it modulo $$$10^9 + 7$$$ (that is, the remainder when dividing the quantity by $$$10^9 + 7$$$).

NoteIn the first example, Polycarp can make any of the $$$6$$$ possible playlist by rearranging the available songs: $$$[1, 2, 3]$$$, $$$[1, 3, 2]$$$, $$$[2, 1, 3]$$$, $$$[2, 3, 1]$$$, $$$[3, 1, 2]$$$ and $$$[3, 2, 1]$$$ (indices of the songs are given).In the second example, the first and second songs cannot go in succession (since they have the same genre). Thus, Polycarp can create a playlist in one of $$$2$$$ possible ways: $$$[1, 3, 2]$$$ and $$$[2, 3, 1]$$$ (indices of the songs are given).In the third example, Polycarp can make the following playlists: $$$[1, 2, 3]$$$, $$$[1, 3, 2]$$$, $$$[2, 1, 3]$$$, $$$[2, 3, 1]$$$, $$$[3, 1, 2]$$$, $$$[3, 2, 1]$$$, $$$[1, 4]$$$, $$$[4, 1]$$$, $$$[2, 3, 4]$$$ and $$$[4, 3, 2]$$$ (indices of the songs are given).


Vus the Cossack holds a programming competition, in which $$$n$$$ people participate. He decided to award them all with pens and notebooks. It is known that Vus has exactly $$$m$$$ pens and $$$k$$$ notebooks.Determine whether the Cossack can reward all participants, giving each of them at least one pen and at least one notebook.

The first line contains three integers $$$n$$$, $$$m$$$, and $$$k$$$ ($$$1 \leq n, m, k \leq 100$$$) — the number of participants, the number of pens, and the number of notebooks respectively.

Print "Yes" if it possible to reward all the participants. Otherwise, print "No". You can print each letter in any case (upper or lower).

NoteIn the first example, there are $$$5$$$ participants. The Cossack has $$$8$$$ pens and $$$6$$$ notebooks. Therefore, he has enough pens and notebooks.In the second example, there are $$$3$$$ participants. The Cossack has $$$9$$$ pens and $$$3$$$ notebooks. He has more than enough pens but only the minimum needed number of notebooks.In the third example, there are $$$8$$$ participants but only $$$5$$$ pens. Since the Cossack does not have enough pens, the answer is "No".


Vus the Cossack has two binary strings, that is, strings that consist only of "0" and "1". We call these strings $$$a$$$ and $$$b$$$. It is known that $$$|b| \leq |a|$$$, that is, the length of $$$b$$$ is at most the length of $$$a$$$.The Cossack considers every substring of length $$$|b|$$$ in string $$$a$$$. Let's call this substring $$$c$$$. He matches the corresponding characters in $$$b$$$ and $$$c$$$, after which he counts the number of positions where the two strings are different. We call this function $$$f(b, c)$$$.For example, let $$$b = 00110$$$, and $$$c = 11000$$$. In these strings, the first, second, third and fourth positions are different.Vus the Cossack counts the number of such substrings $$$c$$$ such that $$$f(b, c)$$$ is even.For example, let $$$a = 01100010$$$ and $$$b = 00110$$$. $$$a$$$ has four substrings of the length $$$|b|$$$: $$$01100$$$, $$$11000$$$, $$$10001$$$, $$$00010$$$.  $$$f(00110, 01100) = 2$$$; $$$f(00110, 11000) = 4$$$; $$$f(00110, 10001) = 4$$$; $$$f(00110, 00010) = 1$$$. Since in three substrings, $$$f(b, c)$$$ is even, the answer is $$$3$$$.Vus can not find the answer for big strings. That is why he is asking you to help him.

The first line contains a binary string $$$a$$$ ($$$1 \leq |a| \leq 10^6$$$) — the first string. The second line contains a binary string $$$b$$$ ($$$1 \leq |b| \leq |a|$$$) — the second string.

NoteThe first example is explained in the legend.In the second example, there are five substrings that satisfy us: $$$1010$$$, $$$0101$$$, $$$1111$$$, $$$1111$$$.


The only difference between easy and hard versions is constraints.Polycarp loves to listen to music, so he never leaves the player, even on the way home from the university. Polycarp overcomes the distance from the university to the house in exactly $$$T$$$ minutes.In the player, Polycarp stores $$$n$$$ songs, each of which is characterized by two parameters: $$$t_i$$$ and $$$g_i$$$, where $$$t_i$$$ is the length of the song in minutes ($$$1 \le t_i \le 50$$$), $$$g_i$$$ is its genre ($$$1 \le g_i \le 3$$$).Polycarp wants to create such a playlist so that he can listen to music all the time on the way from the university to his home, and at the time of his arrival home, the playlist is over. Polycarp never interrupts songs and always listens to them from beginning to end. Thus, if he started listening to the $$$i$$$-th song, he would spend exactly $$$t_i$$$ minutes on its listening. Polycarp also does not like when two songs of the same genre play in a row (i.e. successively/adjacently) or when the songs in his playlist are repeated.Help Polycarpus count the number of different sequences of songs (their order matters), the total duration is exactly $$$T$$$, such that there are no two consecutive songs of the same genre in them and all the songs in the playlist are different.

The first line of the input contains two integers $$$n$$$ and $$$T$$$ ($$$1 \le n \le 50, 1 \le T \le 2500$$$) — the number of songs in the player and the required total duration, respectively. Next, the $$$n$$$ lines contain descriptions of songs: the $$$i$$$-th line contains two integers $$$t_i$$$ and $$$g_i$$$ ($$$1 \le t_i \le 50, 1 \le g_i \le 3$$$) — the duration of the $$$i$$$-th song and its genre, respectively.


The only difference between easy and hard versions is constraints.If you write a solution in Python, then prefer to send it in PyPy to speed up execution time.A session has begun at Beland State University. Many students are taking exams.Polygraph Poligrafovich is going to examine a group of $$$n$$$ students. Students will take the exam one-by-one in order from $$$1$$$-th to $$$n$$$-th. Rules of the exam are following:  The $$$i$$$-th student randomly chooses a ticket.  if this ticket is too hard to the student, he doesn't answer and goes home immediately (this process is so fast that it's considered no time elapses). This student fails the exam.  if the student finds the ticket easy, he spends exactly $$$t_i$$$ minutes to pass the exam. After it, he immediately gets a mark and goes home. Students take the exam in the fixed order, one-by-one, without any interruption. At any moment of time, Polygraph Poligrafovich takes the answer from one student.The duration of the whole exam for all students is $$$M$$$ minutes ($$$\max t_i \le M$$$), so students at the end of the list have a greater possibility to run out of time to pass the exam.For each student $$$i$$$, you should count the minimum possible number of students who need to fail the exam so the $$$i$$$-th student has enough time to pass the exam.For each student $$$i$$$, find the answer independently. That is, if when finding the answer for the student $$$i_1$$$ some student $$$j$$$ should leave, then while finding the answer for $$$i_2$$$ ($$$i_2>i_1$$$) the student $$$j$$$ student does not have to go home.

The first line of the input contains two integers $$$n$$$ and $$$M$$$ ($$$1 \le n \le 2 \cdot 10^5$$$, $$$1 \le M \le 2 \cdot 10^7$$$) — the number of students and the total duration of the exam in minutes, respectively. The second line of the input contains $$$n$$$ integers $$$t_i$$$ ($$$1 \le t_i \le 100$$$) — time in minutes that $$$i$$$-th student spends to answer to a ticket. It's guaranteed that all values of $$$t_i$$$ are not greater than $$$M$$$.

Print $$$n$$$ numbers: the $$$i$$$-th number must be equal to the minimum number of students who have to leave the exam in order to $$$i$$$-th student has enough time to pass the exam.

NoteThe explanation for the example 1.Please note that the sum of the first five exam times does not exceed $$$M=15$$$ (the sum is $$$1+2+3+4+5=15$$$). Thus, the first five students can pass the exam even if all the students before them also pass the exam. In other words, the first five numbers in the answer are $$$0$$$.In order for the $$$6$$$-th student to pass the exam, it is necessary that at least $$$2$$$ students must fail it before (for example, the $$$3$$$-rd and $$$4$$$-th, then the $$$6$$$-th will finish its exam in $$$1+2+5+6=14$$$ minutes, which does not exceed $$$M$$$).In order for the $$$7$$$-th student to pass the exam, it is necessary that at least $$$3$$$ students must fail it before (for example, the $$$2$$$-nd, $$$5$$$-th and $$$6$$$-th, then the $$$7$$$-th will finish its exam in $$$1+3+4+7=15$$$ minutes, which does not exceed $$$M$$$).


Vus the Cossack has a field with dimensions $$$n \times m$$$, which consists of "0" and "1". He is building an infinite field from this field. He is doing this in this way: He takes the current field and finds a new inverted field. In other words, the new field will contain "1" only there, where "0" was in the current field, and "0" there, where "1" was. To the current field, he adds the inverted field to the right.  To the current field, he adds the inverted field to the bottom.  To the current field, he adds the current field to the bottom right.  He repeats it.For example, if the initial field was: $$$\begin{matrix} 1 & 0 & \\ 1 & 1 & \\ \end{matrix}$$$ After the first iteration, the field will be like this: $$$\begin{matrix} 1 & 0 & 0 & 1 \\ 1 & 1 & 0 & 0 \\ 0 & 1 & 1 & 0 \\ 0 & 0 & 1 & 1 \\ \end{matrix}$$$ After the second iteration, the field will be like this: $$$\begin{matrix} 1 & 0 & 0 & 1 & 0 & 1 & 1 & 0 \\ 1 & 1 & 0 & 0 & 0 & 0 & 1 & 1 \\ 0 & 1 & 1 & 0 & 1 & 0 & 0 & 1 \\ 0 & 0 & 1 & 1 & 1 & 1 & 0 & 0 \\ 0 & 1 & 1 & 0 & 1 & 0 & 0 & 1 \\ 0 & 0 & 1 & 1 & 1 & 1 & 0 & 0 \\ 1 & 0 & 0 & 1 & 0 & 1 & 1 & 0 \\ 1 & 1 & 0& 0 & 0 & 0 & 1 & 1 \\ \end{matrix}$$$ And so on...Let's numerate lines from top to bottom from $$$1$$$ to infinity, and columns from left to right from $$$1$$$ to infinity. We call the submatrix $$$(x_1, y_1, x_2, y_2)$$$ all numbers that have coordinates $$$(x, y)$$$ such that $$$x_1 \leq x \leq x_2$$$ and $$$y_1 \leq y \leq y_2$$$.The Cossack needs sometimes to find the sum of all the numbers in submatrices. Since he is pretty busy right now, he is asking you to find the answers!

The first line contains three integers $$$n$$$, $$$m$$$, $$$q$$$ ($$$1 \leq n, m \leq 1\,000$$$, $$$1 \leq q \leq 10^5$$$) — the dimensions of the initial matrix and the number of queries. Each of the next $$$n$$$ lines contains $$$m$$$ characters $$$c_{ij}$$$ ($$$0 \leq c_{ij} \leq 1$$$) — the characters in the matrix. Each of the next $$$q$$$ lines contains four integers $$$x_1$$$, $$$y_1$$$, $$$x_2$$$, $$$y_2$$$ ($$$1 \leq x_1 \leq x_2 \leq 10^9$$$, $$$1 \leq y_1 \leq y_2 \leq 10^9$$$) — the coordinates of the upper left cell and bottom right cell, between which you need to find the sum of all numbers.

NoteThe first example is explained in the legend.


Vus the Cossack has $$$n$$$ real numbers $$$a_i$$$. It is known that the sum of all numbers is equal to $$$0$$$. He wants to choose a sequence $$$b$$$ the size of which is $$$n$$$ such that the sum of all numbers is $$$0$$$ and each $$$b_i$$$ is either $$$\lfloor a_i \rfloor$$$ or $$$\lceil a_i \rceil$$$. In other words, $$$b_i$$$ equals $$$a_i$$$ rounded up or down. It is not necessary to round to the nearest integer.For example, if $$$a = [4.58413, 1.22491, -2.10517, -3.70387]$$$, then $$$b$$$ can be equal, for example, to $$$[4, 2, -2, -4]$$$. Note that if $$$a_i$$$ is an integer, then there is no difference between $$$\lfloor a_i \rfloor$$$ and $$$\lceil a_i \rceil$$$, $$$b_i$$$ will always be equal to $$$a_i$$$.Help Vus the Cossack find such sequence!

The first line contains one integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of numbers. Each of the next $$$n$$$ lines contains one real number $$$a_i$$$ ($$$|a_i| < 10^5$$$). It is guaranteed that each $$$a_i$$$ has exactly $$$5$$$ digits after the decimal point. It is guaranteed that the sum of all the numbers is equal to $$$0$$$.

In each of the next $$$n$$$ lines, print one integer $$$b_i$$$. For each $$$i$$$, $$$|a_i-b_i|<1$$$ must be met. If there are multiple answers, print any.

NoteThe first example is explained in the legend.In the second example, we can round the first and fifth numbers up, and the second and third numbers down. We can round the fourth number neither up, nor down.


Vus the Cossack has a simple graph with $$$n$$$ vertices and $$$m$$$ edges. Let $$$d_i$$$ be a degree of the $$$i$$$-th vertex. Recall that a degree of the $$$i$$$-th vertex is the number of conected edges to the $$$i$$$-th vertex.He needs to remain not more than $$$\lceil \frac{n+m}{2} \rceil$$$ edges. Let $$$f_i$$$ be the degree of the $$$i$$$-th vertex after removing. He needs to delete them in such way so that $$$\lceil \frac{d_i}{2} \rceil \leq f_i$$$ for each $$$i$$$. In other words, the degree of each vertex should not be reduced more than twice. Help Vus to remain the needed edges!

The first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \leq n \leq 10^6$$$, $$$0 \leq m \leq 10^6$$$) — the number of vertices and edges respectively. Each of the next $$$m$$$ lines contains two integers $$$u_i$$$ and $$$v_i$$$ ($$$1 \leq u_i, v_i \leq n$$$) — vertices between which there is an edge. It is guaranteed that the graph does not have loops and multiple edges. It is possible to show that the answer always exists.

In the first line, print one integer $$$k$$$ ($$$0 \leq k \leq \lceil \frac{n+m}{2} \rceil$$$) — the number of edges which you need to remain. In each of the next $$$k$$$ lines, print two integers $$$u_i$$$ and $$$v_i$$$ ($$$1 \leq u_i, v_i \leq n$$$) — the vertices, the edge between which, you need to remain. You can not print the same edge more than once.


Your favorite shop sells $$$n$$$ Kinder Surprise chocolate eggs. You know that exactly $$$s$$$ stickers and exactly $$$t$$$ toys are placed in $$$n$$$ eggs in total.Each Kinder Surprise can be one of three types:  it can contain a single sticker and no toy;  it can contain a single toy and no sticker;  it can contain both a single sticker and a single toy. But you don't know which type a particular Kinder Surprise has. All eggs look identical and indistinguishable from each other.What is the minimum number of Kinder Surprise Eggs you have to buy to be sure that, whichever types they are, you'll obtain at least one sticker and at least one toy?Note that you do not open the eggs in the purchasing process, that is, you just buy some number of eggs. It's guaranteed that the answer always exists.

The first line contains the single integer $$$T$$$ ($$$1 \le T \le 100$$$) — the number of queries. Next $$$T$$$ lines contain three integers $$$n$$$, $$$s$$$ and $$$t$$$ each ($$$1 \le n \le 10^9$$$, $$$1 \le s, t \le n$$$, $$$s + t \ge n$$$) — the number of eggs, stickers and toys. All queries are independent.

Print $$$T$$$ integers (one number per query) — the minimum number of Kinder Surprise Eggs you have to buy to be sure that, whichever types they are, you'll obtain at least one sticker and one toy

NoteIn the first query, we have to take at least $$$6$$$ eggs because there are $$$5$$$ eggs with only toy inside and, in the worst case, we'll buy all of them.In the second query, all eggs have both a sticker and a toy inside, that's why it's enough to buy only one egg.In the third query, we have to buy both eggs: one with a sticker and one with a toy.


You are given an array $$$a_1, a_2, \dots, a_n$$$ and an array $$$b_1, b_2, \dots, b_n$$$.For one operation you can sort in non-decreasing order any subarray $$$a[l \dots r]$$$ of the array $$$a$$$.For example, if $$$a = [4, 2, 2, 1, 3, 1]$$$ and you choose subbarray $$$a[2 \dots 5]$$$, then the array turns into $$$[4, 1, 2, 2, 3, 1]$$$. You are asked to determine whether it is possible to obtain the array $$$b$$$ by applying this operation any number of times (possibly zero) to the array $$$a$$$.

The first line contains one integer $$$t$$$ ($$$1 \le t \le 3 \cdot 10^5$$$) — the number of queries. The first line of each query contains one integer $$$n$$$ ($$$1 \le n \le 3 \cdot 10^5$$$). The second line of each query contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le n$$$). The third line of each query contains $$$n$$$ integers $$$b_1, b_2, \dots, b_n$$$ ($$$1 \le b_i \le n$$$). It is guaranteed that $$$\sum n \le 3 \cdot 10^5$$$ over all queries in a test.

For each query print YES (in any letter case) if it is possible to obtain an array $$$b$$$ and NO (in any letter case) otherwise.

NoteIn first test case the can sort subarray $$$a_1 \dots a_5$$$, then $$$a$$$ will turn into $$$[1, 1, 4, 4, 7, 5, 6]$$$, and then sort subarray $$$a_5 \dots a_6$$$.


The letters shop showcase is a string $$$s$$$, consisting of $$$n$$$ lowercase Latin letters. As the name tells, letters are sold in the shop.Letters are sold one by one from the leftmost to the rightmost. Any customer can only buy some prefix of letters from the string $$$s$$$.There are $$$m$$$ friends, the $$$i$$$-th of them is named $$$t_i$$$. Each of them is planning to estimate the following value: how many letters (the length of the shortest prefix) would s/he need to buy if s/he wanted to construct her/his name of bought letters. The name can be constructed if each letter is presented in the equal or greater amount.  For example, for $$$s$$$="arrayhead" and $$$t_i$$$="arya" $$$5$$$ letters have to be bought ("arrayhead").  For example, for $$$s$$$="arrayhead" and $$$t_i$$$="harry" $$$6$$$ letters have to be bought ("arrayhead").  For example, for $$$s$$$="arrayhead" and $$$t_i$$$="ray" $$$5$$$ letters have to be bought ("arrayhead").  For example, for $$$s$$$="arrayhead" and $$$t_i$$$="r" $$$2$$$ letters have to be bought ("arrayhead").  For example, for $$$s$$$="arrayhead" and $$$t_i$$$="areahydra" all $$$9$$$ letters have to be bought ("arrayhead"). It is guaranteed that every friend can construct her/his name using the letters from the string $$$s$$$.Note that the values for friends are independent, friends are only estimating them but not actually buying the letters.

The first line contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the length of showcase string $$$s$$$. The second line contains string $$$s$$$, consisting of exactly $$$n$$$ lowercase Latin letters. The third line contains one integer $$$m$$$ ($$$1 \le m \le 5 \cdot 10^4$$$) — the number of friends. The $$$i$$$-th of the next $$$m$$$ lines contains $$$t_i$$$ ($$$1 \le |t_i| \le 2 \cdot 10^5$$$) — the name of the $$$i$$$-th friend. It is guaranteed that $$$\sum \limits_{i=1}^m |t_i| \le 2 \cdot 10^5$$$.

For each friend print the length of the shortest prefix of letters from $$$s$$$ s/he would need to buy to be able to construct her/his name of them. The name can be constructed if each letter is presented in the equal or greater amount. It is guaranteed that every friend can construct her/his name using the letters from the string $$$s$$$.

9
arrayhead
5
arya
harry
ray
r
areahydra


Let $$$x$$$ be an array of integers $$$x = [x_1, x_2, \dots, x_n]$$$. Let's define $$$B(x)$$$ as a minimal size of a partition of $$$x$$$ into subsegments such that all elements in each subsegment are equal. For example, $$$B([3, 3, 6, 1, 6, 6, 6]) = 4$$$ using next partition: $$$[3, 3\ |\ 6\ |\ 1\ |\ 6, 6, 6]$$$.Now you don't have any exact values of $$$x$$$, but you know that $$$x_i$$$ can be any integer value from $$$[l_i, r_i]$$$ ($$$l_i \le r_i$$$) uniformly at random. All $$$x_i$$$ are independent.Calculate expected value of $$$(B(x))^2$$$, or $$$E((B(x))^2)$$$. It's guaranteed that the expected value can be represented as rational fraction $$$\frac{P}{Q}$$$ where $$$(P, Q) = 1$$$, so print the value $$$P \cdot Q^{-1} \mod 10^9 + 7$$$.

The first line contains the single integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the size of the array $$$x$$$. The second line contains $$$n$$$ integers $$$l_1, l_2, \dots, l_n$$$ ($$$1 \le l_i \le 10^9$$$). The third line contains $$$n$$$ integers $$$r_1, r_2, \dots, r_n$$$ ($$$l_i \le r_i \le 10^9$$$).

Print the single integer — $$$E((B(x))^2)$$$ as $$$P \cdot Q^{-1} \mod 10^9 + 7$$$.


Vasya has an array $$$a_1, a_2, \dots, a_n$$$.You don't know this array, but he told you $$$m$$$ facts about this array. The $$$i$$$-th fact is a triple of numbers $$$t_i$$$, $$$l_i$$$ and $$$r_i$$$ ($$$0 \le t_i \le 1, 1 \le l_i < r_i \le n$$$) and it means:  if $$$t_i=1$$$ then subbarray $$$a_{l_i}, a_{l_i + 1}, \dots, a_{r_i}$$$ is sorted in non-decreasing order;  if $$$t_i=0$$$ then subbarray $$$a_{l_i}, a_{l_i + 1}, \dots, a_{r_i}$$$ is not sorted in non-decreasing order. A subarray is not sorted if there is at least one pair of consecutive elements in this subarray such that the former is greater than the latter. For example if $$$a = [2, 1, 1, 3, 2]$$$ then he could give you three facts: $$$t_1=1, l_1=2, r_1=4$$$ (the subarray $$$[a_2, a_3, a_4] = [1, 1, 3]$$$ is sorted), $$$t_2=0, l_2=4, r_2=5$$$ (the subarray $$$[a_4, a_5] = [3, 2]$$$ is not sorted), and $$$t_3=0, l_3=3, r_3=5$$$ (the subarray $$$[a_3, a_5] = [1, 3, 2]$$$ is not sorted).You don't know the array $$$a$$$. Find any array which satisfies all the given facts.

The first line contains two integers $$$n$$$ and $$$m$$$ ($$$2 \le n \le 1000, 1 \le m \le 1000$$$). Each of the next $$$m$$$ lines contains three integers $$$t_i$$$, $$$l_i$$$ and $$$r_i$$$ ($$$0 \le t_i \le 1, 1 \le l_i < r_i \le n$$$). If $$$t_i = 1$$$ then subbarray $$$a_{l_i}, a_{l_i + 1}, \dots , a_{r_i}$$$ is sorted. Otherwise (if $$$t_i = 0$$$) subbarray $$$a_{l_i}, a_{l_i + 1}, \dots , a_{r_i}$$$ is not sorted.

If there is no array that satisfies these facts in only line print NO (in any letter case). If there is a solution, print YES (in any letter case). In second line print $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^9$$$) — the array $$$a$$$, satisfying all the given facts. If there are multiple satisfying arrays you can print any of them.


The leader of some very secretive organization has decided to invite all other members to a meeting. All members of the organization live in the same town which can be represented as $$$n$$$ crossroads connected by $$$m$$$ two-directional streets. The meeting will be held in the leader's house near the crossroad $$$1$$$. There are $$$k$$$ members of the organization invited to the meeting; $$$i$$$-th of them lives near the crossroad $$$a_i$$$. All members of the organization receive the message about the meeting at the same moment and start moving to the location where the meeting is held. In the beginning of each minute each person is located at some crossroad. He or she can either wait a minute at this crossroad, or spend a minute to walk from the current crossroad along some street to another crossroad (obviously, it is possible to start walking along the street only if it begins or ends at the current crossroad). In the beginning of the first minute each person is at the crossroad where he or she lives. As soon as a person reaches the crossroad number $$$1$$$, he or she immediately comes to the leader's house and attends the meeting.Obviously, the leader wants all other members of the organization to come up as early as possible. But, since the organization is very secretive, the leader does not want to attract much attention. Let's denote the discontent of the leader as follows  initially the discontent is $$$0$$$;  whenever a person reaches the crossroad number $$$1$$$, the discontent of the leader increases by $$$c \cdot x$$$, where $$$c$$$ is some fixed constant, and $$$x$$$ is the number of minutes it took the person to reach the crossroad number $$$1$$$;  whenever $$$x$$$ members of the organization walk along the same street at the same moment in the same direction, $$$dx^2$$$ is added to the discontent, where $$$d$$$ is some fixed constant. This is not cumulative: for example, if two persons are walking along the same street in the same direction at the same moment, then $$$4d$$$ is added to the discontent, not $$$5d$$$. Before sending a message about the meeting, the leader can tell each member of the organization which path they should choose and where they should wait. Help the leader to establish a plan for every member of the organization so they all reach the crossroad $$$1$$$, and the discontent is minimized.

The first line of the input contains five integer numbers $$$n$$$, $$$m$$$, $$$k$$$, $$$c$$$ and $$$d$$$ ($$$2 \le n \le 50$$$, $$$n - 1 \le m \le 50$$$, $$$1 \le k, c, d \le 50$$$) — the number of crossroads, the number of streets, the number of persons invited to the meeting and the constants affecting the discontent, respectively. The second line contains $$$k$$$ numbers $$$a_1$$$, $$$a_2$$$, ..., $$$a_k$$$ ($$$2 \le a_i \le n$$$) — the crossroads where the members of the organization live. Then $$$m$$$ lines follow, each denoting a bidirectional street. Each line contains two integers $$$x_i$$$ and $$$y_i$$$ ($$$1 \le x_i, y_i \le n$$$, $$$x_i \ne y_i$$$) denoting a street connecting crossroads $$$x_i$$$ and $$$y_i$$$. There may be multiple streets connecting the same pair of crossroads. It is guaranteed that every crossroad can be reached from every other crossroad using the given streets.

Print one integer: the minimum discontent of the leader after everyone reaches crossroad $$$1$$$.

NoteThe best course of action in the first test is the following:  the first person goes along the street $$$2$$$ to the crossroad $$$2$$$, then goes along the street $$$1$$$ to the crossroad $$$1$$$ and attends the meeting;  the second person waits one minute on the crossroad $$$3$$$, then goes along the street $$$2$$$ to the crossroad $$$2$$$, then goes along the street $$$1$$$ to the crossroad $$$1$$$ and attends the meeting;  the third person waits two minutes on the crossroad $$$3$$$, then goes along the street $$$2$$$ to the crossroad $$$2$$$, then goes along the street $$$1$$$ to the crossroad $$$1$$$ and attends the meeting;  the fourth person waits three minutes on the crossroad $$$3$$$, then goes along the street $$$2$$$ to the crossroad $$$2$$$, then goes along the street $$$1$$$ to the crossroad $$$1$$$ and attends the meeting.


You are given a tree (an undirected connected acyclic graph) consisting of $$$n$$$ vertices. You are playing a game on this tree.Initially all vertices are white. On the first turn of the game you choose one vertex and paint it black. Then on each turn you choose a white vertex adjacent (connected by an edge) to any black vertex and paint it black.Each time when you choose a vertex (even during the first turn), you gain the number of points equal to the size of the connected component consisting only of white vertices that contains the chosen vertex. The game ends when all vertices are painted black.Let's see the following example:Vertices $$$1$$$ and $$$4$$$ are painted black already. If you choose the vertex $$$2$$$, you will gain $$$4$$$ points for the connected component consisting of vertices $$$2, 3, 5$$$ and $$$6$$$. If you choose the vertex $$$9$$$, you will gain $$$3$$$ points for the connected component consisting of vertices $$$7, 8$$$ and $$$9$$$.Your task is to maximize the number of points you gain.

The first line contains an integer $$$n$$$ — the number of vertices in the tree ($$$2 \le n \le 2 \cdot 10^5$$$). Each of the next $$$n - 1$$$ lines describes an edge of the tree. Edge $$$i$$$ is denoted by two integers $$$u_i$$$ and $$$v_i$$$, the indices of vertices it connects ($$$1 \le u_i, v_i \le n$$$, $$$u_i \ne v_i$$$). It is guaranteed that the given edges form a tree.

Print one integer — the maximum number of points you gain if you will play optimally.

NoteThe first example tree is shown in the problem statement.


You are given $$$n$$$ numbers $$$a_1, a_2, \dots, a_n$$$. In one operation we can add to any one of those numbers a nonnegative integer power of $$$2$$$.What is the smallest number of operations we need to perform to make all $$$n$$$ numbers equal? It can be proved that under given constraints it doesn't exceed $$$10^{18}$$$.

The first line contains a single integer $$$n$$$ ($$$1 \le n \le 10^5$$$). The second line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$0 \le a_i \le 10^{17}$$$).

Output exactly one integer — the smallest number of operations we need to perform to make all $$$n$$$ numbers equal.

NoteIn the first example, all numbers are already equal. So the needed number of operation is $$$0$$$.In the second example, we can apply the operation $$$3$$$ times: add $$$8$$$ to first $$$2$$$, add $$$8$$$ to second $$$2$$$, add $$$2$$$ to $$$8$$$, making all numbers equal to $$$10$$$. It can be proved that we can't make all numbers equal in less than $$$3$$$ operations.


At Moscow Workshops ICPC team gets a balloon for each problem they solved first. Team MSU Red Panda got so many balloons that they didn't know how to spend them. So they came up with a problem with them.There are several balloons, not more than $$$10^6$$$ in total, each one is colored in one of $$$k$$$ colors. We can perform the following operation: choose $$$k-1$$$ balloons such that they are of $$$k-1$$$ different colors, and recolor them all into remaining color. We can perform this operation any finite number of times (for example, we can only perform the operation if there are at least $$$k-1$$$ different colors among current balls).How many different balloon configurations can we get? Only number of balloons of each color matters, configurations differing only by the order of balloons are counted as equal. As this number can be very large, output it modulo $$$998244353$$$.

The first line contains a single integer $$$k$$$ ($$$2 \le k \le 10^5$$$) —the number of colors. The second line contains $$$k$$$ integers $$$a_1, a_2, \ldots, a_k$$$ ($$$0 \le a_i$$$) —initial configuration of balloons. $$$a_i$$$ is number of balloons of color $$$i$$$. The total number of balloons doesn't exceed $$$10^6$$$. In other words, $$$a_1 + a_2 + a_3 + \ldots + a_k \le 10^6$$$.

Output number of possible configurations modulo $$$998244353$$$.

NoteIn the first example, there are $$$3$$$ configurations we can get: $$$[0, 1, 2]$$$, $$$[2, 0, 1]$$$, $$$[1, 2, 0]$$$.In the second example, we can apply the operation not more than once, and possible configurations are: $$$[1, 1, 1, 1]$$$, $$$[0, 0, 0, 4]$$$, $$$[0, 0, 4, 0]$$$, $$$[0, 4, 0, 0]$$$, $$$[4, 0, 0, 0]$$$. In the third example, we can't apply any operations, so the only achievable configuration is the starting one.


You are given a prime number $$$p$$$, $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$, and an integer $$$k$$$. Find the number of pairs of indexes $$$(i, j)$$$ ($$$1 \le i < j \le n$$$) for which $$$(a_i + a_j)(a_i^2 + a_j^2) \equiv k \bmod p$$$.

The first line contains integers $$$n, p, k$$$ ($$$2 \le n \le 3 \cdot 10^5$$$, $$$2 \le p \le 10^9$$$, $$$0 \le k \le p-1$$$). $$$p$$$ is guaranteed to be prime. The second line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$0 \le a_i \le p-1$$$). It is guaranteed that all elements are different.

Output a single integer — answer to the problem.


Note that this is the second problem of the two similar problems. You can hack this problem if you solve it. But you can hack the previous problem only if you solve both problems.You are given a tree with $$$n$$$ nodes. In the beginning, $$$0$$$ is written on all edges. In one operation, you can choose any $$$2$$$ distinct leaves $$$u$$$, $$$v$$$ and any integer number $$$x$$$ and add $$$x$$$ to values written on all edges on the simple path between $$$u$$$ and $$$v$$$. Note that in previous subtask $$$x$$$ was allowed to be any real, here it has to be integer.For example, on the picture below you can see the result of applying two operations to the graph: adding $$$2$$$ on the path from $$$7$$$ to $$$6$$$, and then adding $$$-1$$$ on the path from $$$4$$$ to $$$5$$$.   You are given some configuration of nonnegative integer pairwise different even numbers, written on the edges. For a given configuration determine if it is possible to achieve it with these operations, and, if it is possible, output the sequence of operations that leads to the given configuration. Constraints on the operations are listed in the output format section.Leave is a node of a tree of degree $$$1$$$. Simple path is a path that doesn't contain any node twice.

The first line contains a single integer $$$n$$$ ($$$2 \le n \le 1000$$$) — the number of nodes in a tree. Each of the next $$$n-1$$$ lines contains three integers $$$u$$$, $$$v$$$, $$$val$$$ ($$$1 \le u, v \le n$$$, $$$u \neq v$$$, $$$0 \le val \le 10\,000$$$), meaning that there is an edge between nodes $$$u$$$ and $$$v$$$ with $$$val$$$ written on it. It is guaranteed that these edges form a tree. It is guaranteed that all $$$val$$$ numbers are pairwise different and even.

If there aren't any sequences of operations which lead to the given configuration, output "NO". If it exists, output "YES" in the first line. In the second line output $$$m$$$ — number of operations you are going to apply ($$$0 \le m \le 10^5$$$). Note that you don't have to minimize the number of the operations! In the next $$$m$$$ lines output the operations in the following format: $$$u, v, x$$$ ($$$1 \le u, v \le n$$$, $$$u \not = v$$$, $$$x$$$ — integer, $$$-10^9 \le x \le 10^9$$$), where $$$u, v$$$ — leaves, $$$x$$$ — number we are adding.  It is guaranteed that if there exists a sequence of operations producing given configuration, then there exists a sequence of operations producing given configuration, satisfying all the conditions above.

NoteThe configuration from the first sample is drawn below, and it is impossible to achieve.  The sequence of operations from the second sample is illustrated below.


After playing Neo in the legendary "Matrix" trilogy, Keanu Reeves started doubting himself: maybe we really live in virtual reality? To find if this is true, he needs to solve the following problem.Let's call a string consisting of only zeroes and ones good if it contains different numbers of zeroes and ones. For example, 1, 101, 0000 are good, while 01, 1001, and 111000 are not good.We are given a string $$$s$$$ of length $$$n$$$ consisting of only zeroes and ones. We need to cut $$$s$$$ into minimal possible number of substrings $$$s_1, s_2, \ldots, s_k$$$ such that all of them are good. More formally, we have to find minimal by number of strings sequence of good strings $$$s_1, s_2, \ldots, s_k$$$ such that their concatenation (joining) equals $$$s$$$, i.e. $$$s_1 + s_2 + \dots + s_k = s$$$.For example, cuttings 110010 into 110 and 010 or into 11 and 0010 are valid, as 110, 010, 11, 0010 are all good, and we can't cut 110010 to the smaller number of substrings as 110010 isn't good itself. At the same time, cutting of 110010 into 1100 and 10 isn't valid as both strings aren't good. Also, cutting of 110010 into 1, 1, 0010 isn't valid, as it isn't minimal, even though all $$$3$$$ strings are good.Can you help Keanu? We can show that the solution always exists. If there are multiple optimal answers, print any.

The first line of the input contains a single integer $$$n$$$ ($$$1\le n \le 100$$$) — the length of the string $$$s$$$. The second line contains the string $$$s$$$ of length $$$n$$$ consisting only from zeros and ones.

In the first line, output a single integer $$$k$$$ ($$$1\le k$$$) — a minimal number of strings you have cut $$$s$$$ into. In the second line, output $$$k$$$ strings $$$s_1, s_2, \ldots, s_k$$$ separated with spaces. The length of each string has to be positive. Their concatenation has to be equal to $$$s$$$ and all of them have to be good. If there are multiple answers, print any.

NoteIn the first example, the string 1 wasn't cut at all. As it is good, the condition is satisfied.In the second example, 1 and 0 both are good. As 10 isn't good, the answer is indeed minimal.In the third example, 100 and 011 both are good. As 100011 isn't good, the answer is indeed minimal.


You are given $$$n$$$ numbers $$$a_1, a_2, \ldots, a_n$$$. Is it possible to arrange them in a circle in such a way that every number is strictly less than the sum of its neighbors?For example, for the array $$$[1, 4, 5, 6, 7, 8]$$$, the arrangement on the left is valid, while arrangement on the right is not, as $$$5\ge 4 + 1$$$ and $$$8> 1 + 6$$$.

The first line contains a single integer $$$n$$$ ($$$3\le n \le 10^5$$$) — the number of numbers. The second line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \leq a_i \le 10^9$$$) — the numbers. The given numbers are not necessarily distinct (i.e. duplicates are allowed).

If there is no solution, output "NO" in the first line.  If there is a solution, output "YES" in the first line. In the second line output $$$n$$$ numbers — elements of the array in the order they will stay in the circle. The first and the last element you output are considered neighbors in the circle. If there are multiple solutions, output any of them. You can print the circle starting with any element.

NoteOne of the possible arrangements is shown in the first example: $$$4< 2 + 3$$$;$$$2 < 4 + 3$$$;$$$3< 4 + 2$$$.One of the possible arrangements is shown in the second example.No matter how we arrange $$$13, 8, 5$$$ in a circle in the third example, $$$13$$$ will have $$$8$$$ and $$$5$$$ as neighbors, but $$$13\ge 8 + 5$$$. There is no solution in the fourth example.


Note that this is the first problem of the two similar problems. You can hack this problem only if you solve both problems.You are given a tree with $$$n$$$ nodes. In the beginning, $$$0$$$ is written on all edges. In one operation, you can choose any $$$2$$$ distinct leaves $$$u$$$, $$$v$$$ and any real number $$$x$$$ and add $$$x$$$ to values written on all edges on the simple path between $$$u$$$ and $$$v$$$.For example, on the picture below you can see the result of applying two operations to the graph: adding $$$2$$$ on the path from $$$7$$$ to $$$6$$$, and then adding $$$-0.5$$$ on the path from $$$4$$$ to $$$5$$$.   Is it true that for any configuration of real numbers written on edges, we can achieve it with a finite number of operations?Leaf is a node of a tree of degree $$$1$$$. Simple path is a path that doesn't contain any node twice.

The first line contains a single integer $$$n$$$ ($$$2 \le n \le 10^5$$$) — the number of nodes. Each of the next $$$n-1$$$ lines contains two integers $$$u$$$ and $$$v$$$ ($$$1 \le u, v \le n$$$, $$$u \neq v$$$), meaning that there is an edge between nodes $$$u$$$ and $$$v$$$. It is guaranteed that these edges form a tree.

If there is a configuration of real numbers written on edges of the tree that we can't achieve by performing the operations, output "NO".  Otherwise, output "YES".  You can print each letter in any case (upper or lower).

NoteIn the first example, we can add any real $$$x$$$ to the value written on the only edge $$$(1, 2)$$$.  In the second example, one of configurations that we can't reach is $$$0$$$ written on $$$(1, 2)$$$ and $$$1$$$ written on $$$(2, 3)$$$.  Below you can see graphs from examples $$$3$$$, $$$4$$$:


Consider a sequence of digits of length $$$2^k$$$ $$$[a_1, a_2, \ldots, a_{2^k}]$$$. We perform the following operation with it: replace pairs $$$(a_{2i+1}, a_{2i+2})$$$ with $$$(a_{2i+1} + a_{2i+2})\bmod 10$$$ for $$$0\le i<2^{k-1}$$$. For every $$$i$$$ where $$$a_{2i+1} + a_{2i+2}\ge 10$$$ we get a candy! As a result, we will get a sequence of length $$$2^{k-1}$$$.Less formally, we partition sequence of length $$$2^k$$$ into $$$2^{k-1}$$$ pairs, each consisting of 2 numbers: the first pair consists of the first and second numbers, the second of the third and fourth $$$\ldots$$$, the last pair consists of the ($$$2^k-1$$$)-th and ($$$2^k$$$)-th numbers. For every pair such that sum of numbers in it is at least $$$10$$$, we get a candy. After that, we replace every pair of numbers with a remainder of the division of their sum by $$$10$$$ (and don't change the order of the numbers).Perform this operation with a resulting array until it becomes of length $$$1$$$. Let $$$f([a_1, a_2, \ldots, a_{2^k}])$$$ denote the number of candies we get in this process. For example: if the starting sequence is $$$[8, 7, 3, 1, 7, 0, 9, 4]$$$ then:After the first operation the sequence becomes $$$[(8 + 7)\bmod 10, (3 + 1)\bmod 10, (7 + 0)\bmod 10, (9 + 4)\bmod 10]$$$ $$$=$$$ $$$[5, 4, 7, 3]$$$, and we get $$$2$$$ candies as $$$8 + 7 \ge 10$$$ and $$$9 + 4 \ge 10$$$.After the second operation the sequence becomes $$$[(5 + 4)\bmod 10, (7 + 3)\bmod 10]$$$ $$$=$$$ $$$[9, 0]$$$, and we get one more candy as $$$7 + 3 \ge 10$$$. After the final operation sequence becomes $$$[(9 + 0) \bmod 10]$$$ $$$=$$$ $$$[9]$$$. Therefore, $$$f([8, 7, 3, 1, 7, 0, 9, 4]) = 3$$$ as we got $$$3$$$ candies in total.You are given a sequence of digits of length $$$n$$$ $$$s_1, s_2, \ldots s_n$$$. You have to answer $$$q$$$ queries of the form $$$(l_i, r_i)$$$, where for $$$i$$$-th query you have to output $$$f([s_{l_i}, s_{l_i+1}, \ldots, s_{r_i}])$$$. It is guaranteed that $$$r_i-l_i+1$$$ is of form $$$2^k$$$ for some nonnegative integer $$$k$$$.

The first line contains a single integer $$$n$$$ ($$$1 \le n \le 10^5$$$) — the length of the sequence. The second line contains $$$n$$$ digits $$$s_1, s_2, \ldots, s_n$$$ ($$$0 \le s_i \le 9$$$). The third line contains a single integer $$$q$$$ ($$$1 \le q \le 10^5$$$) — the number of queries. Each of the next $$$q$$$ lines contains two integers $$$l_i$$$, $$$r_i$$$ ($$$1 \le l_i \le r_i \le n$$$) — $$$i$$$-th query. It is guaranteed that $$$r_i-l_i+1$$$ is a nonnegative integer power of $$$2$$$.

Output $$$q$$$ lines, in $$$i$$$-th line output single integer — $$$f([s_{l_i}, s_{l_i + 1}, \ldots, s_{r_i}])$$$, answer to the $$$i$$$-th query.

NoteThe first example illustrates an example from the statement.$$$f([7, 3, 1, 7]) = 1$$$: sequence of operations is $$$[7, 3, 1, 7] \to [(7 + 3)\bmod 10, (1 + 7)\bmod 10]$$$ $$$=$$$ $$$[0, 8]$$$ and one candy as $$$7 + 3 \ge 10$$$ $$$\to$$$ $$$[(0 + 8) \bmod 10]$$$ $$$=$$$ $$$[8]$$$, so we get only $$$1$$$ candy.$$$f([9]) = 0$$$ as we don't perform operations with it.


Let's call beauty of an array $$$b_1, b_2, \ldots, b_n$$$ ($$$n > 1$$$)  — $$$\min\limits_{1 \leq i < j \leq n} |b_i - b_j|$$$.You're given an array $$$a_1, a_2, \ldots a_n$$$ and a number $$$k$$$. Calculate the sum of beauty over all subsequences of the array of length exactly $$$k$$$. As this number can be very large, output it modulo $$$998244353$$$.A sequence $$$a$$$ is a subsequence of an array $$$b$$$ if $$$a$$$ can be obtained from $$$b$$$ by deletion of several (possibly, zero or all) elements.

The first line contains integers $$$n, k$$$ ($$$2 \le k \le n \le 1000$$$). The second line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$0 \le a_i \le 10^5$$$).

Output one integer — the sum of beauty over all subsequences of the array of length exactly $$$k$$$. As this number can be very large, output it modulo $$$998244353$$$.

NoteIn the first example, there are $$$4$$$ subsequences of length $$$3$$$ — $$$[1, 7, 3]$$$, $$$[1, 3, 5]$$$, $$$[7, 3, 5]$$$, $$$[1, 7, 5]$$$, each of which has beauty $$$2$$$, so answer is $$$8$$$.In the second example, there is only one subsequence of length $$$5$$$ — the whole array, which has the beauty equal to $$$|10-1| = 9$$$.


Tokitsukaze and CSL are playing a little game of stones.In the beginning, there are $$$n$$$ piles of stones, the $$$i$$$-th pile of which has $$$a_i$$$ stones. The two players take turns making moves. Tokitsukaze moves first. On each turn the player chooses a nonempty pile and removes exactly one stone from the pile. A player loses if all of the piles are empty before his turn, or if after removing the stone, two piles (possibly empty) contain the same number of stones. Supposing that both players play optimally, who will win the game?Consider an example: $$$n=3$$$ and sizes of piles are $$$a_1=2$$$, $$$a_2=3$$$, $$$a_3=0$$$. It is impossible to choose the empty pile, so Tokitsukaze has two choices: the first and the second piles. If she chooses the first pile then the state will be $$$[1, 3, 0]$$$ and it is a good move. But if she chooses the second pile then the state will be $$$[2, 2, 0]$$$ and she immediately loses. So the only good move for her is to choose the first pile. Supposing that both players always take their best moves and never make mistakes, who will win the game?Note that even if there are two piles with the same number of stones at the beginning, Tokitsukaze may still be able to make a valid first move. It is only necessary that there are no two piles with the same number of stones after she moves.

The first line contains a single integer $$$n$$$ ($$$1 \le n \le 10^5$$$) — the number of piles. The second line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$0 \le a_1, a_2, \ldots, a_n \le 10^9$$$), which mean the $$$i$$$-th pile has $$$a_i$$$ stones.

Print "sjfnb" (without quotes) if Tokitsukaze will win, or "cslnb" (without quotes) if CSL will win. Note the output characters are case-sensitive.

NoteIn the first example, Tokitsukaze cannot take any stone, so CSL will win.In the second example, Tokitsukaze can only take a stone from the first pile, and then, even though they have no stone, these two piles will have the same number of stones, which implies CSL will win.In the third example, Tokitsukaze will win. Here is one of the optimal ways:  Firstly, Tokitsukaze can choose the first pile and take a stone from that pile.  Then, CSL can only choose the first pile, because if he chooses the second pile, he will lose immediately.  Finally, Tokitsukaze can choose the second pile, and then CSL will have no choice but to lose. In the fourth example, they only have one good choice at any time, so Tokitsukaze can make the game lasting as long as possible and finally win.


"Duel!"Betting on the lovely princess Claris, the duel between Tokitsukaze and Quailty has started.There are $$$n$$$ cards in a row. Each card has two sides, one of which has color. At first, some of these cards are with color sides facing up and others are with color sides facing down. Then they take turns flipping cards, in which Tokitsukaze moves first. In each move, one should choose exactly $$$k$$$ consecutive cards and flip them to the same side, which means to make their color sides all face up or all face down. If all the color sides of these $$$n$$$ cards face the same direction after one's move, the one who takes this move will win.Princess Claris wants to know who will win the game if Tokitsukaze and Quailty are so clever that they won't make mistakes.

The first line contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le k \le n \le 10^5$$$). The second line contains a single string of length $$$n$$$ that only consists of $$$0$$$ and $$$1$$$, representing the situation of these $$$n$$$ cards, where the color side of the $$$i$$$-th card faces up if the $$$i$$$-th character is $$$1$$$, or otherwise, it faces down and the $$$i$$$-th character is $$$0$$$.

Print "once again" (without quotes) if the total number of their moves can exceed $$$10^9$$$, which is considered a draw. In other cases, print "tokitsukaze" (without quotes) if Tokitsukaze will win, or "quailty" (without quotes) if Quailty will win. Note that the output characters are case-sensitive, and any wrong spelling would be rejected.

NoteIn the first example, no matter how Tokitsukaze moves, there would be three cards with color sides facing the same direction after her move, and Quailty can flip the last card to this direction and win.In the second example, no matter how Tokitsukaze moves, Quailty can choose the same card and flip back to the initial situation, which can allow the game to end in a draw.In the third example, Tokitsukaze can win by flipping the leftmost five cards up or flipping the rightmost five cards down.The fourth example can be explained in the same way as the second example does.

quailty
once again
tokitsukaze
once again


There are $$$n$$$ points on the plane, the $$$i$$$-th of which is at $$$(x_i, y_i)$$$. Tokitsukaze wants to draw a strange rectangular area and pick all the points in the area.The strange area is enclosed by three lines, $$$x = l$$$, $$$y = a$$$ and $$$x = r$$$, as its left side, its bottom side and its right side respectively, where $$$l$$$, $$$r$$$ and $$$a$$$ can be any real numbers satisfying that $$$l < r$$$. The upper side of the area is boundless, which you can regard as a line parallel to the $$$x$$$-axis at infinity. The following figure shows a strange rectangular area.  A point $$$(x_i, y_i)$$$ is in the strange rectangular area if and only if $$$l < x_i < r$$$ and $$$y_i > a$$$. For example, in the above figure, $$$p_1$$$ is in the area while $$$p_2$$$ is not.Tokitsukaze wants to know how many different non-empty sets she can obtain by picking all the points in a strange rectangular area, where we think two sets are different if there exists at least one point in one set of them but not in the other.

The first line contains a single integer $$$n$$$ ($$$1 \leq n \leq 2 \times 10^5$$$) — the number of points on the plane. The $$$i$$$-th of the next $$$n$$$ lines contains two integers $$$x_i$$$, $$$y_i$$$ ($$$1 \leq x_i, y_i \leq 10^9$$$) — the coordinates of the $$$i$$$-th point. All points are distinct.

Print a single integer — the number of different non-empty sets of points she can obtain.

NoteFor the first example, there is exactly one set having $$$k$$$ points for $$$k = 1, 2, 3$$$, so the total number is $$$3$$$.For the second example, the numbers of sets having $$$k$$$ points for $$$k = 1, 2, 3$$$ are $$$3$$$, $$$2$$$, $$$1$$$ respectively, and their sum is $$$6$$$.For the third example, as the following figure shows, there are  $$$2$$$ sets having one point;  $$$3$$$ sets having two points;  $$$1$$$ set having four points. Therefore, the number of different non-empty sets in this example is $$$2 + 3 + 0 + 1 = 6$$$.


Tokitsukaze and her friends are trying to infiltrate a secret base built by Claris. However, Claris has been aware of that and set a bomb which is going to explode in a minute. Although they try to escape, they have no place to go after they find that the door has been locked.At this very moment, CJB, Father of Tokitsukaze comes. With his magical power given by Ereshkigal, the goddess of the underworld, CJB is able to set $$$m$$$ barriers to protect them from the explosion. Formally, let's build a Cartesian coordinate system on the plane and assume the bomb is at $$$O(0, 0)$$$. There are $$$n$$$ persons in Tokitsukaze's crew, the $$$i$$$-th one of whom is at $$$P_i(X_i, Y_i)$$$. Every barrier can be considered as a line with infinity length and they can intersect each other. For every person from Tokitsukaze's crew, there must be at least one barrier separating the bomb and him, which means the line between the bomb and him intersects with at least one barrier. In this definition, if there exists a person standing at the position of the bomb, any line through $$$O(0, 0)$$$ will satisfy the requirement.Although CJB is very powerful, he still wants his barriers to be as far from the bomb as possible, in order to conserve his energy. Please help him calculate the maximum distance between the bomb and the closest barrier while all of Tokitsukaze's crew are safe.

The first line contains two integers $$$n$$$, $$$m$$$ ($$$1 \leq n, m \leq 10^5$$$), indicating the number of people and the number of barriers respectively. The $$$i$$$-th line of the next $$$n$$$ lines contains two integers $$$X_i$$$, $$$Y_i$$$ ($$$-10^5 \leq X_i, Y_i \leq 10^5$$$), indicating the $$$i$$$-th person's location $$$P_i(X_i, Y_i)$$$. Note that $$$P_i$$$ may have the same coordinates as $$$P_j$$$ ($$$j \neq i$$$) or even $$$O$$$.

Print a single real number — the maximum distance meeting the requirement. Your answer is considered correct if its absolute or relative error does not exceed $$$10^{-6}$$$. Formally, let your answer be $$$a$$$, and the jury's answer be $$$b$$$. Your answer is accepted if and only if $$$\frac{|a - b|}{\max(1, |b|)} \leq 10^{-6}$$$.

NoteIn the first two examples, CJB must set the barrier crossing $$$O(0, 0)$$$.In the last two examples, CJB can set each barrier crossing some $$$P_i$$$ such that the barrier is perpendicular to the line between $$$P_i$$$ and $$$O$$$.


Recently, Tokitsukaze found an interesting game. Tokitsukaze had $$$n$$$ items at the beginning of this game. However, she thought there were too many items, so now she wants to discard $$$m$$$ ($$$1 \le m \le n$$$) special items of them.These $$$n$$$ items are marked with indices from $$$1$$$ to $$$n$$$. In the beginning, the item with index $$$i$$$ is placed on the $$$i$$$-th position. Items are divided into several pages orderly, such that each page contains exactly $$$k$$$ positions and the last positions on the last page may be left empty.Tokitsukaze would do the following operation: focus on the first special page that contains at least one special item, and at one time, Tokitsukaze would discard all special items on this page. After an item is discarded or moved, its old position would be empty, and then the item below it, if exists, would move up to this empty position. The movement may bring many items forward and even into previous pages, so Tokitsukaze would keep waiting until all the items stop moving, and then do the operation (i.e. check the special page and discard the special items) repeatedly until there is no item need to be discarded.    Consider the first example from the statement: $$$n=10$$$, $$$m=4$$$, $$$k=5$$$, $$$p=[3, 5, 7, 10]$$$. The are two pages. Initially, the first page is special (since it is the first page containing a special item). So Tokitsukaze discards the special items with indices $$$3$$$ and $$$5$$$. After, the first page remains to be special. It contains $$$[1, 2, 4, 6, 7]$$$, Tokitsukaze discards the special item with index $$$7$$$. After, the second page is special (since it is the first page containing a special item). It contains $$$[9, 10]$$$, Tokitsukaze discards the special item with index $$$10$$$. Tokitsukaze wants to know the number of operations she would do in total.

The first line contains three integers $$$n$$$, $$$m$$$ and $$$k$$$ ($$$1 \le n \le 10^{18}$$$, $$$1 \le m \le 10^5$$$, $$$1 \le m, k \le n$$$) — the number of items, the number of special items to be discarded and the number of positions in each page. The second line contains $$$m$$$ distinct integers $$$p_1, p_2, \ldots, p_m$$$ ($$$1 \le p_1 < p_2 < \ldots < p_m \le n$$$) — the indices of special items which should be discarded.

Print a single integer — the number of operations that Tokitsukaze would do in total.

NoteFor the first example:  In the first operation, Tokitsukaze would focus on the first page $$$[1, 2, 3, 4, 5]$$$ and discard items with indices $$$3$$$ and $$$5$$$;  In the second operation, Tokitsukaze would focus on the first page $$$[1, 2, 4, 6, 7]$$$ and discard item with index $$$7$$$;  In the third operation, Tokitsukaze would focus on the second page $$$[9, 10]$$$ and discard item with index $$$10$$$. For the second example, Tokitsukaze would focus on the second page $$$[6, 7, 8, 9, 10]$$$ and discard all special items at once.


Tokitsukaze is one of the characters in the game "Kantai Collection". In this game, every character has a common attribute — health points, shortened to HP.In general, different values of HP are grouped into $$$4$$$ categories:  Category $$$A$$$ if HP is in the form of $$$(4 n + 1)$$$, that is, when divided by $$$4$$$, the remainder is $$$1$$$;  Category $$$B$$$ if HP is in the form of $$$(4 n + 3)$$$, that is, when divided by $$$4$$$, the remainder is $$$3$$$;  Category $$$C$$$ if HP is in the form of $$$(4 n + 2)$$$, that is, when divided by $$$4$$$, the remainder is $$$2$$$;  Category $$$D$$$ if HP is in the form of $$$4 n$$$, that is, when divided by $$$4$$$, the remainder is $$$0$$$. The above-mentioned $$$n$$$ can be any integer.These $$$4$$$ categories ordered from highest to lowest as $$$A > B > C > D$$$, which means category $$$A$$$ is the highest and category $$$D$$$ is the lowest.While playing the game, players can increase the HP of the character. Now, Tokitsukaze wants you to increase her HP by at most $$$2$$$ (that is, either by $$$0$$$, $$$1$$$ or $$$2$$$). How much should she increase her HP so that it has the highest possible category?

The only line contains a single integer $$$x$$$ ($$$30 \leq x \leq 100$$$) — the value Tokitsukaze's HP currently.

Print an integer $$$a$$$ ($$$0 \leq a \leq 2$$$) and an uppercase letter $$$b$$$ ($$$b \in \lbrace A, B, C, D \rbrace$$$), representing that the best way is to increase her HP by $$$a$$$, and then the category becomes $$$b$$$. Note that the output characters are case-sensitive.

NoteFor the first example, the category of Tokitsukaze's HP is already $$$A$$$, so you don't need to enhance her ability.For the second example:  If you don't increase her HP, its value is still $$$98$$$, which equals to $$$(4 \times 24 + 2)$$$, and its category is $$$C$$$.  If you increase her HP by $$$1$$$, its value becomes $$$99$$$, which equals to $$$(4 \times 24 + 3)$$$, and its category becomes $$$B$$$.  If you increase her HP by $$$2$$$, its value becomes $$$100$$$, which equals to $$$(4 \times 25)$$$, and its category becomes $$$D$$$. Therefore, the best way is to increase her HP by $$$1$$$ so that the category of her HP becomes $$$B$$$.


Tokitsukaze is playing a game derivated from Japanese mahjong. In this game, she has three tiles in her hand. Each tile she owns is a suited tile, which means it has a suit (manzu, pinzu or souzu) and a number (a digit ranged from $$$1$$$ to $$$9$$$). In this problem, we use one digit and one lowercase letter, which is the first character of the suit, to represent a suited tile. All possible suited tiles are represented as 1m, 2m, $$$\ldots$$$, 9m, 1p, 2p, $$$\ldots$$$, 9p, 1s, 2s, $$$\ldots$$$, 9s.In order to win the game, she must have at least one mentsu (described below) in her hand, so sometimes she should draw extra suited tiles. After drawing a tile, the number of her tiles increases by one. She can draw any tiles she wants, including those already in her hand.Do you know the minimum number of extra suited tiles she needs to draw so that she can win?Here are some useful definitions in this game:  A mentsu, also known as meld, is formed by a koutsu or a shuntsu;  A koutsu, also known as triplet, is made of three identical tiles, such as [1m, 1m, 1m], however, [1m, 1p, 1s] or [1m, 4m, 7m] is NOT a koutsu;  A shuntsu, also known as sequence, is made of three sequential numbered tiles in the same suit, such as [1m, 2m, 3m] and [5s, 7s, 6s], however, [9m, 1m, 2m] or [1m, 2p, 3s] is NOT a shuntsu. Some examples:   [2m, 3p, 2s, 4m, 1s, 2s, 4s] — it contains no koutsu or shuntsu, so it includes no mentsu;  [4s, 3m, 3p, 4s, 5p, 4s, 5p] — it contains a koutsu, [4s, 4s, 4s], but no shuntsu, so it includes a mentsu;  [5p, 5s, 9m, 4p, 1s, 7p, 7m, 6p] — it contains no koutsu but a shuntsu, [5p, 4p, 6p] or [5p, 7p, 6p], so it includes a mentsu. Note that the order of tiles is unnecessary and you can assume the number of each type of suited tiles she can draw is infinite.

The only line contains three strings — the tiles in Tokitsukaze's hand. For each string, the first character is a digit ranged from $$$1$$$ to $$$9$$$ and the second character is m, p or s.

Print a single integer — the minimum number of extra suited tiles she needs to draw.

NoteIn the first example, Tokitsukaze already has a shuntsu.In the second example, Tokitsukaze already has a koutsu.In the third example, Tokitsukaze can get a shuntsu by drawing one suited tile — 1p or 4p. The resulting tiles will be [3p, 9m, 2p, 1p] or [3p, 9m, 2p, 4p].


We are going to build a new city: the Metropolis. The city is going to be built on an infinite square grid. The finished city will consist of $$$n$$$ skyscrapers, each occupying a different cell of the grid. At any moment during the construction, the cells that currently do not contain a skyscraper are called empty.You are given the planned coordinates of the $$$n$$$ skyscrapers. Your task is to find an order in which they can be built while satisfying the rules listed below.  The building crew has only one crane, so the Metropolis has to be constructed one skyscraper at a time.  The first skyscraper can be built anywhere on the grid.  Each subsequent skyscraper has to share a side or a corner with at least one of the previously built skyscrapers (so that it's easier to align the new skyscraper to the grid properly).  When building a skyscraper, there has to be a way to deliver material to the construction site from the outside of Metropolis by only moving it through empty cells that share a side. In other words, there should be a path of side-adjacent empty cells that connects the cell that will contain the skyscraper to some cell $$$(r,c)$$$ with $$$|r|>10^9$$$ and/or $$$|c|>10^9$$$. If a solution exists, let's denote the numbers of skyscrapers in the order in which they should be built by $$$s_1, \dots, s_n$$$. There are two types of subtasks:Type 1: You may produce any valid order.Type 2: You must find the order that maximizes $$$s_n$$$. Among those, you must find the one that maximizes $$$s_{n-1}$$$. And so on. In other words, you must find the valid order of building for which the sequence $$$(s_n,s_{n-1},\dots,s_1)$$$ is lexicographically largest.

The first line contains a single integer $$$n$$$ ($$$1 \le n \le 150,000$$$) – the number of skyscrapers. The second line contains a single integer $$$t$$$ ($$$1 \le t \le 2$$$) describing the type of the subtask as defined above. Then, $$$n$$$ lines follow. The $$$i$$$-th of these lines contains two space-separated integers $$$r_i$$$ and $$$c_i$$$ ($$$|r_i|, |c_i| \le 10^9$$$) denoting the coordinates of the cell containing skyscraper $$$i$$$. (The skyscrapers are not numbered in any particular order. The only reason why they have numbers is that they are used in the output format.) It is guaranteed that no two skyscrapers coincide.

If it is impossible to build the skyscrapers according to the given rules, print a single line containing the string "NO". Otherwise, print $$$n+1$$$ lines. The first of these lines should contain the string "YES". For each $$$i$$$, the $$$i$$$-th of the remaining $$$n$$$ lines should contain a single integer $$$s_i$$$. In subtasks with $$$t = 1$$$, if there are multiple valid orders, you may output any one of them.

NoteIn the first example, there are three skyscrapers in a row. All of them can always be reached from outside the Metropolis, and there are four build orders which preserve connectivity:   1, 2, 3  2, 1, 3  2, 3, 1  3, 2, 1 Since $$$t = 2$$$, we must choose the first option.In the second example, the only difference from the first example is that skyscraper 2 shares only corners with skyscrapers 1 and 3, the same set of orders as in the first sample is valid. Since $$$t = 1$$$, each of these answers is correct.In the third example, the Metropolis is disconnected. We obviously can't build that.


We have a magic tree: a rooted tree on $$$n$$$ vertices. The vertices are numbered $$$1$$$ through $$$n$$$. Vertex $$$1$$$ is the root.The magic tree gives us magic fruit. The fruit only grows in vertices of the tree other than the root. Each vertex contains at most one piece of fruit.It is now day 0 and no fruit is ripe yet. Each fruit will only be ripe for a single day. For each fruit, we are given the vertex $$$v_j$$$ where it grows, the day $$$d_j$$$ on which it will be ripe, and the amount $$$w_j$$$ of magic juice we can extract from it if we harvest it when it is ripe.The fruits have to be harvested by cutting some branches of the tree. On each day, you may cut as many branches of the tree as you like. The parts of the tree you cut off will fall to the ground and you can collect all the ripe fruits they contain. All fruits that fall to the ground when they are not ripe are discarded and no magic juice is collected from them.Formally, on each day, you may erase some edges of the tree. Whenever you do so, the tree will split into multiple connected components. You then erase all components that do not contain the root and you harvest all ripe fruits those components contained.Given is a description of the tree together with the locations, ripening days and juiciness of all $$$m$$$ fruits. Calculate the maximum total amount of magic juice we can harvest from the tree.

The first line contains three space-separated integers $$$n$$$ ($$$2 \le n \le 100,000$$$), $$$m$$$ ($$$1 \le m \le n-1$$$) and $$$k$$$ ($$$1 \le k \le 100,000$$$) – the number of vertices, the number of fruits, and the maximum day on which a fruit may become ripe. The following $$$n-1$$$ lines contain the integers $$$p_2, \dots, p_n$$$, one per line. For each $$$i$$$ (from $$$2$$$ to $$$n$$$, inclusive), vertex $$$p_i$$$ ($$$1 \leq p_i \le i-1$$$) is the parent of vertex $$$i$$$. Each of the last $$$m$$$ lines describes one fruit. The $$$j$$$-th of these lines has the form "$$$v_j\ d_j\ w_j$$$" ($$$2 \le v_j \le n$$$, $$$1 \le d_j \le k$$$, $$$1 \le w_j \le 10^9$$$). It is guaranteed that no vertex contains more than one fruit (i.e., the values $$$v_j$$$ are distinct).

Output a single line with a single integer, the maximum amount of magic juice we can harvest from the tree.

NoteIn the example input, one optimal solution looks as follows:   On day 4, cut the edge between vertices 4 and 5 and harvest a ripe fruit with 1 unit of magic juice. On the same day, cut the edge between vertices 1 and 2 and harvest 5 units of magic juice from the ripe fruit in vertex 3.  On day 7, do nothing. (We could harvest the fruit in vertex 4 that just became ripe, but doing so is not optimal.)  On day 9, cut the edge between vertices 1 and 4. Discard the fruit in vertex 4 that is no longer ripe, and harvest 3 units of magic juice from the ripe fruit in vertex 6. (Alternately, we could achieve the same effect by cutting the edge between vertices 4 and 6.)


You have been hired to supervise the project of a new amusement park. The park will have a special gimmick: directed slides that can get customers from one attraction to another quickly and in an entertaining way.The park owner has given you the current project: a list of planned attractions and a list of slides that should be built between them. However, him being a businessman, he casually envisioned the impossible: among other things, he projected a slide coming from the Haunted Castle to the Roller Coaster, another from the Roller Coaster to the Drop Tower, and a third from the Drop Tower to the Haunted Castle. As the slides can only go downhill, it is evident why this is a problem. You don't have the luxury of ignoring the laws of physics when building the park, so you have to request changes in the project. Maybe he would accept reversing the slide between the Drop Tower and the Haunted Castle?Formally:   The project is a list of attractions and a list of directed slides. Each slide starts at one attraction and ends at another attraction.  A proposal is obtained from the project by reversing the directions of some slides (possibly none or all of them).  A proposal is legal if there is a way to assign an elevation to each attraction in such a way that every slide goes downhill.  The cost of a proposal is the number of slides whose directions were reversed. For a given project, find and report the sum of costs all legal proposals. Since this number may be large, output it modulo $$$998,244,353$$$.

The first line contains two space-separated integers $$$n$$$, $$$m$$$ ($$$1 \leq n \leq 18$$$, $$$0 \leq m \leq n(n-1)/2$$$) – the number of attractions and the number of slides, respectively. The attractions are numbered $$$1$$$ through $$$n$$$. Then, $$$m$$$ lines follow. The $$$i$$$-th of these lines contains two space-separated integers $$$a_i$$$, $$$b_i$$$ ($$$1 \leq a_i, b_i \leq n$$$) denoting a slide from $$$a_i$$$ to $$$b_i$$$.  You may assume that:    There are no self-loops. (For each $$$i$$$: $$$a_i \neq b_i$$$.)  No slide appears twice. (For all $$$i \neq j$$$: $$$a_i \neq a_j$$$ or $$$b_i \neq b_j$$$.)  No pair of attractions is connected in both directions. (The unordered pairs $$$\{a_i, b_i\}$$$ are distinct.)

Output one line with a single integer, the sum of costs of all legal proposals modulo $$$998,244,353$$$.

NoteIn the first example, there are two proposals:   The slide direction is not flipped. This proposal has cost $$$0$$$.  The slide direction is flipped. This proposal has cost $$$1$$$.  As both proposals are valid, the answer is $$$0 + 1 = 1$$$.In the second example, there are eight proposals with the slide directions as follows:   $$$1 \rightarrow 2$$$, $$$2 \rightarrow 3$$$, $$$1 \rightarrow 3$$$ (cost $$$0$$$)  $$$1 \rightarrow 2$$$, $$$2 \rightarrow 3$$$, $$$3 \rightarrow 1$$$ (cost $$$1$$$)  $$$1 \rightarrow 2$$$, $$$3 \rightarrow 2$$$, $$$1 \rightarrow 3$$$ (cost $$$1$$$)  $$$1 \rightarrow 2$$$, $$$3 \rightarrow 2$$$, $$$3 \rightarrow 1$$$ (cost $$$2$$$)  $$$2 \rightarrow 1$$$, $$$2 \rightarrow 3$$$, $$$1 \rightarrow 3$$$ (cost $$$1$$$)  $$$2 \rightarrow 1$$$, $$$2 \rightarrow 3$$$, $$$3 \rightarrow 1$$$ (cost $$$2$$$)  $$$2 \rightarrow 1$$$, $$$3 \rightarrow 2$$$, $$$1 \rightarrow 3$$$ (cost $$$2$$$)  $$$2 \rightarrow 1$$$, $$$3 \rightarrow 2$$$, $$$3 \rightarrow 1$$$ (cost $$$3$$$) The second proposal is not legal, as there is a slide sequence $$$1 \rightarrow 2 \rightarrow 3 \rightarrow 1$$$. This means that the attraction $$$1$$$ has to be strictly higher than ifself, which is clearly impossible. Similarly, the seventh proposal is not legal. The answer is thus $$$0 + 1 + 2 + 1 + 2 + 3 = 9$$$.


A cubeword is a special type of a crossword. When building a cubeword, you start by choosing a positive integer $$$a$$$: the side length of the cube. Then, you build a big cube consisting of $$$a \times a \times a$$$ unit cubes. This big cube has 12 edges. Then, you discard all unit cubes that do not touch the edges of the big cube. The figure below shows the object you will get for $$$a=6$$$.  Finally, you assign a letter to each of the unit cubes in the object. You must get a meaningful word along each edge of the big cube. Each edge can be read in either direction, and it is sufficient if one of the two directions of reading gives a meaningful word.The figure below shows the object for $$$a=6$$$ in which some unit cubes already have assigned letters. You can already read the words 'SUBMIT', 'ACCEPT' and 'TURING' along three edges of the big cube.  You are given a list of valid words. Each word from the wordlist may appear on arbitrarily many edges of a valid cubeword. Find and report the number of different cubewords that can be constructed, modulo $$$998,244,353$$$.If one cubeword can be obtained from another by rotation or mirroring, they are considered distinct.

The first line contains a single integer $$$n$$$ ($$$1 \leq n \leq 100,000$$$) – the number of words. Then, $$$n$$$ lines follow. Each of these lines contains one word that can appear on the edges of the big cube. The length of each word is between 3 and 10, inclusive. It is guaranteed that all words are different.

Output a single integer, the number of distinct cubewords for the given list of valid words modulo $$$998,244,353$$$.

NoteIn the first sample, the only possibility is for the word "radar" to be on each edge of the cube.In the second sample, there are two cubes, which are just rotations of each other – the word "robot" is on every edge, and the difference between the two cubes is whether the lower left front corner contains 'r' or 't'.The third sample is similar to the second one. The fact that we can read the word on each edge in both directions does not affect the answer.In the fourth sample, there is one cube with the word "bob" on each edge. There are also $$$2^{12} = 4096$$$ cubes with the word "baobab" on each edge. (For each of the 12 edges, we have two possible directions in which the word "baobab" can appear.)


You are given a weighted undirected tree on $$$n$$$ vertices and a list of $$$q$$$ updates. Each update changes the weight of one edge. The task is to output the diameter of the tree after each update.(The distance between two vertices is the sum of the weights on the unique simple path that connects them. The diameter is the largest of all those distances.)

The first line contains three space-separated integers $$$n$$$, $$$q$$$ and $$$w$$$ ($$$2 \leq n \leq 100,000, 1 \leq q \leq 100,000$$$, $$$1 \leq w \leq 20,000,000,000,000$$$) – the number of vertices in the tree, the number of updates and the limit on the weights of edges. The vertices are numbered $$$1$$$ through $$$n$$$. Next, $$$n-1$$$ lines describing the initial tree follow. The $$$i$$$-th of these lines contains three space-separated integers $$$a_i$$$, $$$b_i$$$, $$$c_i$$$ ($$$1 \leq a_i, b_i \leq n$$$, $$$0 \leq c_i < w$$$) meaning that initially, there is an edge between vertices $$$a_i$$$ and $$$b_i$$$ with weight $$$c_i$$$. It is guaranteed that these $$$n-1$$$ lines describe a tree. Finally, $$$q$$$ lines describing queries follow. The $$$j$$$-th of these lines contains two space-separated integers $$$d_j$$$, $$$e_j$$$ ($$$0 \leq d_j < n - 1, 0 \leq e_j < w$$$). These two integers are then transformed according to the following scheme:    $$$d'_j = (d_j + last) \bmod (n - 1)$$$  $$$e'_j = (e_j + last) \bmod w$$$

Output $$$q$$$ lines. For each $$$i$$$, line $$$i$$$ should contain the diameter of the tree after the $$$i$$$-th update.

NoteThe first sample is depicted in the figure below. The left-most picture shows the initial state of the graph. Each following picture depicts the situation after an update. The weight of the updated edge is painted green, and the diameter is red.The first query changes the weight of the $$$3$$$rd edge, i.e. $$$\{2, 4\}$$$, to $$$1030$$$. The largest distance between any pair of vertices is $$$2030$$$ – the distance between $$$3$$$ and $$$4$$$.As the answer is $$$2030$$$, the second query is $$$$$$d'_2 = (1 + 2030) \bmod 3 = 0$$$$$$ $$$$$$e'_2 = (1020 + 2030) \bmod 2000 = 1050$$$$$$ Hence the weight of the edge $$$\{1, 2\}$$$ is changed to $$$1050$$$. This causes the pair $$$\{1, 4\}$$$ to be the pair with the greatest distance, namely $$$2080$$$.The third query is decoded as $$$$$$d'_3 = (1 + 2080) \bmod 3 = 2$$$$$$ $$$$$$e'_3 = (890 + 2080) \bmod 2000 = 970$$$$$$ As the weight of the edge $$$\{2, 4\}$$$ decreases to $$$970$$$, the most distant pair is suddenly $$$\{1, 3\}$$$ with $$$2050$$$.


You are given a piece of paper in the shape of a simple polygon $$$S$$$. Your task is to turn it into a simple polygon $$$T$$$ that has the same area as $$$S$$$.You can use two tools: scissors and tape. Scissors can be used to cut any polygon into smaller polygonal pieces. Tape can be used to combine smaller pieces into larger polygons. You can use each tool multiple times, in any order. The polygons given in the input have integer coordinates, but you are allowed to produce shapes with non-integer coordinates in your output.A formal definition of the task follows.A shape $$$Q=(Q_0,\dots,Q_{n-1})$$$ is a sequence of three or more points in the plane such that:   The closed polyline $$$Q_0Q_1Q_2\dots Q_{n-1}Q_0$$$ never touches or intersects itself, and therefore it forms the boundary of a simple polygon.  The polyline goes around the boundary of the polygon in the counter-clockwise direction. The polygon whose boundary is the shape $$$Q$$$ will be denoted $$$P(Q)$$$.Two shapes are called equivalent if one can be translated and/or rotated to become identical with the other.Note that mirroring a shape is not allowed. Also note that the order of points matters: the shape $$$(Q_1,\dots,Q_{n-1},Q_0)$$$ is not necessarily equivalent to the shape $$$(Q_0,\dots,Q_{n-1})$$$.In the figure on the left: Shapes $$$U$$$ and $$$V$$$ are equivalent. Shape $$$W$$$ is not equivalent with them because the points of $$$W$$$ are given in a different order. Regardless of the order of points, the fourth shape is not equivalent with the previous ones either as flipping a shape is not allowed.In both input and output, a shape with $$$n$$$ points is represented as a single line that contains $$$2n+1$$$ space-separated numbers: the number $$$n$$$ followed by the coordinates of the points: $$$Q_{0,x}$$$, $$$Q_{0,y}$$$, $$$Q_{1,x}$$$, ...Shapes have identification numbers (IDs). The given shape $$$S$$$ has ID 0, the shapes you produce in your solutions are given IDs 1, 2, 3, ..., in the order in which they are produced.Shapes $$$B_1,\dots,B_k$$$ form a subdivision of shape $$$A$$$ if:   The union of all $$$P(B_i)$$$ is exactly $$$P(A)$$$.  For each $$$i\neq j$$$, the area of the intersection of $$$P(B_i)$$$ and $$$P(B_j)$$$ is zero. The scissors operation destroys one existing shape $$$A$$$ and produces one or more shapes $$$B_1,\dots,B_k$$$ that form a subdivision of $$$A$$$.In the figure: Shape $$$A$$$ (square) subdivided into shapes $$$B_1$$$, $$$B_2$$$, $$$B_3$$$ (the three triangles). One valid way to describe one of the $$$B_i$$$ is "3 3 1 6 1 5.1 4".The tape operation destroys one or more existing shapes $$$A_1,\dots,A_k$$$ and produces one new shape $$$B$$$. In order to perform this operation, you must first specify shapes $$$C_1,\dots,C_k$$$ and only then the final shape $$$B$$$. These shapes must satisfy the following:   For each $$$i$$$, the shape $$$C_i$$$ is equivalent to the shape $$$A_i$$$.  The shapes $$$C_1,\dots,C_k$$$ form a subdivision of the shape $$$B$$$. Informally, you choose the shape $$$B$$$ and show how to move each of the existing $$$A_i$$$ to its correct location $$$C_i$$$ within $$$B$$$. Note that only the shape $$$B$$$ gets a new ID, the shapes $$$C_i$$$ do not.

The first line contains the source shape $$$S$$$. The second line contains the target shape $$$T$$$. Each shape has between 3 and 10 points, inclusive. Both shapes are given in the format specified above. All coordinates in the input are integers between $$$-10^6$$$ and $$$10^6$$$, inclusive. In each shape, no three points form an angle smaller than 3 degrees. (This includes non-consecutive points and implies that no three points are collinear.) The polygons $$$P(S)$$$ and $$$P(T)$$$ have the same area.

Whenever you use the scissors operation, output a block of lines of the form:  scissorsid(A) kB_1B_2...B_k where $$$id(A)$$$ is the ID of the shape you want to destroy, $$$k$$$ is the number of new shapes you want to produce, and $$$B_1,\dots,B_k$$$ are those shapes. Whenever you use the tape operation, output a block of lines of the form:  tapek id(A_1) ... id(A_k)C_1C_2...C_kB where $$$k$$$ is the number of shapes you want to tape together, $$$id(A_1),\dots,id(A_k)$$$ are their IDs, $$$C_1,\dots,C_k$$$ are equivalent shapes showing their position within $$$B$$$, and $$$B$$$ is the final shape obtained by taping them together. It is recommended to output coordinates of points to at least 10 decimal places. The output must satisfy the following:    All coordinates of points in the output must be between $$$-10^7$$$ and $$$10^7$$$, inclusive.  Each shape in the output must have at most $$$100$$$ points.  In each operation the number $$$k$$$ of shapes must be between $$$1$$$ and $$$100$$$, inclusive.  The number of operations must not exceed $$$2000$$$.  The total number of points in all shapes in the output must not exceed $$$20000$$$.  In the end, there must be exactly one shape (that hasn't been destroyed), and that shape must be equivalent to $$$T$$$.  All operations must be valid according to the checker. Solutions with small rounding errors will be accepted. (Internally, all comparisons check for absolute or relative error up to $$$10^{-3}$$$ when verifying each condition.)

NoteThe figure below shows the first example output. On the left is the original figure after using the scissors, on the right are the corresponding $$$C_i$$$ when we tape those pieces back together.In the second example output, note that it is sufficient if the final shape is equivalent to the target one, they do not have to be identical.The figure below shows three stages of the third example output. First, we cut the input rectangle into two smaller rectangles, then we cut the bigger of those two rectangles into two more. State after these cuts is shown in the top left part of the figure.Continuing, we tape the two new rectangles together to form a six-sided polygon, and then we cut that polygon into three 2-by-1 rectangles and one smaller rectangle. This is shown in the bottom left part of the figure.Finally, we take the rectangle we still have from the first step and the four new rectangles and we assemble them into the desired 3-by-3 square.


Tokitsukaze is playing a room escape game designed by SkywalkerT. In this game, she needs to find out hidden clues in the room to reveal a way to escape.After a while, she realizes that the only way to run away is to open the digital door lock since she accidentally went into a secret compartment and found some clues, which can be interpreted as:  Only when you enter $$$n$$$ possible different passwords can you open the door;  Passwords must be integers ranged from $$$0$$$ to $$$(m - 1)$$$;  A password cannot be $$$x$$$ ($$$0 \leq x < m$$$) if $$$x$$$ and $$$m$$$ are not coprime (i.e. $$$x$$$ and $$$m$$$ have some common divisor greater than $$$1$$$);  A password cannot be $$$x$$$ ($$$0 \leq x < m$$$) if there exist non-negative integers $$$e$$$ and $$$k$$$ such that $$$p^e = k m + x$$$, where $$$p$$$ is a secret integer;  Any integer that doesn't break the above rules can be a password;  Several integers are hidden in the room, but only one of them can be $$$p$$$. Fortunately, she finds that $$$n$$$ and $$$m$$$ are recorded in the lock. However, what makes Tokitsukaze frustrated is that she doesn't do well in math. Now that she has found an integer that is suspected to be $$$p$$$, she wants you to help her find out $$$n$$$ possible passwords, or determine the integer cannot be $$$p$$$.

The only line contains three integers $$$n$$$, $$$m$$$ and $$$p$$$ ($$$1 \leq n \leq 5 \times 10^5$$$, $$$1 \leq p < m \leq 10^{18}$$$). It is guaranteed that $$$m$$$ is a positive integer power of a single prime number.

If the number of possible different passwords is less than $$$n$$$, print a single integer $$$-1$$$. Otherwise, print $$$n$$$ distinct integers ranged from $$$0$$$ to $$$(m - 1)$$$ as passwords. You can print these integers in any order. Besides, if there are multiple solutions, print any.

NoteIn the first example, there is no possible password.In each of the last three examples, the given integer $$$n$$$ equals to the number of possible different passwords for the given integers $$$m$$$ and $$$p$$$, so if the order of numbers in the output is ignored, the solution is unique as shown above.


You have a list of numbers from $$$1$$$ to $$$n$$$ written from left to right on the blackboard.You perform an algorithm consisting of several steps (steps are $$$1$$$-indexed). On the $$$i$$$-th step you wipe the $$$i$$$-th number (considering only remaining numbers). You wipe the whole number (not one digit).  When there are less than $$$i$$$ numbers remaining, you stop your algorithm. Now you wonder: what is the value of the $$$x$$$-th remaining number after the algorithm is stopped?

The first line contains one integer $$$T$$$ ($$$1 \le T \le 100$$$) — the number of queries. The next $$$T$$$ lines contain queries — one per line. All queries are independent. Each line contains two space-separated integers $$$n$$$ and $$$x$$$ ($$$1 \le x < n \le 10^{9}$$$) — the length of the list and the position we wonder about. It's guaranteed that after the algorithm ends, the list will still contain at least $$$x$$$ numbers.

Print $$$T$$$ integers (one per query) — the values of the $$$x$$$-th number after performing the algorithm for the corresponding queries.


You are given a picture consisting of $$$n$$$ rows and $$$m$$$ columns. Rows are numbered from $$$1$$$ to $$$n$$$ from the top to the bottom, columns are numbered from $$$1$$$ to $$$m$$$ from the left to the right. Each cell is painted either black or white. You think that this picture is not interesting enough. You consider a picture to be interesting if there is at least one cross in it. A cross is represented by a pair of numbers $$$x$$$ and $$$y$$$, where $$$1 \le x \le n$$$ and $$$1 \le y \le m$$$, such that all cells in row $$$x$$$ and all cells in column $$$y$$$ are painted black.For examples, each of these pictures contain crosses:  The fourth picture contains 4 crosses: at $$$(1, 3)$$$, $$$(1, 5)$$$, $$$(3, 3)$$$ and $$$(3, 5)$$$.Following images don't contain crosses:  You have a brush and a can of black paint, so you can make this picture interesting. Each minute you may choose a white cell and paint it black.What is the minimum number of minutes you have to spend so the resulting picture contains at least one cross?You are also asked to answer multiple independent queries.

The first line contains an integer $$$q$$$ ($$$1 \le q \le 5 \cdot 10^4$$$) — the number of queries. The first line of each query contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 5 \cdot 10^4$$$, $$$n \cdot m \le 4 \cdot 10^5$$$) — the number of rows and the number of columns in the picture. Each of the next $$$n$$$ lines contains $$$m$$$ characters — '.' if the cell is painted white and '*' if the cell is painted black. It is guaranteed that $$$\sum n \le 5 \cdot 10^4$$$ and $$$\sum n \cdot m \le 4 \cdot 10^5$$$.

Print $$$q$$$ lines, the $$$i$$$-th line should contain a single integer — the answer to the $$$i$$$-th query, which is the minimum number of minutes you have to spend so the resulting picture contains at least one cross.

NoteThe example contains all the pictures from above in the same order.The first 5 pictures already contain a cross, thus you don't have to paint anything.You can paint $$$(1, 3)$$$, $$$(3, 1)$$$, $$$(5, 3)$$$ and $$$(3, 5)$$$ on the $$$6$$$-th picture to get a cross in $$$(3, 3)$$$. That'll take you $$$4$$$ minutes.You can paint $$$(1, 2)$$$ on the $$$7$$$-th picture to get a cross in $$$(4, 2)$$$.You can paint $$$(2, 2)$$$ on the $$$8$$$-th picture to get a cross in $$$(2, 2)$$$. You can, for example, paint $$$(1, 3)$$$, $$$(3, 1)$$$ and $$$(3, 3)$$$ to get a cross in $$$(3, 3)$$$ but that will take you $$$3$$$ minutes instead of $$$1$$$.There are 9 possible crosses you can get in minimum time on the $$$9$$$-th picture. One of them is in $$$(1, 1)$$$: paint $$$(1, 2)$$$ and $$$(2, 1)$$$.


There are $$$n$$$ segments drawn on a plane; the $$$i$$$-th segment connects two points ($$$x_{i, 1}$$$, $$$y_{i, 1}$$$) and ($$$x_{i, 2}$$$, $$$y_{i, 2}$$$). Each segment is non-degenerate, and is either horizontal or vertical — formally, for every $$$i \in [1, n]$$$ either $$$x_{i, 1} = x_{i, 2}$$$ or $$$y_{i, 1} = y_{i, 2}$$$ (but only one of these conditions holds). Only segments of different types may intersect: no pair of horizontal segments shares any common points, and no pair of vertical segments shares any common points.We say that four segments having indices $$$h_1$$$, $$$h_2$$$, $$$v_1$$$ and $$$v_2$$$ such that $$$h_1 < h_2$$$ and $$$v_1 < v_2$$$ form a rectangle if the following conditions hold:  segments $$$h_1$$$ and $$$h_2$$$ are horizontal;  segments $$$v_1$$$ and $$$v_2$$$ are vertical;  segment $$$h_1$$$ intersects with segment $$$v_1$$$;  segment $$$h_2$$$ intersects with segment $$$v_1$$$;  segment $$$h_1$$$ intersects with segment $$$v_2$$$;  segment $$$h_2$$$ intersects with segment $$$v_2$$$. Please calculate the number of ways to choose four segments so they form a rectangle. Note that the conditions $$$h_1 < h_2$$$ and $$$v_1 < v_2$$$ should hold.

The first line contains one integer $$$n$$$ ($$$1 \le n \le 5000$$$) — the number of segments. Then $$$n$$$ lines follow. The $$$i$$$-th line contains four integers $$$x_{i, 1}$$$, $$$y_{i, 1}$$$, $$$x_{i, 2}$$$ and $$$y_{i, 2}$$$ denoting the endpoints of the $$$i$$$-th segment. All coordinates of the endpoints are in the range $$$[-5000, 5000]$$$. It is guaranteed that each segment is non-degenerate and is either horizontal or vertical. Furthermore, if two segments share a common point, one of these segments is horizontal, and another one is vertical.

Print one integer — the number of ways to choose four segments so they form a rectangle.

NoteThe following pictures represent sample cases:


You are given three strings $$$s$$$, $$$t$$$ and $$$p$$$ consisting of lowercase Latin letters. You may perform any number (possibly, zero) operations on these strings.During each operation you choose any character from $$$p$$$, erase it from $$$p$$$ and insert it into string $$$s$$$ (you may insert this character anywhere you want: in the beginning of $$$s$$$, in the end or between any two consecutive characters). For example, if $$$p$$$ is aba, and $$$s$$$ is de, then the following outcomes are possible (the character we erase from $$$p$$$ and insert into $$$s$$$ is highlighted):  aba $$$\rightarrow$$$ ba, de $$$\rightarrow$$$ ade;  aba $$$\rightarrow$$$ ba, de $$$\rightarrow$$$ dae;  aba $$$\rightarrow$$$ ba, de $$$\rightarrow$$$ dea;  aba $$$\rightarrow$$$ aa, de $$$\rightarrow$$$ bde;  aba $$$\rightarrow$$$ aa, de $$$\rightarrow$$$ dbe;  aba $$$\rightarrow$$$ aa, de $$$\rightarrow$$$ deb;  aba $$$\rightarrow$$$ ab, de $$$\rightarrow$$$ ade;  aba $$$\rightarrow$$$ ab, de $$$\rightarrow$$$ dae;  aba $$$\rightarrow$$$ ab, de $$$\rightarrow$$$ dea; Your goal is to perform several (maybe zero) operations so that $$$s$$$ becomes equal to $$$t$$$. Please determine whether it is possible.Note that you have to answer $$$q$$$ independent queries.

The first line contains one integer $$$q$$$ ($$$1 \le q \le 100$$$) — the number of queries. Each query is represented by three consecutive lines. The first line of each query contains the string $$$s$$$ ($$$1 \le |s| \le 100$$$) consisting of lowercase Latin letters. The second line of each query contains the string $$$t$$$ ($$$1 \le |t| \le 100$$$) consisting of lowercase Latin letters. The third line of each query contains the string $$$p$$$ ($$$1 \le |p| \le 100$$$) consisting of lowercase Latin letters.

For each query print YES if it is possible to make $$$s$$$ equal to $$$t$$$, and NO otherwise. You may print every letter in any case you want (so, for example, the strings yEs, yes, Yes and YES will all be recognized as positive answer).

NoteIn the first test case there is the following sequence of operation:   $$$s = $$$ ab, $$$t = $$$ acxb, $$$p = $$$ cax;  $$$s = $$$ acb, $$$t = $$$ acxb, $$$p = $$$ ax;  $$$s = $$$ acxb, $$$t = $$$ acxb, $$$p = $$$ a. In the second test case there is the following sequence of operation:   $$$s = $$$ a, $$$t = $$$ aaaa, $$$p = $$$ aaabbcc;  $$$s = $$$ aa, $$$t = $$$ aaaa, $$$p = $$$ aabbcc;  $$$s = $$$ aaa, $$$t = $$$ aaaa, $$$p = $$$ abbcc;  $$$s = $$$ aaaa, $$$t = $$$ aaaa, $$$p = $$$ bbcc.

4
ab
acxb
cax
a
aaaa
aaabbcc
a
aaaa
aabbcc
ab
baaa
aaaaa


Let's call a fraction $$$\frac{x}{y}$$$ good if there exists at least one another fraction $$$\frac{x'}{y'}$$$ such that $$$\frac{x}{y} = \frac{x'}{y'}$$$, $$$1 \le x', y' \le 9$$$, the digit denoting $$$x'$$$ is contained in the decimal representation of $$$x$$$, and the digit denoting $$$y'$$$ is contained in the decimal representation of $$$y$$$. For example, $$$\frac{26}{13}$$$ is a good fraction, because $$$\frac{26}{13} = \frac{2}{1}$$$.You are given an integer number $$$n$$$. Please calculate the number of good fractions $$$\frac{x}{y}$$$ such that $$$1 \le x \le n$$$ and $$$1 \le y \le n$$$. The answer may be really large, so print it modulo $$$998244353$$$.

The only line of the input contains one integer $$$n$$$ ($$$1 \le n < 10^{100}$$$).

Print the number of good fractions $$$\frac{x}{y}$$$ such that $$$1 \le x \le n$$$ and $$$1 \le y \le n$$$. The answer may be really large, so print it modulo $$$998244353$$$.