Kurohashi has never participated in AtCoder Beginner Contest (ABC).
The next ABC to be held is ABC N (the N-th ABC ever held).
Kurohashi wants to make his debut in some ABC x such that all the digits of x in base ten are the same.
What is the earliest ABC where Kurohashi can make his debut?

-----Constraints-----
 - 100 \leq N \leq 999
 - N is an integer.

-----Input-----
Input is given from Standard Input in the following format:
N

-----Output-----
If the earliest ABC where Kurohashi can make his debut is ABC n, print n.

-----Sample Input-----
111

-----Sample Output-----
111

The next ABC to be held is ABC 111, where Kurohashi can make his debut.


You have three tasks, all of which need to be completed.
First, you can complete any one task at cost 0.
Then, just after completing the i-th task, you can complete the j-th task at cost |A_j - A_i|.
Here, |x| denotes the absolute value of x.
Find the minimum total cost required to complete all the task.

-----Constraints-----
 - All values in input are integers.
 - 1 \leq A_1, A_2, A_3 \leq 100

-----Input-----
Input is given from Standard Input in the following format:
A_1 A_2 A_3

-----Output-----
Print the minimum total cost required to complete all the task.

-----Sample Input-----
1 6 3

-----Sample Output-----
5

When the tasks are completed in the following order, the total cost will be 5, which is the minimum:
 - Complete the first task at cost 0.
 - Complete the third task at cost 2.
 - Complete the second task at cost 3.


A sequence a=\{a_1,a_2,a_3,......\} is determined as follows:
 - The first term s is given as input.
 - Let f(n) be the following function: f(n) = n/2 if n is even, and f(n) = 3n+1 if n is odd.
 - a_i = s when i = 1, and a_i = f(a_{i-1}) when i > 1.
Find the minimum integer m that satisfies the following condition:
 - There exists an integer n such that a_m = a_n (m > n).

-----Constraints-----
 - 1 \leq s \leq 100
 - All values in input are integers.
 - It is guaranteed that all elements in a and the minimum m that satisfies the condition are at most 1000000.

-----Input-----
Input is given from Standard Input in the following format:
s

-----Output-----
Print the minimum integer m that satisfies the condition.

-----Sample Input-----
8

-----Sample Output-----
5

a=\{8,4,2,1,4,2,1,4,2,1,......\}. As a_5=a_2, the answer is 5.


Takahashi and Aoki will have a battle using their monsters.
The health and strength of Takahashi's monster are A and B, respectively, and those of Aoki's monster are C and D, respectively.
The two monsters will take turns attacking, in the order Takahashi's, Aoki's, Takahashi's, Aoki's, ...
Here, an attack decreases the opponent's health by the value equal to the attacker's strength.
The monsters keep attacking until the health of one monster becomes 0 or below. The person with the monster whose health becomes 0 or below loses, and the other person wins.
If Takahashi will win, print Yes; if he will lose, print No.

-----Constraints-----
 - 1 \leq A,B,C,D \leq 100
 - All values in input are integers.

-----Input-----
Input is given from Standard Input in the following format:
A B C D

-----Output-----
If Takahashi will win, print Yes; if he will lose, print No.

-----Sample Input-----
10 9 10 10

-----Sample Output-----
No

First, Takahashi's monster attacks Aoki's monster, whose health is now 10-9=1.
Next, Aoki's monster attacks Takahashi's monster, whose health is now 10-10=0.
Takahashi's monster is the first to have 0 or less health, so Takahashi loses.


There are N gems. The value of the i-th gem is V_i.
You will choose some of these gems, possibly all or none, and get them.
However, you need to pay a cost of C_i to get the i-th gem.
Let X be the sum of the values of the gems obtained, and Y be the sum of the costs paid.
Find the maximum possible value of X-Y.

-----Constraints-----
 - All values in input are integers.
 - 1 \leq N \leq 20
 - 1 \leq C_i, V_i \leq 50

-----Input-----
Input is given from Standard Input in the following format:
N
V_1 V_2 ... V_N
C_1 C_2 ... C_N

-----Output-----
Print the maximum possible value of X-Y.

-----Sample Input-----
3
10 2 5
6 3 4

-----Sample Output-----
5

If we choose the first and third gems, X = 10 + 5 = 15 and Y = 6 + 4 = 10.
We have X-Y = 5 here, which is the maximum possible value.


There is a grid of squares with H horizontal rows and W vertical columns.
The square at the i-th row from the top and the j-th column from the left is represented as (i, j).
Each square is black or white.
The color of the square is given as an H-by-W matrix (a_{i, j}).
If a_{i, j} is ., the square (i, j) is white; if a_{i, j} is #, the square (i, j) is black.
Snuke is compressing this grid.
He will do so by repeatedly performing the following operation while there is a row or column that consists only of white squares:
 - Operation: choose any one row or column that consists only of white squares, remove it and delete the space between the rows or columns.
It can be shown that the final state of the grid is uniquely determined regardless of what row or column is chosen in each operation.
Find the final state of the grid.

-----Constraints-----
 - 1 \leq H, W \leq 100
 - a_{i, j} is . or #.
 - There is at least one black square in the whole grid.

-----Input-----
Input is given from Standard Input in the following format:
H W
a_{1, 1}...a_{1, W}
:
a_{H, 1}...a_{H, W}

-----Output-----
Print the final state of the grid in the same format as input (without the numbers of rows and columns); see the samples for clarity.

-----Sample Input-----
4 4
##.#
....
##.#
.#.#

-----Sample Output-----
###
###
.##

The second row and the third column in the original grid will be removed.


Print the circumference of a circle of radius R.

-----Constraints-----
 - 1 \leq R \leq 100
 - All values in input are integers.

-----Input-----
Input is given from Standard Input in the following format:
R

-----Output-----
Print the circumference of the circle.
Your output is considered correct if and only if its absolute or relative error from our answer is at most 10^{-2}.

-----Sample Input-----
1

-----Sample Output-----
6.28318530717958623200

Since we accept an absolute or relative error of at most 10^{-2}, 6.28 is also an acceptable output, but 6 is not.


You are given a 4-character string S consisting of uppercase English letters.
Determine if S consists of exactly two kinds of characters which both appear twice in S.

-----Constraints-----
 - The length of S is 4.
 - S consists of uppercase English letters.

-----Input-----
Input is given from Standard Input in the following format:
S

-----Output-----
If S consists of exactly two kinds of characters which both appear twice in S, print Yes; otherwise, print No.

-----Sample Input-----
ASSA

-----Sample Output-----
Yes

S consists of A and S which both appear twice in S.


We have two integers: A and B.
Print the largest number among A + B, A - B, and A \times B.

-----Constraints-----
 - All values in input are integers.
 - -100 \leq A,\ B \leq 100

-----Input-----
Input is given from Standard Input in the following format:
A B

-----Output-----
Print the largest number among A + B, A - B, and A \times B.

-----Sample Input-----
-13 3

-----Sample Output-----
-10

The largest number among A + B = -10, A - B = -16, and A \times B = -39 is -10.


There are N mountains ranging from east to west, and an ocean to the west.
At the top of each mountain, there is an inn. You have decided to choose where to stay from these inns.
The height of the i-th mountain from the west is H_i.
You can certainly see the ocean from the inn at the top of the westmost mountain.
For the inn at the top of the i-th mountain from the west (i = 2, 3, ..., N), you can see the ocean if and only if H_1 \leq H_i, H_2 \leq H_i, ..., and H_{i-1} \leq H_i.
From how many of these N inns can you see the ocean?

-----Constraints-----
 - All values in input are integers.
 - 1 \leq N \leq 20
 - 1 \leq H_i \leq 100

-----Input-----
Input is given from Standard Input in the following format:
N
H_1 H_2 ... H_N

-----Output-----
Print the number of inns from which you can see the ocean.

-----Sample Input-----
4
6 5 6 8

-----Sample Output-----
3

You can see the ocean from the first, third and fourth inns from the west.


Little girl Tanya climbs the stairs inside a multi-storey building. Every time Tanya climbs a stairway, she starts counting steps from $1$ to the number of steps in this stairway. She speaks every number aloud. For example, if she climbs two stairways, the first of which contains $3$ steps, and the second contains $4$ steps, she will pronounce the numbers $1, 2, 3, 1, 2, 3, 4$.

You are given all the numbers pronounced by Tanya. How many stairways did she climb? Also, output the number of steps in each stairway.

The given sequence will be a valid sequence that Tanya could have pronounced when climbing one or more stairways.

-----Input-----

The first line contains $n$ ($1 \le n \le 1000$) — the total number of numbers pronounced by Tanya.

The second line contains integers $a_1, a_2, \dots, a_n$ ($1 \le a_i \le 1000$) — all the numbers Tanya pronounced while climbing the stairs, in order from the first to the last pronounced number. Passing a stairway with $x$ steps, she will pronounce the numbers $1, 2, \dots, x$ in that order.

The given sequence will be a valid sequence that Tanya could have pronounced when climbing one or more stairways.

-----Output-----

In the first line, output $t$ — the number of stairways that Tanya climbed. In the second line, output $t$ numbers — the number of steps in each stairway she climbed. Write the numbers in the correct order of passage of the stairways.

-----Examples-----
Input
7
1 2 3 1 2 3 4

Output
2
3 4
Input
4
1 1 1 1

Output
4
1 1 1 1
Input
5
1 2 3 4 5

Output
1
5
Input
5
1 2 1 2 1

Output
3
2 2 1


Recently Vova found $n$ candy wrappers. He remembers that he bought $x$ candies during the first day, $2x$ candies during the second day, $4x$ candies during the third day, $\dots$, $2^{k-1} x$ candies during the $k$-th day. But there is an issue: Vova remembers neither $x$ nor $k$ but he is sure that $x$ and $k$ are positive integers and $k > 1$.

Vova will be satisfied if you tell him any positive integer $x$ so there is an integer $k>1$ that $x + 2x + 4x + \dots + 2^{k-1} x = n$. It is guaranteed that at least one solution exists. Note that $k > 1$.

You have to answer $t$ independent test cases.

-----Input-----

The first line of the input contains one integer $t$ ($1 \le t \le 10^4$) — the number of test cases. Then $t$ test cases follow.

The only line of the test case contains one integer $n$ ($3 \le n \le 10^9$) — the number of candy wrappers Vova found. It is guaranteed that there is some positive integer $x$ and integer $k>1$ that $x + 2x + 4x + \dots + 2^{k-1} x = n$.

-----Output-----

Print one integer — any positive integer value of $x$ so there is an integer $k>1$ that $x + 2x + 4x + \dots + 2^{k-1} x = n$.

-----Example-----
Input
7
3
6
7
21
28
999999999
999999984

Output
1
2
1
7
4
333333333
333333328

-----Note-----

In the first test case of the example, one of the possible answers is $x=1, k=2$. Then $1 \cdot 1 + 2 \cdot 1$ equals $n=3$.

In the second test case of the example, one of the possible answers is $x=2, k=2$. Then $1 \cdot 2 + 2 \cdot 2$ equals $n=6$.

In the third test case of the example, one of the possible answers is $x=1, k=3$. Then $1 \cdot 1 + 2 \cdot 1 + 4 \cdot 1$ equals $n=7$.

In the fourth test case of the example, one of the possible answers is $x=7, k=2$. Then $1 \cdot 7 + 2 \cdot 7$ equals $n=21$.

In the fifth test case of the example, one of the possible answers is $x=4, k=3$. Then $1 \cdot 4 + 2 \cdot 4 + 4 \cdot 4$ equals $n=28$.


Little girl Tanya is learning how to decrease a number by one, but she does it wrong with a number consisting of two or more digits. Tanya subtracts one from a number by the following algorithm:  if the last digit of the number is non-zero, she decreases the number by one;  if the last digit of the number is zero, she divides the number by 10 (i.e. removes the last digit).

You are given an integer number $n$. Tanya will subtract one from it $k$ times. Your task is to print the result after all $k$ subtractions.

It is guaranteed that the result will be positive integer number.

-----Input-----

The first line of the input contains two integer numbers $n$ and $k$ ($2 \le n \le 10^9$, $1 \le k \le 50$) — the number from which Tanya will subtract and the number of subtractions correspondingly.

-----Output-----

Print one integer number — the result of the decreasing $n$ by one $k$ times.

It is guaranteed that the result will be positive integer number.

-----Examples-----
Input
512 4

Output
50

Input
1000000000 9

Output
1

-----Note-----

The first example corresponds to the following sequence: $512 \rightarrow 511 \rightarrow 510 \rightarrow 51 \rightarrow 50$.


There are $n$ people in a row. The height of the $i$-th person is $a_i$. You can choose any subset of these people and try to arrange them into a balanced circle.

A balanced circle is such an order of people that the difference between heights of any adjacent people is no more than $1$. For example, let heights of chosen people be $[a_{i_1}, a_{i_2}, \dots, a_{i_k}]$, where $k$ is the number of people you choose. Then the condition $|a_{i_j} - a_{i_{j + 1}}| \le 1$ should be satisfied for all $j$ from $1$ to $k-1$ and the condition $|a_{i_1} - a_{i_k}| \le 1$ should be also satisfied. $|x|$ means the absolute value of $x$. It is obvious that the circle consisting of one person is balanced.

Your task is to choose the maximum number of people and construct a balanced circle consisting of all chosen people. It is obvious that the circle consisting of one person is balanced so the answer always exists.

-----Input-----

The first line of the input contains one integer $n$ ($1 \le n \le 2 \cdot 10^5$) — the number of people.

The second line of the input contains $n$ integers $a_1, a_2, \dots, a_n$ ($1 \le a_i \le 2 \cdot 10^5$), where $a_i$ is the height of the $i$-th person.

-----Output-----

In the first line of the output print $k$ — the number of people in the maximum balanced circle.

In the second line print $k$ integers $res_1, res_2, \dots, res_k$, where $res_j$ is the height of the $j$-th person in the maximum balanced circle. The condition $|res_{j} - res_{j + 1}| \le 1$ should be satisfied for all $j$ from $1$ to $k-1$ and the condition $|res_{1} - res_{k}| \le 1$ should be also satisfied.

-----Examples-----
Input
7
4 3 5 1 2 2 1

Output
5
2 1 1 2 3

Input
5
3 7 5 1 5

Output
2
5 5

Input
3
5 1 4

Output
2
4 5

Input
7
2 2 3 2 1 2 2

Output
7
1 2 2 2 2 3 2


Ivan has $n$ songs on his phone. The size of the $i$-th song is $a_i$ bytes. Ivan also has a flash drive which can hold at most $m$ bytes in total. Initially, his flash drive is empty.

Ivan wants to copy all $n$ songs to the flash drive. He can compress the songs. If he compresses the $i$-th song, the size of the $i$-th song reduces from $a_i$ to $b_i$ bytes ($b_i < a_i$).

Ivan can compress any subset of the songs (possibly empty) and copy all the songs to his flash drive if the sum of their sizes is at most $m$. He can compress any subset of the songs (not necessarily contiguous).

Ivan wants to find the minimum number of songs he needs to compress in such a way that all his songs fit on the drive (i.e. the sum of their sizes is less than or equal to $m$).

If it is impossible to copy all the songs (even if Ivan compresses all the songs), print "-1". Otherwise print the minimum number of songs Ivan needs to compress.

-----Input-----

The first line of the input contains two integers $n$ and $m$ ($1 \le n \le 10^5, 1 \le m \le 10^9$) — the number of the songs on Ivan's phone and the capacity of Ivan's flash drive.

The next $n$ lines contain two integers each: the $i$-th line contains two integers $a_i$ and $b_i$ ($1 \le a_i, b_i \le 10^9$, $a_i > b_i$) — the initial size of the $i$-th song and the size of the $i$-th song after compression.

-----Output-----

If it is impossible to compress a subset of the songs in such a way that all songs fit on the flash drive, print "-1". Otherwise print the minimum number of the songs to compress.

-----Examples-----
Input
4 21
10 8
7 4
3 1
5 4

Output
2

Input
4 16
10 8
7 4
3 1
5 4

Output
-1

-----Note-----

In the first example Ivan can compress the first and the third songs so after these moves the sum of sizes will be equal to $8 + 7 + 1 + 5 = 21 \le 21$. Also Ivan can compress the first and the second songs, then the sum of sizes will be equal $8 + 4 + 3 + 5 = 20 \le 21$. Note that compressing any single song is not sufficient to copy all the songs on the flash drive (for example, after compressing the second song the sum of sizes will be equal to $10 + 4 + 3 + 5 = 22 > 21$).

In the second example even if Ivan compresses all the songs the sum of sizes will be equal $8 + 4 + 1 + 4 = 17 > 16$.


You are given three positive integers $n$, $a$ and $b$. You have to construct a string $s$ of length $n$ consisting of lowercase Latin letters such that each substring of length $a$ has exactly $b$ distinct letters. It is guaranteed that the answer exists.

You have to answer $t$ independent test cases.

Recall that the substring $s[l \dots r]$ is the string $s_l, s_{l+1}, \dots, s_{r}$ and its length is $r - l + 1$. In this problem you are only interested in substrings of length $a$.

-----Input-----

The first line of the input contains one integer $t$ ($1 \le t \le 2000$) — the number of test cases. Then $t$ test cases follow.

The only line of a test case contains three space-separated integers $n$, $a$ and $b$ ($1 \le a \le n \le 2000, 1 \le b \le \min(26, a)$), where $n$ is the length of the required string, $a$ is the length of a substring and $b$ is the required number of distinct letters in each substring of length $a$.

It is guaranteed that the sum of $n$ over all test cases does not exceed $2000$ ($\sum n \le 2000$).

-----Output-----

For each test case, print the answer — such a string $s$ of length $n$ consisting of lowercase Latin letters that each substring of length $a$ has exactly $b$ distinct letters. If there are multiple valid answers, print any of them. It is guaranteed that the answer exists.

-----Example-----
Input
4
7 5 3
6 1 1
6 6 1
5 2 2

Output
tleelte
qwerty
vvvvvv
abcde

-----Note-----

In the first test case of the example, consider all the substrings of length $5$:  "tleel": it contains $3$ distinct (unique) letters,  "leelt": it contains $3$ distinct (unique) letters,  "eelte": it contains $3$ distinct (unique) letters.


Takahashi loves takoyaki - a ball-shaped snack.
With a takoyaki machine, he can make at most X pieces of takoyaki at a time, taking T minutes regardless of the number of pieces to make.
How long does it take to make N takoyaki?

-----Constraints-----
 - 1 \leq N,X,T \leq 1000
 - All values in input are integers.

-----Input-----
Input is given from Standard Input in the following format:
N X T

-----Output-----
Print an integer representing the minimum number of minutes needed to make N pieces of takoyaki.

-----Sample Input-----
20 12 6

-----Sample Output-----
12

He can make 12 pieces of takoyaki in the first 6 minutes and 8 more in the next 6 minutes, so he can make 20 in a total of 12 minutes.
Note that being able to make 12 in 6 minutes does not mean he can make 2 in 1 minute.


There are N students in a school.
We will divide these students into some groups, and in each group they will discuss some themes.
You think that groups consisting of two or less students cannot have an effective discussion, so you want to have as many groups consisting of three or more students as possible.
Divide the students so that the number of groups consisting of three or more students is maximized.

-----Constraints-----
 - 1 \leq N \leq 1000
 - All input values are integers.

-----Input-----
Input is given from Standard Input in the following format:
N

-----Output-----
If you can form at most x groups consisting of three or more students, print x.

-----Sample Input-----
8

-----Sample Output-----
2

For example, you can form a group of three students and another of five students.


We have A apples and P pieces of apple.
We can cut an apple into three pieces of apple, and make one apple pie by simmering two pieces of apple in a pan.
Find the maximum number of apple pies we can make with what we have now.

-----Constraints-----
 - All values in input are integers.
 - 0 \leq A, P \leq 100

-----Input-----
Input is given from Standard Input in the following format:
A P

-----Output-----
Print the maximum number of apple pies we can make with what we have.

-----Sample Input-----
1 3

-----Sample Output-----
3

We can first make one apple pie by simmering two of the three pieces of apple. Then, we can make two more by simmering the remaining piece and three more pieces obtained by cutting the whole apple.


You are given positive integers A and B.
If A is a divisor of B, print A + B; otherwise, print B - A.

-----Constraints-----
 - All values in input are integers.
 - 1 \leq A \leq B \leq 20

-----Input-----
Input is given from Standard Input in the following format:
A B

-----Output-----
If A is a divisor of B, print A + B; otherwise, print B - A.

-----Sample Input-----
4 12

-----Sample Output-----
16

As 4 is a divisor of 12, 4 + 12 = 16 should be printed.


Takahashi wants to be a member of some web service.
He tried to register himself with the ID S, which turned out to be already used by another user.
Thus, he decides to register using a string obtained by appending one character at the end of S as his ID.
He is now trying to register with the ID T. Determine whether this string satisfies the property above.

-----Constraints-----
 - S and T are strings consisting of lowercase English letters.
 - 1 \leq |S| \leq 10
 - |T| = |S| + 1

-----Input-----
Input is given from Standard Input in the following format:
S
T

-----Output-----
If T satisfies the property in Problem Statement, print Yes; otherwise, print No.

-----Sample Input-----
chokudai
chokudaiz

-----Sample Output-----
Yes

chokudaiz can be obtained by appending z at the end of chokudai.


We have two distinct integers A and B.
Print the integer K such that |A - K| = |B - K|.
If such an integer does not exist, print IMPOSSIBLE instead.

-----Constraints-----
 - All values in input are integers.
 - 0 \leq A,\ B \leq 10^9
 - A and B are distinct.

-----Input-----
Input is given from Standard Input in the following format:
A B

-----Output-----
Print the integer K satisfying the condition.
If such an integer does not exist, print IMPOSSIBLE instead.

-----Sample Input-----
2 16

-----Sample Output-----
9

|2 - 9| = 7 and |16 - 9| = 7, so 9 satisfies the condition.


Given is a three-digit integer N. Does N contain the digit 7?
If so, print Yes; otherwise, print No.

-----Constraints-----
 - 100 \leq N \leq 999

-----Input-----
Input is given from Standard Input in the following format:
N

-----Output-----
If N contains the digit 7, print Yes; otherwise, print No.

-----Sample Input-----
117

-----Sample Output-----
Yes

117 contains 7 as its last digit.


Let S(n) denote the sum of the digits in the decimal notation of n.
For example, S(101) = 1 + 0 + 1 = 2.
Given an integer N, determine if S(N) divides N.

-----Constraints-----
 - 1 \leq N \leq 10^9

-----Input-----
Input is given from Standard Input in the following format:
N

-----Output-----
If S(N) divides N, print Yes; if it does not, print No.

-----Sample Input-----
12

-----Sample Output-----
Yes

In this input, N=12.
As S(12) = 1 + 2 = 3, S(N) divides N.


There is a square in the xy-plane. The coordinates of its four vertices are (x_1,y_1),(x_2,y_2),(x_3,y_3) and (x_4,y_4) in counter-clockwise order.
(Assume that the positive x-axis points right, and the positive y-axis points up.)
Takahashi remembers (x_1,y_1) and (x_2,y_2), but he has forgot (x_3,y_3) and (x_4,y_4).
Given x_1,x_2,y_1,y_2, restore x_3,y_3,x_4,y_4. It can be shown that x_3,y_3,x_4 and y_4 uniquely exist and have integer values.

-----Constraints-----
 - |x_1|,|y_1|,|x_2|,|y_2| \leq 100
 - (x_1,y_1) ≠ (x_2,y_2)
 - All values in input are integers.

-----Input-----
Input is given from Standard Input in the following format:
x_1 y_1 x_2 y_2

-----Output-----
Print x_3,y_3,x_4 and y_4 as integers, in this order.

-----Sample Input-----
0 0 0 1

-----Sample Output-----
-1 1 -1 0

(0,0),(0,1),(-1,1),(-1,0) is the four vertices of a square in counter-clockwise order.
Note that (x_3,y_3)=(1,1),(x_4,y_4)=(1,0) is not accepted, as the vertices are in clockwise order.


We have A balls with the string S written on each of them and B balls with the string T written on each of them.

From these balls, Takahashi chooses one with the string U written on it and throws it away.

Find the number of balls with the string S and balls with the string T that we have now.

-----Constraints-----
 - S, T, and U are strings consisting of lowercase English letters.
 - The lengths of S and T are each between 1 and 10 (inclusive).
 - S \not= T
 - S=U or T=U.
 - 1 \leq A,B \leq 10
 - A and B are integers.

-----Input-----
Input is given from Standard Input in the following format:
S T
A B
U

-----Output-----
Print the answer, with space in between.

-----Sample Input-----
red blue
3 4
red

-----Sample Output-----
2 4

Takahashi chose a ball with red written on it and threw it away.
Now we have two balls with the string S and four balls with the string T.


Given are a positive integer N and a string S of length N consisting of lowercase English letters.
Determine whether the string is a concatenation of two copies of some string.
That is, determine whether there is a string T such that S = T + T.

-----Constraints-----
 - 1 \leq N \leq 100
 - S consists of lowercase English letters.
 - |S| = N

-----Input-----
Input is given from Standard Input in the following format:
N
S

-----Output-----
If S is a concatenation of two copies of some string, print Yes; otherwise, print No.

-----Sample Input-----
6
abcabc

-----Sample Output-----
Yes

Let T =  abc, and S = T + T.


There is a rectangle in a coordinate plane. The coordinates of the four vertices are (0,0), (W,0), (W,H), and (0,H).
You are given a point (x,y) which is within the rectangle or on its border. We will draw a straight line passing through (x,y) to cut the rectangle into two parts. Find the maximum possible area of the part whose area is not larger than that of the other. Additionally, determine if there are multiple ways to cut the rectangle and achieve that maximum.

-----Constraints-----
 - 1 \leq W,H \leq 10^9
 - 0\leq x\leq W
 - 0\leq y\leq H
 - All values in input are integers.

-----Input-----
Input is given from Standard Input in the following format:
W H x y

-----Output-----
Print the maximum possible area of the part whose area is not larger than that of the other, followed by 1 if there are multiple ways to cut the rectangle and achieve that maximum, and 0 otherwise.
The area printed will be judged correct when its absolute or relative error is at most 10^{-9}.

-----Sample Input-----
2 3 1 2

-----Sample Output-----
3.000000 0

The line x=1 gives the optimal cut, and no other line does.


In Japan, people make offerings called hina arare, colorful crackers, on March 3.
We have a bag that contains N hina arare. (From here, we call them arare.)
It is known that the bag either contains arare in three colors: pink, white and green, or contains arare in four colors: pink, white, green and yellow.
We have taken out the arare in the bag one by one, and the color of the i-th arare was S_i, where colors are represented as follows - pink: P, white: W, green: G, yellow: Y.
If the number of colors of the arare in the bag was three, print Three; if the number of colors was four, print Four.

-----Constraints-----
 - 1 \leq N \leq 100
 - S_i is P, W, G or Y.
 - There always exist i, j and k such that S_i=P, S_j=W and S_k=G.

-----Input-----
Input is given from Standard Input in the following format:
N
S_1 S_2 ... S_N

-----Output-----
If the number of colors of the arare in the bag was three, print Three; if the number of colors was four, print Four.

-----Sample Input-----
6
G W Y P Y W

-----Sample Output-----
Four

The bag contained arare in four colors, so you should print Four.


You are policeman and you are playing a game with Slavik. The game is turn-based and each turn consists of two phases. During the first phase you make your move and during the second phase Slavik makes his move.

There are $n$ doors, the $i$-th door initially has durability equal to $a_i$.

During your move you can try to break one of the doors. If you choose door $i$ and its current durability is $b_i$ then you reduce its durability to $max(0, b_i - x)$ (the value $x$ is given).

During Slavik's move he tries to repair one of the doors. If he chooses door $i$ and its current durability is $b_i$ then he increases its durability to $b_i + y$ (the value $y$ is given). Slavik cannot repair doors with current durability equal to $0$.

The game lasts $10^{100}$ turns. If some player cannot make his move then he has to skip it.

Your goal is to maximize the number of doors with durability equal to $0$ at the end of the game. You can assume that Slavik wants to minimize the number of such doors. What is the number of such doors in the end if you both play optimally?

-----Input-----

The first line of the input contains three integers $n$, $x$ and $y$ ($1 \le n \le 100$, $1 \le x, y \le 10^5$) — the number of doors, value $x$ and value $y$, respectively.

The second line of the input contains $n$ integers $a_1, a_2, \dots, a_n$ ($1 \le a_i \le 10^5$), where $a_i$ is the initial durability of the $i$-th door.

-----Output-----

Print one integer — the number of doors with durability equal to $0$ at the end of the game, if you and Slavik both play optimally.

-----Examples-----
Input
6 3 2
2 3 1 3 4 2

Output
6

Input
5 3 3
1 2 4 2 3

Output
2

Input
5 5 6
1 2 6 10 3

Output
2

-----Note-----

Clarifications about the optimal strategy will be ignored.


The next lecture in a high school requires two topics to be discussed. The $i$-th topic is interesting by $a_i$ units for the teacher and by $b_i$ units for the students.

The pair of topics $i$ and $j$ ($i < j$) is called good if $a_i + a_j > b_i + b_j$ (i.e. it is more interesting for the teacher).

Your task is to find the number of good pairs of topics.

-----Input-----

The first line of the input contains one integer $n$ ($2 \le n \le 2 \cdot 10^5$) — the number of topics.

The second line of the input contains $n$ integers $a_1, a_2, \dots, a_n$ ($1 \le a_i \le 10^9$), where $a_i$ is the interestingness of the $i$-th topic for the teacher.

The third line of the input contains $n$ integers $b_1, b_2, \dots, b_n$ ($1 \le b_i \le 10^9$), where $b_i$ is the interestingness of the $i$-th topic for the students.

-----Output-----

Print one integer — the number of good pairs of topic.

-----Examples-----
Input
5
4 8 2 6 2
4 5 4 1 3

Output
7

Input
4
1 3 2 4
1 3 2 4

Output
0


Mishka got an integer array $a$ of length $n$ as a birthday present (what a surprise!).

Mishka doesn't like this present and wants to change it somehow. He has invented an algorithm and called it "Mishka's Adjacent Replacements Algorithm". This algorithm can be represented as a sequence of steps:  Replace each occurrence of $1$ in the array $a$ with $2$;  Replace each occurrence of $2$ in the array $a$ with $1$;  Replace each occurrence of $3$ in the array $a$ with $4$;  Replace each occurrence of $4$ in the array $a$ with $3$;  Replace each occurrence of $5$ in the array $a$ with $6$;  Replace each occurrence of $6$ in the array $a$ with $5$;  $\dots$  Replace each occurrence of $10^9 - 1$ in the array $a$ with $10^9$;  Replace each occurrence of $10^9$ in the array $a$ with $10^9 - 1$.

Note that the dots in the middle of this algorithm mean that Mishka applies these replacements for each pair of adjacent integers ($2i - 1, 2i$) for each $i \in\{1, 2, \ldots, 5 \cdot 10^8\}$ as described above.

For example, for the array $a = [1, 2, 4, 5, 10]$, the following sequence of arrays represents the algorithm:

$[1, 2, 4, 5, 10]$ $\rightarrow$ (replace all occurrences of $1$ with $2$) $\rightarrow$ $[2, 2, 4, 5, 10]$ $\rightarrow$ (replace all occurrences of $2$ with $1$) $\rightarrow$ $[1, 1, 4, 5, 10]$ $\rightarrow$ (replace all occurrences of $3$ with $4$) $\rightarrow$ $[1, 1, 4, 5, 10]$ $\rightarrow$ (replace all occurrences of $4$ with $3$) $\rightarrow$ $[1, 1, 3, 5, 10]$ $\rightarrow$ (replace all occurrences of $5$ with $6$) $\rightarrow$ $[1, 1, 3, 6, 10]$ $\rightarrow$ (replace all occurrences of $6$ with $5$) $\rightarrow$ $[1, 1, 3, 5, 10]$ $\rightarrow$ $\dots$ $\rightarrow$ $[1, 1, 3, 5, 10]$ $\rightarrow$ (replace all occurrences of $10$ with $9$) $\rightarrow$ $[1, 1, 3, 5, 9]$. The later steps of the algorithm do not change the array.

Mishka is very lazy and he doesn't want to apply these changes by himself. But he is very interested in their result. Help him find it.

-----Input-----

The first line of the input contains one integer number $n$ ($1 \le n \le 1000$) — the number of elements in Mishka's birthday present (surprisingly, an array).

The second line of the input contains $n$ integers $a_1, a_2, \dots, a_n$ ($1 \le a_i \le 10^9$) — the elements of the array.

-----Output-----

Print $n$ integers — $b_1, b_2, \dots, b_n$, where $b_i$ is the final value of the $i$-th element of the array after applying "Mishka's Adjacent Replacements Algorithm" to the array $a$. Note that you cannot change the order of elements in the array.

-----Examples-----
Input
5
1 2 4 5 10

Output
1 1 3 5 9

Input
10
10000 10 50605065 1 5 89 5 999999999 60506056 1000000000

Output
9999 9 50605065 1 5 89 5 999999999 60506055 999999999

-----Note-----

The first example is described in the problem statement.


You are given an undirected graph consisting of $n$ vertices and $m$ edges. Your task is to find the number of connected components which are cycles.

Here are some definitions of graph theory.

An undirected graph consists of two sets: set of nodes (called vertices) and set of edges. Each edge connects a pair of vertices. All edges are bidirectional (i.e. if a vertex $a$ is connected with a vertex $b$, a vertex $b$ is also connected with a vertex $a$). An edge can't connect vertex with itself, there is at most one edge between a pair of vertices.

Two vertices $u$ and $v$ belong to the same connected component if and only if there is at least one path along edges connecting $u$ and $v$.

A connected component is a cycle if and only if its vertices can be reordered in such a way that:  the first vertex is connected with the second vertex by an edge,  the second vertex is connected with the third vertex by an edge,  ...  the last vertex is connected with the first vertex by an edge,  all the described edges of a cycle are distinct.

A cycle doesn't contain any other edges except described above. By definition any cycle contains three or more vertices. [Image] There are $6$ connected components, $2$ of them are cycles: $[7, 10, 16]$ and $[5, 11, 9, 15]$.

-----Input-----

The first line contains two integer numbers $n$ and $m$ ($1 \le n \le 2 \cdot 10^5$, $0 \le m \le 2 \cdot 10^5$) — number of vertices and edges.

The following $m$ lines contains edges: edge $i$ is given as a pair of vertices $v_i$, $u_i$ ($1 \le v_i, u_i \le n$, $u_i \ne v_i$). There is no multiple edges in the given graph, i.e. for each pair ($v_i, u_i$) there no other pairs ($v_i, u_i$) and ($u_i, v_i$) in the list of edges.

-----Output-----

Print one integer — the number of connected components which are also cycles.

-----Examples-----
Input
5 4
1 2
3 4
5 4
3 5

Output
1

Input
17 15
1 8
1 12
5 11
11 9
9 15
15 5
4 13
3 13
4 3
10 16
7 10
16 7
14 3
14 4
17 6

Output
2

-----Note-----

In the first example only component $[3, 4, 5]$ is also a cycle.

The illustration above corresponds to the second example.


You are given an undirected tree of $n$ vertices.

Some vertices are colored blue, some are colored red and some are uncolored. It is guaranteed that the tree contains at least one red vertex and at least one blue vertex.

You choose an edge and remove it from the tree. Tree falls apart into two connected components. Let's call an edge nice if neither of the resulting components contain vertices of both red and blue colors.

How many nice edges are there in the given tree?

-----Input-----

The first line contains a single integer $n$ ($2 \le n \le 3 \cdot 10^5$) — the number of vertices in the tree.

The second line contains $n$ integers $a_1, a_2, \dots, a_n$ ($0 \le a_i \le 2$) — the colors of the vertices. $a_i = 1$ means that vertex $i$ is colored red, $a_i = 2$ means that vertex $i$ is colored blue and $a_i = 0$ means that vertex $i$ is uncolored.

The $i$-th of the next $n - 1$ lines contains two integers $v_i$ and $u_i$ ($1 \le v_i, u_i \le n$, $v_i \ne u_i$) — the edges of the tree. It is guaranteed that the given edges form a tree. It is guaranteed that the tree contains at least one red vertex and at least one blue vertex.

-----Output-----

Print a single integer — the number of nice edges in the given tree.

-----Examples-----
Input
5
2 0 0 1 2
1 2
2 3
2 4
2 5

Output
1

Input
5
1 0 0 0 2
1 2
2 3
3 4
4 5

Output
4

Input
3
1 1 2
2 3
1 3

Output
0

-----Note-----

Here is the tree from the first example: [Image]

The only nice edge is edge $(2, 4)$. Removing it makes the tree fall apart into components $\{4\}$ and $\{1, 2, 3, 5\}$. The first component only includes a red vertex and the second component includes blue vertices and uncolored vertices.

Here is the tree from the second example: [Image]

Every edge is nice in it.

Here is the tree from the third example: [Image]

Edge $(1, 3)$ splits the into components $\{1\}$ and $\{3, 2\}$, the latter one includes both red and blue vertex, thus the edge isn't nice. Edge $(2, 3)$ splits the into components $\{1, 3\}$ and $\{2\}$, the former one includes both red and blue vertex, thus the edge also isn't nice. So the answer is 0.


You are given two strings $s$ and $t$, both consisting of exactly $k$ lowercase Latin letters, $s$ is lexicographically less than $t$.

Let's consider list of all strings consisting of exactly $k$ lowercase Latin letters, lexicographically not less than $s$ and not greater than $t$ (including $s$ and $t$) in lexicographical order. For example, for $k=2$, $s=$"az" and $t=$"bf" the list will be ["az", "ba", "bb", "bc", "bd", "be", "bf"].

Your task is to print the median (the middle element) of this list. For the example above this will be "bc".

It is guaranteed that there is an odd number of strings lexicographically not less than $s$ and not greater than $t$.

-----Input-----

The first line of the input contains one integer $k$ ($1 \le k \le 2 \cdot 10^5$) — the length of strings.

The second line of the input contains one string $s$ consisting of exactly $k$ lowercase Latin letters.

The third line of the input contains one string $t$ consisting of exactly $k$ lowercase Latin letters.

It is guaranteed that $s$ is lexicographically less than $t$.

It is guaranteed that there is an odd number of strings lexicographically not less than $s$ and not greater than $t$.

-----Output-----

Print one string consisting exactly of $k$ lowercase Latin letters — the median (the middle element) of list of strings of length $k$ lexicographically not less than $s$ and not greater than $t$.

-----Examples-----
Input
2
az
bf

Output
bc

Input
5
afogk
asdji

Output
alvuw

Input
6
nijfvj
tvqhwp

Output
qoztvz


There are $n$ students in a school class, the rating of the $i$-th student on Codehorses is $a_i$. You have to form a team consisting of $k$ students ($1 \le k \le n$) such that the ratings of all team members are distinct.

If it is impossible to form a suitable team, print "NO" (without quotes). Otherwise print "YES", and then print $k$ distinct numbers which should be the indices of students in the team you form. If there are multiple answers, print any of them.

-----Input-----

The first line contains two integers $n$ and $k$ ($1 \le k \le n \le 100$) — the number of students and the size of the team you have to form.

The second line contains $n$ integers $a_1, a_2, \dots, a_n$ ($1 \le a_i \le 100$), where $a_i$ is the rating of $i$-th student.

-----Output-----

If it is impossible to form a suitable team, print "NO" (without quotes). Otherwise print "YES", and then print $k$ distinct integers from $1$ to $n$ which should be the indices of students in the team you form. All the ratings of the students in the team should be distinct. You may print the indices in any order. If there are multiple answers, print any of them.

Assume that the students are numbered from $1$ to $n$.

-----Examples-----
Input
5 3
15 13 15 15 12

Output
YES
1 2 5

Input
5 4
15 13 15 15 12

Output
NO

Input
4 4
20 10 40 30

Output
YES
1 2 3 4

-----Note-----

All possible answers for the first example:   {1 2 5}  {2 3 5}  {2 4 5}

Note that the order does not matter.


Two integer sequences existed initially, one of them was strictly increasing, and another one — strictly decreasing.

Strictly increasing sequence is a sequence of integers $[x_1 < x_2 < \dots < x_k]$. And strictly decreasing sequence is a sequence of integers $[y_1 > y_2 > \dots > y_l]$. Note that the empty sequence and the sequence consisting of one element can be considered as increasing or decreasing.

Elements of increasing sequence were inserted between elements of the decreasing one (and, possibly, before its first element and after its last element) without changing the order. For example, sequences $[1, 3, 4]$ and $[10, 4, 2]$ can produce the following resulting sequences: $[10, \textbf{1}, \textbf{3}, 4, 2, \textbf{4}]$, $[\textbf{1}, \textbf{3}, \textbf{4}, 10, 4, 2]$. The following sequence cannot be the result of these insertions: $[\textbf{1}, 10, \textbf{4}, 4, \textbf{3}, 2]$ because the order of elements in the increasing sequence was changed.

Let the obtained sequence be $a$. This sequence $a$ is given in the input. Your task is to find any two suitable initial sequences. One of them should be strictly increasing, and another one — strictly decreasing. Note that the empty sequence and the sequence consisting of one element can be considered as increasing or decreasing.

If there is a contradiction in the input and it is impossible to split the given sequence $a$ into one increasing sequence and one decreasing sequence, print "NO".

-----Input-----

The first line of the input contains one integer $n$ ($1 \le n \le 2 \cdot 10^5$) — the number of elements in $a$.

The second line of the input contains $n$ integers $a_1, a_2, \dots, a_n$ ($0 \le a_i \le 2 \cdot 10^5$), where $a_i$ is the $i$-th element of $a$.

-----Output-----

If there is a contradiction in the input and it is impossible to split the given sequence $a$ into one increasing sequence and one decreasing sequence, print "NO" in the first line.

Otherwise print "YES" in the first line. In the second line, print a sequence of $n$ integers $res_1, res_2, \dots, res_n$, where $res_i$ should be either $0$ or $1$ for each $i$ from $1$ to $n$. The $i$-th element of this sequence should be $0$ if the $i$-th element of $a$ belongs to the increasing sequence, and $1$ otherwise. Note that the empty sequence and the sequence consisting of one element can be considered as increasing or decreasing.

-----Examples-----
Input
9
5 1 3 6 8 2 9 0 10

Output
YES
1 0 0 0 0 1 0 1 0

Input
5
1 2 4 0 2

Output
NO


Vova plans to go to the conference by train. Initially, the train is at the point $1$ and the destination point of the path is the point $L$. The speed of the train is $1$ length unit per minute (i.e. at the first minute the train is at the point $1$, at the second minute — at the point $2$ and so on).

There are lanterns on the path. They are placed at the points with coordinates divisible by $v$ (i.e. the first lantern is at the point $v$, the second is at the point $2v$ and so on).

There is also exactly one standing train which occupies all the points from $l$ to $r$ inclusive.

Vova can see the lantern at the point $p$ if $p$ is divisible by $v$ and there is no standing train at this position ($p \not\in [l; r]$). Thus, if the point with the lantern is one of the points covered by the standing train, Vova can't see this lantern.

Your problem is to say the number of lanterns Vova will see during the path. Vova plans to go to $t$ different conferences, so you should answer $t$ independent queries.

-----Input-----

The first line of the input contains one integer $t$ ($1 \le t \le 10^4$) — the number of queries.

Then $t$ lines follow. The $i$-th line contains four integers $L_i, v_i, l_i, r_i$ ($1 \le L, v \le 10^9$, $1 \le l \le r \le L$) — destination point of the $i$-th path, the period of the lantern appearance and the segment occupied by the standing train.

-----Output-----

Print $t$ lines. The $i$-th line should contain one integer — the answer for the $i$-th query.

-----Example-----
Input
4
10 2 3 7
100 51 51 51
1234 1 100 199
1000000000 1 1 1000000000

Output
3
0
1134
0

-----Note-----

For the first example query, the answer is $3$. There are lanterns at positions $2$, $4$, $6$, $8$ and $10$, but Vova didn't see the lanterns at positions $4$ and $6$ because of the standing train.

For the second example query, the answer is $0$ because the only lantern is at the point $51$ and there is also a standing train at this point.

For the third example query, the answer is $1134$ because there are $1234$ lanterns, but Vova didn't see the lanterns from the position $100$ to the position $199$ inclusive.

For the fourth example query, the answer is $0$ because the standing train covers the whole path.


One day, $n$ people ($n$ is an even number) met on a plaza and made two round dances, each round dance consists of exactly $\frac{n}{2}$ people. Your task is to find the number of ways $n$ people can make two round dances if each round dance consists of exactly $\frac{n}{2}$ people. Each person should belong to exactly one of these two round dances.

Round dance is a dance circle consisting of $1$ or more people. Two round dances are indistinguishable (equal) if one can be transformed to another by choosing the first participant. For example, round dances $[1, 3, 4, 2]$, $[4, 2, 1, 3]$ and $[2, 1, 3, 4]$ are indistinguishable.

For example, if $n=2$ then the number of ways is $1$: one round dance consists of the first person and the second one of the second person.

For example, if $n=4$ then the number of ways is $3$. Possible options:  one round dance — $[1,2]$, another — $[3,4]$;  one round dance — $[2,4]$, another — $[3,1]$;  one round dance — $[4,1]$, another — $[3,2]$.

Your task is to find the number of ways $n$ people can make two round dances if each round dance consists of exactly $\frac{n}{2}$ people.

-----Input-----

The input contains one integer $n$ ($2 \le n \le 20$), $n$ is an even number.

-----Output-----

Print one integer — the number of ways to make two round dances. It is guaranteed that the answer fits in the $64$-bit integer data type.

-----Examples-----
Input
2

Output
1

Input
4

Output
3

Input
8

Output
1260

Input
20

Output
12164510040883200


You are given a string $s$ consisting of $n$ lowercase Latin letters. Polycarp wants to remove exactly $k$ characters ($k \le n$) from the string $s$. Polycarp uses the following algorithm $k$ times:

  if there is at least one letter 'a', remove the leftmost occurrence and stop the algorithm, otherwise go to next item;  if there is at least one letter 'b', remove the leftmost occurrence and stop the algorithm, otherwise go to next item;  ...  remove the leftmost occurrence of the letter 'z' and stop the algorithm.

This algorithm removes a single letter from the string. Polycarp performs this algorithm exactly $k$ times, thus removing exactly $k$ characters.

Help Polycarp find the resulting string.

-----Input-----

The first line of input contains two integers $n$ and $k$ ($1 \le k \le n \le 4 \cdot 10^5$) — the length of the string and the number of letters Polycarp will remove.

The second line contains the string $s$ consisting of $n$ lowercase Latin letters.

-----Output-----

Print the string that will be obtained from $s$ after Polycarp removes exactly $k$ letters using the above algorithm $k$ times.

If the resulting string is empty, print nothing. It is allowed to print nothing or an empty line (line break).

-----Examples-----
Input
15 3
cccaabababaccbc

Output
cccbbabaccbc

Input
15 9
cccaabababaccbc

Output
cccccc

Input
1 1
u

Output


The only difference between easy and hard versions is constraints.

Ivan plays a computer game that contains some microtransactions to make characters look cooler. Since Ivan wants his character to be really cool, he wants to use some of these microtransactions — and he won't start playing until he gets all of them.

Each day (during the morning) Ivan earns exactly one burle.

There are $n$ types of microtransactions in the game. Each microtransaction costs $2$ burles usually and $1$ burle if it is on sale. Ivan has to order exactly $k_i$ microtransactions of the $i$-th type (he orders microtransactions during the evening).

Ivan can order any (possibly zero) number of microtransactions of any types during any day (of course, if he has enough money to do it). If the microtransaction he wants to order is on sale then he can buy it for $1$ burle and otherwise he can buy it for $2$ burles.

There are also $m$ special offers in the game shop. The $j$-th offer $(d_j, t_j)$ means that microtransactions of the $t_j$-th type are on sale during the $d_j$-th day.

Ivan wants to order all microtransactions as soon as possible. Your task is to calculate the minimum day when he can buy all microtransactions he want and actually start playing.

-----Input-----

The first line of the input contains two integers $n$ and $m$ ($1 \le n, m \le 2 \cdot 10^5$) — the number of types of microtransactions and the number of special offers in the game shop.

The second line of the input contains $n$ integers $k_1, k_2, \dots, k_n$ ($0 \le k_i \le 2 \cdot 10^5$), where $k_i$ is the number of copies of microtransaction of the $i$-th type Ivan has to order. It is guaranteed that sum of all $k_i$ is not less than $1$ and not greater than $2 \cdot 10^5$.

The next $m$ lines contain special offers. The $j$-th of these lines contains the $j$-th special offer. It is given as a pair of integers $(d_j, t_j)$ ($1 \le d_j \le 2 \cdot 10^5, 1 \le t_j \le n$) and means that microtransactions of the $t_j$-th type are on sale during the $d_j$-th day.

-----Output-----

Print one integer — the minimum day when Ivan can order all microtransactions he wants and actually start playing.

-----Examples-----
Input
5 6
1 2 0 2 0
2 4
3 3
1 5
1 2
1 5
2 3

Output
8

Input
5 3
4 2 1 3 2
3 5
4 2
2 5

Output
20


A star is a figure of the following type: an asterisk character '*' in the center of the figure and four rays (to the left, right, top, bottom) of the same positive length. The size of a star is the length of its rays. The size of a star must be a positive number (i.e. rays of length $0$ are not allowed).

Let's consider empty cells are denoted by '.', then the following figures are stars:

 [Image] The leftmost figure is a star of size $1$, the middle figure is a star of size $2$ and the rightmost figure is a star of size $3$.

You are given a rectangular grid of size $n \times m$ consisting only of asterisks '*' and periods (dots) '.'. Rows are numbered from $1$ to $n$, columns are numbered from $1$ to $m$. Your task is to draw this grid using any number of stars or find out that it is impossible. Stars can intersect, overlap or even coincide with each other. The number of stars in the output can't exceed $n \cdot m$. Each star should be completely inside the grid. You can use stars of same and arbitrary sizes.

In this problem, you do not need to minimize the number of stars. Just find any way to draw the given grid with at most $n \cdot m$ stars.

-----Input-----

The first line of the input contains two integers $n$ and $m$ ($3 \le n, m \le 1000$) — the sizes of the given grid.

The next $n$ lines contains $m$ characters each, the $i$-th line describes the $i$-th row of the grid. It is guaranteed that grid consists of characters '*' and '.' only.

-----Output-----

If it is impossible to draw the given grid using stars only, print "-1".

Otherwise in the first line print one integer $k$ ($0 \le k \le n \cdot m$) — the number of stars needed to draw the given grid. The next $k$ lines should contain three integers each — $x_j$, $y_j$ and $s_j$, where $x_j$ is the row index of the central star character, $y_j$ is the column index of the central star character and $s_j$ is the size of the star. Each star should be completely inside the grid.

-----Examples-----
Input
6 8
....*...
...**...
..*****.
...**...
....*...
........

Output
3
3 4 1
3 5 2
3 5 1

Input
5 5
.*...
****.
.****
..**.
.....

Output
3
2 2 1
3 3 1
3 4 1

Input
5 5
.*...
***..
.*...
.*...
.....

Output
-1

Input
3 3
*.*
.*.
*.*

Output
-1

-----Note-----

In the first example the output 2

3 4 1

3 5 2

is also correct.


You are given a three-digit positive integer N.

Determine whether N is a palindromic number.

Here, a palindromic number is an integer that reads the same backward as forward in decimal notation.

-----Constraints-----
 - 100≤N≤999
 - N is an integer.

-----Input-----
Input is given from Standard Input in the following format:
N

-----Output-----
If N is a palindromic number, print Yes; otherwise, print No.

-----Sample Input-----
575

-----Sample Output-----
Yes

N=575 is also 575 when read backward, so it is a palindromic number. You should print Yes.


Alice and Bob are playing One Card Poker.

One Card Poker is a two-player game using playing cards.
Each card in this game shows an integer between 1 and 13, inclusive.

The strength of a card is determined by the number written on it, as follows:
Weak 2 < 3 < 4 < 5 < 6 < 7 < 8 < 9 < 10 < 11 < 12 < 13 < 1 Strong
One Card Poker is played as follows:
 - Each player picks one card from the deck. The chosen card becomes the player's hand.
 - The players reveal their hands to each other. The player with the stronger card wins the game.
If their cards are equally strong, the game is drawn.
You are watching Alice and Bob playing the game, and can see their hands.

The number written on Alice's card is A, and the number written on Bob's card is B.

Write a program to determine the outcome of the game.

-----Constraints-----
 - 1≦A≦13
 - 1≦B≦13
 - A and B are integers.

-----Input-----
The input is given from Standard Input in the following format:
A B

-----Output-----
Print Alice if Alice will win. Print Bob if Bob will win. Print Draw if the game will be drawn.

-----Sample Input-----
8 6

-----Sample Output-----
Alice

8 is written on Alice's card, and 6 is written on Bob's card.
Alice has the stronger card, and thus the output should be Alice.


As a New Year's gift, Dolphin received a string s of length 19.

The string s has the following format: [five lowercase English letters],[seven lowercase English letters],[five lowercase English letters].

Dolphin wants to convert the comma-separated string s into a space-separated string.

Write a program to perform the conversion for him.

-----Constraints-----
 - The length of s is 19.
 - The sixth and fourteenth characters in s are ,.
 - The other characters in s are lowercase English letters.

-----Input-----
The input is given from Standard Input in the following format:
s

-----Output-----
Print the string after the conversion.

-----Sample Input-----
happy,newyear,enjoy

-----Sample Output-----
happy newyear enjoy

Replace all the commas in happy,newyear,enjoy with spaces to obtain happy newyear enjoy.


There are N students and M checkpoints on the xy-plane.

The coordinates of the i-th student (1 \leq i \leq N) is (a_i,b_i), and the coordinates of the checkpoint numbered j (1 \leq j \leq M) is (c_j,d_j).

When the teacher gives a signal, each student has to go to the nearest checkpoint measured in Manhattan distance.

The Manhattan distance between two points (x_1,y_1) and (x_2,y_2) is |x_1-x_2|+|y_1-y_2|.

Here, |x| denotes the absolute value of x.

If there are multiple nearest checkpoints for a student, he/she will select the checkpoint with the smallest index.

Which checkpoint will each student go to?

-----Constraints-----
 - 1 \leq N,M \leq 50
 - -10^8 \leq a_i,b_i,c_j,d_j \leq 10^8
 - All input values are integers.

-----Input-----
The input is given from Standard Input in the following format:
N M
a_1 b_1
:
a_N b_N
c_1 d_1
:
c_M d_M

-----Output-----
Print N lines.

The i-th line (1 \leq i \leq N) should contain the index of the checkpoint for the i-th student to go.

-----Sample Input-----
2 2
2 0
0 0
-1 0
1 0

-----Sample Output-----
2
1

The Manhattan distance between the first student and each checkpoint is:
 - For checkpoint 1: |2-(-1)|+|0-0|=3
 - For checkpoint 2: |2-1|+|0-0|=1
The nearest checkpoint is checkpoint 2. Thus, the first line in the output should contain 2.
The Manhattan distance between the second student and each checkpoint is:
 - For checkpoint 1: |0-(-1)|+|0-0|=1
 - For checkpoint 2: |0-1|+|0-0|=1
When there are multiple nearest checkpoints, the student will go to the checkpoint with the smallest index. Thus, the second line in the output should contain 1.


Given an integer a as input, print the value a + a^2 + a^3.

-----Constraints-----
 - 1 \leq a \leq 10
 - a is an integer.

-----Input-----
Input is given from Standard Input in the following format:
a

-----Output-----
Print the value a + a^2 + a^3 as an integer.

-----Sample Input-----
2

-----Sample Output-----
14

When a = 2, we have a + a^2 + a^3 = 2 + 2^2 + 2^3 = 2 + 4 + 8 = 14.
Print the answer as an input. Outputs such as 14.0 will be judged as incorrect.


You are given an image A composed of N rows and N columns of pixels, and a template image B composed of M rows and M columns of pixels.

A pixel is the smallest element of an image, and in this problem it is a square of size 1×1.

Also, the given images are binary images, and the color of each pixel is either white or black.
In the input, every pixel is represented by a character: . corresponds to a white pixel, and # corresponds to a black pixel.

The image A is given as N strings A_1,...,A_N.

The j-th character in the string A_i corresponds to the pixel at the i-th row and j-th column of the image A (1≦i,j≦N).

Similarly, the template image B is given as M strings B_1,...,B_M.

The j-th character in the string B_i corresponds to the pixel at the i-th row and j-th column of the template image B (1≦i,j≦M).
Determine whether the template image B is contained in the image A when only parallel shifts can be applied to the images.

-----Constraints-----
 - 1≦M≦N≦50
 - A_i is a string of length N consisting of # and ..
 - B_i is a string of length M consisting of # and ..

-----Input-----
The input is given from Standard Input in the following format:
N M
A_1
A_2
:
A_N
B_1
B_2
:
B_M

-----Output-----
Print Yes if the template image B is contained in the image A. Print No otherwise.

-----Sample Input-----
3 2
#.#
.#.
#.#
#.
.#

-----Sample Output-----
Yes

The template image B is identical to the upper-left 2 × 2 subimage and the lower-right 2 × 2 subimage of A. Thus, the output should be Yes.


You have decided to give an allowance to your child depending on the outcome of the game that he will play now.
The game is played as follows:
 - There are three "integer panels", each with a digit between 1 and 9 (inclusive) printed on it, and one "operator panel" with a + printed on it.
 - The player should construct a formula of the form X + Y, by arranging the four panels from left to right. (The operator panel should not be placed at either end of the formula.)
 - Then, the amount of the allowance will be equal to the resulting value of the formula.
Given the values A, B and C printed on the integer panels used in the game, find the maximum possible amount of the allowance.

-----Constraints-----
 - All values in input are integers.
 - 1 \leq A, B, C \leq 9

-----Input-----
Input is given from Standard Input in the following format:
A B C

-----Output-----
Print the maximum possible amount of the allowance.

-----Sample Input-----
1 5 2

-----Sample Output-----
53

The amount of the allowance will be 53 when the panels are arranged as 52+1, and this is the maximum possible amount.


In some other world, today is the day before Christmas Eve.
Mr. Takaha is buying N items at a department store. The regular price of the i-th item (1 \leq i \leq N) is p_i yen (the currency of Japan).
He has a discount coupon, and can buy one item with the highest price for half the regular price. The remaining N-1 items cost their regular prices. What is the total amount he will pay?

-----Constraints-----
 - 2 \leq N \leq 10
 - 100 \leq p_i \leq 10000
 - p_i is an even number.

-----Input-----
Input is given from Standard Input in the following format:
N
p_1
p_2
:
p_N

-----Output-----
Print the total amount Mr. Takaha will pay.

-----Sample Input-----
3
4980
7980
6980

-----Sample Output-----
15950

The 7980-yen item gets the discount and the total is 4980 + 7980 / 2 + 6980 = 15950 yen.
Note that outputs such as 15950.0 will be judged as Wrong Answer.


The restaurant AtCoder serves the following five dishes:
 - ABC Don (rice bowl): takes A minutes to serve.
 - ARC Curry: takes B minutes to serve.
 - AGC Pasta: takes C minutes to serve.
 - APC Ramen: takes D minutes to serve.
 - ATC Hanbagu (hamburger patty): takes E minutes to serve.
Here, the time to serve a dish is the time between when an order is placed and when the dish is delivered.
This restaurant has the following rules on orders:
 - An order can only be placed at a time that is a multiple of 10 (time 0, 10, 20, ...).
 - Only one dish can be ordered at a time.
 - No new order can be placed when an order is already placed and the dish is still not delivered, but a new order can be placed at the exact time when the dish is delivered.
E869120 arrives at this restaurant at time 0. He will order all five dishes. Find the earliest possible time for the last dish to be delivered.

Here, he can order the dishes in any order he likes, and he can place an order already at time 0.

-----Constraints-----
 - A, B, C, D and E are integers between 1 and 123 (inclusive).

-----Input-----
Input is given from Standard Input in the following format:
A
B
C
D
E

-----Output-----
Print the earliest possible time for the last dish to be delivered, as an integer.

-----Sample Input-----
29
20
7
35
120

-----Sample Output-----
215

If we decide to order the dishes in the order ABC Don, ARC Curry, AGC Pasta, ATC Hanbagu, APC Ramen, the earliest possible time for each order is as follows:
 - Order ABC Don at time 0, which will be delivered at time 29.
 - Order ARC Curry at time 30, which will be delivered at time 50.
 - Order AGC Pasta at time 50, which will be delivered at time 57.
 - Order ATC Hanbagu at time 60, which will be delivered at time 180.
 - Order APC Ramen at time 180, which will be delivered at time 215.
There is no way to order the dishes in which the last dish will be delivered earlier than this.


Given is a sequence of N integers A_1, \ldots, A_N.
Find the (multiplicative) inverse of the sum of the inverses of these numbers, \frac{1}{\frac{1}{A_1} + \ldots + \frac{1}{A_N}}.

-----Constraints-----
 - 1 \leq N \leq 100
 - 1 \leq A_i \leq 1000

-----Input-----
Input is given from Standard Input in the following format:
N
A_1 A_2 \ldots A_N

-----Output-----
Print a decimal number (or an integer) representing the value of \frac{1}{\frac{1}{A_1} + \ldots + \frac{1}{A_N}}.
Your output will be judged correct when its absolute or relative error from the judge's output is at most 10^{-5}.

-----Sample Input-----
2
10 30

-----Sample Output-----
7.5

\frac{1}{\frac{1}{10} + \frac{1}{30}} = \frac{1}{\frac{4}{30}} = \frac{30}{4} = 7.5.
Printing 7.50001, 7.49999, and so on will also be accepted.


In some other world, today is Christmas Eve.
There are N trees planted in Mr. Takaha's garden. The height of the i-th tree (1 \leq i \leq N) is h_i meters.
He decides to choose K trees from these trees and decorate them with electric lights. To make the scenery more beautiful, the heights of the decorated trees should be as close to each other as possible.
More specifically, let the height of the tallest decorated tree be h_{max} meters, and the height of the shortest decorated tree be h_{min} meters. The smaller the value h_{max} - h_{min} is, the better. What is the minimum possible value of h_{max} - h_{min}?

-----Constraints-----
 - 2 \leq K < N \leq 10^5
 - 1 \leq h_i \leq 10^9
 - h_i is an integer.

-----Input-----
Input is given from Standard Input in the following format:
N K
h_1
h_2
:
h_N

-----Output-----
Print the minimum possible value of h_{max} - h_{min}.

-----Sample Input-----
5 3
10
15
11
14
12

-----Sample Output-----
2

If we decorate the first, third and fifth trees, h_{max} = 12, h_{min} = 10 so h_{max} - h_{min} = 2. This is optimal.


An uppercase or lowercase English letter \alpha will be given as input.
If \alpha is uppercase, print A; if it is lowercase, print a.

-----Constraints-----
 - \alpha is an uppercase (A - Z) or lowercase (a - z) English letter.

-----Input-----
Input is given from Standard Input in the following format:
α

-----Output-----
If \alpha is uppercase, print A; if it is lowercase, print a.

-----Sample Input-----
B

-----Sample Output-----
A

B is uppercase, so we should print A.


You are given two integers K and S.

Three variable X, Y and Z takes integer values satisfying 0≤X,Y,Z≤K.

How many different assignments of values to X, Y and Z are there such that X + Y + Z = S?

-----Constraints-----
 - 2≤K≤2500
 - 0≤S≤3K
 - K and S are integers.

-----Input-----
The input is given from Standard Input in the following format:
K S

-----Output-----
Print the number of the triples of X, Y and Z that satisfy the condition.

-----Sample Input-----
2 2

-----Sample Output-----
6

There are six triples of X, Y and Z that satisfy the condition:
 - X = 0, Y = 0, Z = 2
 - X = 0, Y = 2, Z = 0
 - X = 2, Y = 0, Z = 0
 - X = 0, Y = 1, Z = 1
 - X = 1, Y = 0, Z = 1
 - X = 1, Y = 1, Z = 0


You have a digit sequence S of length 4. You are wondering which of the following formats S is in:
 - YYMM format: the last two digits of the year and the two-digit representation of the month (example: 01 for January), concatenated in this order
 - MMYY format: the two-digit representation of the month and the last two digits of the year, concatenated in this order
If S is valid in only YYMM format, print YYMM; if S is valid in only MMYY format, print MMYY; if S is valid in both formats, print AMBIGUOUS; if S is valid in neither format, print NA.

-----Constraints-----
 - S is a digit sequence of length 4.

-----Input-----
Input is given from Standard Input in the following format:
S

-----Output-----
Print the specified string: YYMM, MMYY, AMBIGUOUS or NA.

-----Sample Input-----
1905

-----Sample Output-----
YYMM

May XX19 is a valid date, but 19 is not valid as a month. Thus, this string is only valid in YYMM format.


Find the number of ways to choose a pair of an even number and an odd number from the positive integers between 1 and K (inclusive). The order does not matter.

-----Constraints-----
 - 2\leq K\leq 100
 - K is an integer.

-----Input-----
Input is given from Standard Input in the following format:
K

-----Output-----
Print the number of ways to choose a pair of an even number and an odd number from the positive integers between 1 and K (inclusive).

-----Sample Input-----
3

-----Sample Output-----
2

Two pairs can be chosen: (2,1) and (2,3).


Dolphin loves programming contests. Today, he will take part in a contest in AtCoder.

In this country, 24-hour clock is used. For example, 9:00 p.m. is referred to as "21 o'clock".

The current time is A o'clock, and a contest will begin in exactly B hours.
When will the contest begin? Answer in 24-hour time.

-----Constraints-----
 - 0 \leq A,B \leq 23
 - A and B are integers.

-----Input-----
The input is given from Standard Input in the following format:
A B

-----Output-----
Print the hour of the starting time of the contest in 24-hour time.

-----Sample Input-----
9 12

-----Sample Output-----
21

In this input, the current time is 9 o'clock, and 12 hours later it will be 21 o'clock in 24-hour time.


Takahashi is a member of a programming competition site, ButCoder.
Each member of ButCoder is assigned two values: Inner Rating and Displayed Rating.
The Displayed Rating of a member is equal to their Inner Rating if the member has participated in 10 or more contests. Otherwise, the Displayed Rating will be their Inner Rating minus 100 \times (10 - K) when the member has participated in K contests.
Takahashi has participated in N contests, and his Displayed Rating is R. Find his Inner Rating.

-----Constraints-----
 - All values in input are integers.
 - 1 \leq N \leq 100
 - 0 \leq R \leq 4111

-----Input-----
Input is given from Standard Input in the following format:
N R

-----Output-----
Print his Inner Rating.

-----Sample Input-----
2 2919

-----Sample Output-----
3719

Takahashi has participated in 2 contests, which is less than 10, so his Displayed Rating is his Inner Rating minus 100 \times (10 - 2) = 800.
Thus, Takahashi's Inner Rating is 2919 + 800 = 3719.


Given is an integer N. Find the number of digits that N has in base K.

-----Notes-----
For information on base-K representation, see Positional notation - Wikipedia.

-----Constraints-----
 - All values in input are integers.
 - 1 \leq N \leq 10^9
 - 2 \leq K \leq 10

-----Input-----
Input is given from Standard Input in the following format:
N K

-----Output-----
Print the number of digits that N has in base K.

-----Sample Input-----
11 2

-----Sample Output-----
4

In binary, 11 is represented as 1011.


Takahashi wants to print a document with N pages double-sided, where two pages of data can be printed on one sheet of paper.
At least how many sheets of paper does he need?

-----Constraints-----
 - N is an integer.
 - 1 \leq N \leq 100

-----Input-----
Input is given from Standard Input in the following format:
N

-----Output-----
Print the answer.

-----Sample Input-----
5

-----Sample Output-----
3

By printing the 1-st, 2-nd pages on the 1-st sheet, 3-rd and 4-th pages on the 2-nd sheet, and 5-th page on the 3-rd sheet, we can print all the data on 3 sheets of paper.


E869120's and square1001's 16-th birthday is coming soon.

Takahashi from AtCoder Kingdom gave them a round cake cut into 16 equal fan-shaped pieces.
E869120 and square1001 were just about to eat A and B of those pieces, respectively,

when they found a note attached to the cake saying that "the same person should not take two adjacent pieces of cake".
Can both of them obey the instruction in the note and take desired numbers of pieces of cake?

-----Constraints-----
 - A and B are integers between 1 and 16 (inclusive).
 - A+B is at most 16.

-----Input-----
Input is given from Standard Input in the following format:
A B

-----Output-----
If both E869120 and square1001 can obey the instruction in the note and take desired numbers of pieces of cake, print Yay!; otherwise, print :(.

-----Sample Input-----
5 4

-----Sample Output-----
Yay!

Both of them can take desired number of pieces as follows:


There is a string S consisting of digits 1, 2, ..., 9.
Lunlun, the Dachshund, will take out three consecutive digits from S, treat them as a single integer X and bring it to her master. (She cannot rearrange the digits.)
The master's favorite number is 753. The closer to this number, the better.
What is the minimum possible (absolute) difference between X and 753?

-----Constraints-----
 - S is a string of length between 4 and 10 (inclusive).
 - Each character in S is 1, 2, ..., or 9.

-----Input-----
Input is given from Standard Input in the following format:
S

-----Output-----
Print the minimum possible difference between X and 753.

-----Sample Input-----
1234567876

-----Sample Output-----
34

Taking out the seventh to ninth characters results in X = 787, and the difference between this and 753 is 787 - 753 = 34. The difference cannot be made smaller, no matter where X is taken from.
Note that the digits cannot be rearranged. For example, taking out 567 and rearranging it to 765 is not allowed.
We cannot take out three digits that are not consecutive from S, either. For example, taking out the seventh digit 7, the ninth digit 7 and the tenth digit 6 to obtain 776 is not allowed.


There were $n$ types of swords in the theater basement which had been used during the plays. Moreover there were exactly $x$ swords of each type. $y$ people have broken into the theater basement and each of them has taken exactly $z$ swords of some single type. Note that different people might have taken different types of swords. Note that the values $x, y$ and $z$ are unknown for you.

The next morning the director of the theater discovers the loss. He counts all swords — exactly $a_i$ swords of the $i$-th type are left untouched.

The director has no clue about the initial number of swords of each type in the basement, the number of people who have broken into the basement and how many swords each of them have taken.

For example, if $n=3$, $a = [3, 12, 6]$ then one of the possible situations is $x=12$, $y=5$ and $z=3$. Then the first three people took swords of the first type and the other two people took swords of the third type. Note that you don't know values $x, y$ and $z$ beforehand but know values of $n$ and $a$.

Thus he seeks for your help. Determine the minimum number of people $y$, which could have broken into the theater basement, and the number of swords $z$ each of them has taken.

-----Input-----

The first line of the input contains one integer $n$ $(2 \le n \le 2 \cdot 10^{5})$ — the number of types of swords.

The second line of the input contains the sequence $a_1, a_2, \dots, a_n$ $(0 \le a_i \le 10^{9})$, where $a_i$ equals to the number of swords of the $i$-th type, which have remained in the basement after the theft. It is guaranteed that there exists at least one such pair of indices $(j, k)$ that $a_j \neq a_k$.

-----Output-----

Print two integers $y$ and $z$ — the minimum number of people which could have broken into the basement and the number of swords each of them has taken.

-----Examples-----
Input
3
3 12 6

Output
5 3

Input
2
2 9

Output
1 7

Input
7
2 1000000000 4 6 8 4 2

Output
2999999987 2

Input
6
13 52 0 13 26 52

Output
12 13

-----Note-----

In the first example the minimum value of $y$ equals to $5$, i.e. the minimum number of people who could have broken into the basement, is $5$. Each of them has taken $3$ swords: three of them have taken $3$ swords of the first type, and two others have taken $3$ swords of the third type.

In the second example the minimum value of $y$ is $1$, i.e. the minimum number of people who could have broken into the basement, equals to $1$. He has taken $7$ swords of the first type.


Polycarp wants to train before another programming competition. During the first day of his training he should solve exactly $1$ problem, during the second day — exactly $2$ problems, during the third day — exactly $3$ problems, and so on. During the $k$-th day he should solve $k$ problems.

Polycarp has a list of $n$ contests, the $i$-th contest consists of $a_i$ problems. During each day Polycarp has to choose exactly one of the contests he didn't solve yet and solve it. He solves exactly $k$ problems from this contest. Other problems are discarded from it. If there are no contests consisting of at least $k$ problems that Polycarp didn't solve yet during the $k$-th day, then Polycarp stops his training.

How many days Polycarp can train if he chooses the contests optimally?

-----Input-----

The first line of the input contains one integer $n$ ($1 \le n \le 2 \cdot 10^5$) — the number of contests.

The second line of the input contains $n$ integers $a_1, a_2, \dots, a_n$ ($1 \le a_i \le 2 \cdot 10^5$) — the number of problems in the $i$-th contest.

-----Output-----

Print one integer — the maximum number of days Polycarp can train if he chooses the contests optimally.

-----Examples-----
Input
4
3 1 4 1

Output
3

Input
3
1 1 1

Output
1

Input
5
1 1 1 2 2

Output
2


You are given a forest — an undirected graph with $n$ vertices such that each its connected component is a tree.

The diameter (aka "longest shortest path") of a connected undirected graph is the maximum number of edges in the shortest path between any pair of its vertices.

You task is to add some edges (possibly zero) to the graph so that it becomes a tree and the diameter of the tree is minimal possible.

If there are multiple correct answers, print any of them.

-----Input-----

The first line contains two integers $n$ and $m$ ($1 \le n \le 1000$, $0 \le m \le n - 1$) — the number of vertices of the graph and the number of edges, respectively.

Each of the next $m$ lines contains two integers $v$ and $u$ ($1 \le v, u \le n$, $v \ne u$) — the descriptions of the edges.

It is guaranteed that the given graph is a forest.

-----Output-----

In the first line print the diameter of the resulting tree.

Each of the next $(n - 1) - m$ lines should contain two integers $v$ and $u$ ($1 \le v, u \le n$, $v \ne u$) — the descriptions of the added edges.

The resulting graph should be a tree and its diameter should be minimal possible.

For $m = n - 1$ no edges are added, thus the output consists of a single integer — diameter of the given tree.

If there are multiple correct answers, print any of them.

-----Examples-----
Input
4 2
1 2
2 3

Output
2
4 2

Input
2 0

Output
1
1 2

Input
3 2
1 3
2 3

Output
2

-----Note-----

In the first example adding edges (1, 4) or (3, 4) will lead to a total diameter of 3. Adding edge (2, 4), however, will make it 2.

Edge (1, 2) is the only option you have for the second example. The diameter is 1.

You can't add any edges in the third example. The diameter is already 2.


You are given a tree, which consists of $n$ vertices. Recall that a tree is a connected undirected graph without cycles.  [Image] Example of a tree.

Vertices are numbered from $1$ to $n$. All vertices have weights, the weight of the vertex $v$ is $a_v$.

Recall that the distance between two vertices in the tree is the number of edges on a simple path between them.

Your task is to find the subset of vertices with the maximum total weight (the weight of the subset is the sum of weights of all vertices in it) such that there is no pair of vertices with the distance $k$ or less between them in this subset.

-----Input-----

The first line of the input contains two integers $n$ and $k$ ($1 \le n, k \le 200$) — the number of vertices in the tree and the distance restriction, respectively.

The second line of the input contains $n$ integers $a_1, a_2, \dots, a_n$ ($1 \le a_i \le 10^5$), where $a_i$ is the weight of the vertex $i$.

The next $n - 1$ lines contain edges of the tree. Edge $i$ is denoted by two integers $u_i$ and $v_i$ — the labels 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.

-----Output-----

Print one integer — the maximum total weight of the subset in which all pairs of vertices have distance more than $k$.

-----Examples-----
Input
5 1
1 2 3 4 5
1 2
2 3
3 4
3 5

Output
11

Input
7 2
2 1 2 1 2 1 1
6 4
1 5
3 1
2 3
7 5
7 4

Output
4


There are $n$ dormitories in Berland State University, they are numbered with integers from $1$ to $n$. Each dormitory consists of rooms, there are $a_i$ rooms in $i$-th dormitory. The rooms in $i$-th dormitory are numbered from $1$ to $a_i$.

A postman delivers letters. Sometimes there is no specific dormitory and room number in it on an envelope. Instead of it only a room number among all rooms of all $n$ dormitories is written on an envelope. In this case, assume that all the rooms are numbered from $1$ to $a_1 + a_2 + \dots + a_n$ and the rooms of the first dormitory go first, the rooms of the second dormitory go after them and so on.

For example, in case $n=2$, $a_1=3$ and $a_2=5$ an envelope can have any integer from $1$ to $8$ written on it. If the number $7$ is written on an envelope, it means that the letter should be delivered to the room number $4$ of the second dormitory.

For each of $m$ letters by the room number among all $n$ dormitories, determine the particular dormitory and the room number in a dormitory where this letter should be delivered.

-----Input-----

The first line contains two integers $n$ and $m$ $(1 \le n, m \le 2 \cdot 10^{5})$ — the number of dormitories and the number of letters.

The second line contains a sequence $a_1, a_2, \dots, a_n$ $(1 \le a_i \le 10^{10})$, where $a_i$ equals to the number of rooms in the $i$-th dormitory. The third line contains a sequence $b_1, b_2, \dots, b_m$ $(1 \le b_j \le a_1 + a_2 + \dots + a_n)$, where $b_j$ equals to the room number (among all rooms of all dormitories) for the $j$-th letter. All $b_j$ are given in increasing order.

-----Output-----

Print $m$ lines. For each letter print two integers $f$ and $k$ — the dormitory number $f$ $(1 \le f \le n)$ and the room number $k$ in this dormitory $(1 \le k \le a_f)$ to deliver the letter.

-----Examples-----
Input
3 6
10 15 12
1 9 12 23 26 37

Output
1 1
1 9
2 2
2 13
3 1
3 12

Input
2 3
5 10000000000
5 6 9999999999

Output
1 5
2 1
2 9999999994

-----Note-----

In the first example letters should be delivered in the following order:  the first letter in room $1$ of the first dormitory  the second letter in room $9$ of the first dormitory  the third letter in room $2$ of the second dormitory  the fourth letter in room $13$ of the second dormitory  the fifth letter in room $1$ of the third dormitory  the sixth letter in room $12$ of the third dormitory


Polycarp has guessed three positive integers $a$, $b$ and $c$. He keeps these numbers in secret, but he writes down four numbers on a board in arbitrary order — their pairwise sums (three numbers) and sum of all three numbers (one number). So, there are four numbers on a board in random order: $a+b$, $a+c$, $b+c$ and $a+b+c$.

You have to guess three numbers $a$, $b$ and $c$ using given numbers. Print three guessed integers in any order.

Pay attention that some given numbers $a$, $b$ and $c$ can be equal (it is also possible that $a=b=c$).

-----Input-----

The only line of the input contains four positive integers $x_1, x_2, x_3, x_4$ ($2 \le x_i \le 10^9$) — numbers written on a board in random order. It is guaranteed that the answer exists for the given number $x_1, x_2, x_3, x_4$.

-----Output-----

Print such positive integers $a$, $b$ and $c$ that four numbers written on a board are values $a+b$, $a+c$, $b+c$ and $a+b+c$ written in some order. Print $a$, $b$ and $c$ in any order. If there are several answers, you can print any. It is guaranteed that the answer exists.

-----Examples-----
Input
3 6 5 4

Output
2 1 3

Input
40 40 40 60

Output
20 20 20

Input
201 101 101 200

Output
1 100 100


You have a garland consisting of $n$ lamps. Each lamp is colored red, green or blue. The color of the $i$-th lamp is $s_i$ ('R', 'G' and 'B' — colors of lamps in the garland).

You have to recolor some lamps in this garland (recoloring a lamp means changing its initial color to another) in such a way that the obtained garland is diverse.

A garland is called diverse if any two adjacent (consecutive) lamps (i. e. such lamps that the distance between their positions is $1$) have distinct colors.

In other words, if the obtained garland is $t$ then for each $i$ from $1$ to $n-1$ the condition $t_i \ne t_{i + 1}$ should be satisfied.

Among all ways to recolor the initial garland to make it diverse you have to choose one with the minimum number of recolored lamps. If there are multiple optimal solutions, print any of them.

-----Input-----

The first line of the input contains one integer $n$ ($1 \le n \le 2 \cdot 10^5$) — the number of lamps.

The second line of the input contains the string $s$ consisting of $n$ characters 'R', 'G' and 'B' — colors of lamps in the garland.

-----Output-----

In the first line of the output print one integer $r$ — the minimum number of recolors needed to obtain a diverse garland from the given one.

In the second line of the output print one string $t$ of length $n$ — a diverse garland obtained from the initial one with minimum number of recolors. If there are multiple optimal solutions, print any of them.

-----Examples-----
Input
9
RBGRRBRGG

Output
2
RBGRGBRGR

Input
8
BBBGBRRR

Output
2
BRBGBRGR

Input
13
BBRRRRGGGGGRR

Output
6
BGRBRBGBGBGRG


You are given an integer array of length $n$.

You have to choose some subsequence of this array of maximum length such that this subsequence forms a increasing sequence of consecutive integers. In other words the required sequence should be equal to $[x, x + 1, \dots, x + k - 1]$ for some value $x$ and length $k$.

Subsequence of an array can be obtained by erasing some (possibly zero) elements from the array. You can erase any elements, not necessarily going successively. The remaining elements preserve their order. For example, for the array $[5, 3, 1, 2, 4]$ the following arrays are subsequences: $[3]$, $[5, 3, 1, 2, 4]$, $[5, 1, 4]$, but the array $[1, 3]$ is not.

-----Input-----

The first line of the input containing integer number $n$ ($1 \le n \le 2 \cdot 10^5$) — the length of the array. The second line of the input containing $n$ integer numbers $a_1, a_2, \dots, a_n$ ($1 \le a_i \le 10^9$) — the array itself.

-----Output-----

On the first line print $k$ — the maximum length of the subsequence of the given array that forms an increasing sequence of consecutive integers.

On the second line print the sequence of the indices of the any maximum length subsequence of the given array that forms an increasing sequence of consecutive integers.

-----Examples-----
Input
7
3 3 4 7 5 6 8

Output
4
2 3 5 6

Input
6
1 3 5 2 4 6

Output
2
1 4

Input
4
10 9 8 7

Output
1
1

Input
9
6 7 8 3 4 5 9 10 11

Output
6
1 2 3 7 8 9

-----Note-----

All valid answers for the first example (as sequences of indices):   $[1, 3, 5, 6]$  $[2, 3, 5, 6]$

All valid answers for the second example:   $[1, 4]$  $[2, 5]$  $[3, 6]$

All valid answers for the third example:   $[1]$  $[2]$  $[3]$  $[4]$

All valid answers for the fourth example:   $[1, 2, 3, 7, 8, 9]$


You are given integers A and B, each between 1 and 3 (inclusive).
Determine if there is an integer C between 1 and 3 (inclusive) such that A \times B \times C is an odd number.

-----Constraints-----
 - All values in input are integers.
 - 1 \leq A, B \leq 3

-----Input-----
Input is given from Standard Input in the following format:
A B

-----Output-----
If there is an integer C between 1 and 3 that satisfies the condition, print Yes; otherwise, print No.

-----Sample Input-----
3 1

-----Sample Output-----
Yes

Let C = 3. Then, A \times B \times C = 3 \times 1 \times 3 = 9, which is an odd number.


There is a train going from Station A to Station B that costs X yen (the currency of Japan).
Also, there is a bus going from Station B to Station C that costs Y yen.
Joisino got a special ticket. With this ticket, she can take the bus for half the fare if she travels from Station A to Station B by train and then travels from Station B to Station C by bus.
How much does it cost to travel from Station A to Station C if she uses this ticket?

-----Constraints-----
 - 1 \leq X,Y \leq 100
 - Y is an even number.
 - All values in input are integers.

-----Input-----
Input is given from Standard Input in the following format:
X Y

-----Output-----
If it costs x yen to travel from Station A to Station C, print x.

-----Sample Input-----
81 58

-----Sample Output-----
110

 - The train fare is 81 yen.
 - The train fare is 58 ⁄ 2=29 yen with the 50% discount.
Thus, it costs 110 yen to travel from Station A to Station C.


Takahashi is going to set a 3-character password.
How many possible passwords are there if each of its characters must be a digit between 1 and N (inclusive)?

-----Constraints-----
 - 1 \leq N \leq 9
 - N is an integer.

-----Input-----
Input is given from Standard Input in the following format:
N

-----Output-----
Print the number of possible passwords.

-----Sample Input-----
2

-----Sample Output-----
8

There are eight possible passwords: 111, 112, 121, 122, 211, 212, 221, and 222.


Shichi-Go-San (literally "Seven-Five-Three") is a traditional event in a certain country to celebrate the growth of seven-, five- and three-year-old children.
Takahashi is now X years old. Will his growth be celebrated in Shichi-Go-San this time?

-----Constraints-----
 - 1 ≤ X ≤ 9
 - X is an integer.

-----Input-----
Input is given from Standard Input in the following format:
X

-----Output-----
If Takahashi's growth will be celebrated, print YES; if it will not, print NO.

-----Sample Input-----
5

-----Sample Output-----
YES

The growth of a five-year-old child will be celebrated.


Decades have passed since the beginning of AtCoder Beginner Contest.
The contests are labeled as ABC001, ABC002, ... from the first round, but after the 999-th round ABC999, a problem occurred: how the future rounds should be labeled?
In the end, the labels for the rounds from the 1000-th to the 1998-th are decided: ABD001, ABD002, ..., ABD999.
You are given an integer N between 1 and 1998 (inclusive). Print the first three characters of the label of the N-th round of AtCoder Beginner Contest.

-----Constraints-----
 - 1 \leq N \leq 1998
 - N is an integer.

-----Input-----
Input is given from Standard Input in the following format:
N

-----Output-----
Print the first three characters of the label of the N-th round of AtCoder Beginner Contest.

-----Sample Input-----
999

-----Sample Output-----
ABC

The 999-th round of AtCoder Beginner Contest is labeled as ABC999.


In AtCoder city, there are five antennas standing in a straight line. They are called Antenna A, B, C, D and E from west to east, and their coordinates are a, b, c, d and e, respectively.

Two antennas can communicate directly if the distance between them is k or less, and they cannot if the distance is greater than k.

Determine if there exists a pair of antennas that cannot communicate directly.

Here, assume that the distance between two antennas at coordinates p and q (p < q) is q - p.

-----Constraints-----
 - a, b, c, d, e and k are integers between 0 and 123 (inclusive).
 - a < b < c < d < e

-----Input-----
Input is given from Standard Input in the following format:
a
b
c
d
e
k

-----Output-----
Print :( if there exists a pair of antennas that cannot communicate directly, and print Yay! if there is no such pair.

-----Sample Input-----
1
2
4
8
9
15

-----Sample Output-----
Yay!

In this case, there is no pair of antennas that cannot communicate directly, because:
 - the distance between A and B is 2 - 1 = 1
 - the distance between A and C is 4 - 1 = 3
 - the distance between A and D is 8 - 1 = 7
 - the distance between A and E is 9 - 1 = 8
 - the distance between B and C is 4 - 2 = 2
 - the distance between B and D is 8 - 2 = 6
 - the distance between B and E is 9 - 2 = 7
 - the distance between C and D is 8 - 4 = 4
 - the distance between C and E is 9 - 4 = 5
 - the distance between D and E is 9 - 8 = 1
and none of them is greater than 15. Thus, the correct output is Yay!.


You will be given an integer a and a string s consisting of lowercase English letters as input.
Write a program that prints s if a is not less than 3200 and prints red if a is less than 3200.

-----Constraints-----
 - 2800 \leq a < 5000
 - s is a string of length between 1 and 10 (inclusive).
 - Each character of s is a lowercase English letter.

-----Input-----
Input is given from Standard Input in the following format:
a
s

-----Output-----
If a is not less than 3200, print s; if a is less than 3200, print red.

-----Sample Input-----
3200
pink

-----Sample Output-----
pink

a = 3200 is not less than 3200, so we print s = pink.


A programming competition site AtCode regularly holds programming contests.
The next contest on AtCode is called ABC, which is rated for contestants with ratings less than 1200.
The contest after the ABC is called ARC, which is rated for contestants with ratings less than 2800.
The contest after the ARC is called AGC, which is rated for all contestants.
Takahashi's rating on AtCode is R. What is the next contest rated for him?

-----Constraints-----
 - 0 ≤ R ≤ 4208
 - R is an integer.

-----Input-----
Input is given from Standard Input in the following format:
R

-----Output-----
Print the name of the next contest rated for Takahashi (ABC, ARC or AGC).

-----Sample Input-----
1199

-----Sample Output-----
ABC

1199 is less than 1200, so ABC will be rated.


Cat Snuke is learning to write characters.
Today, he practiced writing digits 1 and 9, but he did it the other way around.
You are given a three-digit integer n written by Snuke.
Print the integer obtained by replacing each digit 1 with 9 and each digit 9 with 1 in n.

-----Constraints-----
 - 111 \leq n \leq 999
 - n is an integer consisting of digits 1 and 9.

-----Input-----
Input is given from Standard Input in the following format:
n

-----Output-----
Print the integer obtained by replacing each occurrence of 1 with 9 and each occurrence of 9 with 1 in n.

-----Sample Input-----
119

-----Sample Output-----
991

Replace the 9 in the ones place with 1, the 1 in the tens place with 9 and the 1 in the hundreds place with 9. The answer is 991.


Alice guesses the strings that Bob made for her.

At first, Bob came up with the secret string $a$ consisting of lowercase English letters. The string $a$ has a length of $2$ or more characters. Then, from string $a$ he builds a new string $b$ and offers Alice the string $b$ so that she can guess the string $a$.

Bob builds $b$ from $a$ as follows: he writes all the substrings of length $2$ of the string $a$ in the order from left to right, and then joins them in the same order into the string $b$.

For example, if Bob came up with the string $a$="abac", then all the substrings of length $2$ of the string $a$ are: "ab", "ba", "ac". Therefore, the string $b$="abbaac".

You are given the string $b$. Help Alice to guess the string $a$ that Bob came up with. It is guaranteed that $b$ was built according to the algorithm given above. It can be proved that the answer to the problem is unique.

-----Input-----

The first line contains a single positive integer $t$ ($1 \le t \le 1000$) — the number of test cases in the test. Then $t$ test cases follow.

Each test case consists of one line in which the string $b$ is written, consisting of lowercase English letters ($2 \le |b| \le 100$) — the string Bob came up with, where $|b|$ is the length of the string $b$. It is guaranteed that $b$ was built according to the algorithm given above.

-----Output-----

Output $t$ answers to test cases. Each answer is the secret string $a$, consisting of lowercase English letters, that Bob came up with.

-----Example-----
Input
4
abbaac
ac
bccddaaf
zzzzzzzzzz

Output
abac
ac
bcdaf
zzzzzz

-----Note-----

The first test case is explained in the statement.

In the second test case, Bob came up with the string $a$="ac", the string $a$ has a length $2$, so the string $b$ is equal to the string $a$.

In the third test case, Bob came up with the string $a$="bcdaf", substrings of length $2$ of string $a$ are: "bc", "cd", "da", "af", so the string $b$="bccddaaf".


You are given two positive integers $a$ and $b$. In one move you can increase $a$ by $1$ (replace $a$ with $a+1$). Your task is to find the minimum number of moves you need to do in order to make $a$ divisible by $b$. It is possible, that you have to make $0$ moves, as $a$ is already divisible by $b$. You have to answer $t$ independent test cases.

-----Input-----

The first line of the input contains one integer $t$ ($1 \le t \le 10^4$) — the number of test cases. Then $t$ test cases follow.

The only line of the test case contains two integers $a$ and $b$ ($1 \le a, b \le 10^9$).

-----Output-----

For each test case print the answer — the minimum number of moves you need to do in order to make $a$ divisible by $b$.

-----Example-----
Input
5
10 4
13 9
100 13
123 456
92 46

Output
2
5
4
333
0


The heat during the last few days has been really intense. Scientists from all over the Berland study how the temperatures and weather change, and they claim that this summer is abnormally hot. But any scientific claim sounds a lot more reasonable if there are some numbers involved, so they have decided to actually calculate some value which would represent how high the temperatures are.

Mathematicians of Berland State University came up with a special heat intensity value. This value is calculated as follows:

Suppose we want to analyze the segment of $n$ consecutive days. We have measured the temperatures during these $n$ days; the temperature during $i$-th day equals $a_i$.

We denote the average temperature of a segment of some consecutive days as the arithmetic mean of the temperature measures during this segment of days. So, if we want to analyze the average temperature from day $x$ to day $y$, we calculate it as $\frac{\sum \limits_{i = x}^{y} a_i}{y - x + 1}$ (note that division is performed without any rounding). The heat intensity value is the maximum of average temperatures over all segments of not less than $k$ consecutive days. For example, if analyzing the measures $[3, 4, 1, 2]$ and $k = 3$, we are interested in segments $[3, 4, 1]$, $[4, 1, 2]$ and $[3, 4, 1, 2]$ (we want to find the maximum value of average temperature over these segments).

You have been hired by Berland State University to write a program that would compute the heat intensity value of a given period of days. Are you up to this task?

-----Input-----

The first line contains two integers $n$ and $k$ ($1 \le k \le n \le 5000$) — the number of days in the given period, and the minimum number of days in a segment we consider when calculating heat intensity value, respectively.

The second line contains $n$ integers $a_1$, $a_2$, ..., $a_n$ ($1 \le a_i \le 5000$) — the temperature measures during given $n$ days.

-----Output-----

Print one real number — the heat intensity value, i. e., the maximum of average temperatures over all segments of not less than $k$ consecutive days.

Your answer will be considered correct if the following condition holds: $|res - res_0| < 10^{-6}$, where $res$ is your answer, and $res_0$ is the answer given by the jury's solution.

-----Example-----
Input
4 3
3 4 1 2

Output
2.666666666666667