One sunny day, Dick T. Mustang found an ancient personal computer in the closet. He brought it back to his room and turned it on with a sense of nostalgia, seeing a message coming on the screen:

READY?

Yes. BASIC.

BASIC is a programming language designed for beginners, and was widely used from 1980's to 1990's. There have been quite a few BASIC dialects. Some of them provide the PLAY statement, which plays music when called with a string of a musical score written in Music Macro Language (MML). Dick found this statement is available on his computer and accepts the following commands in MML:

Notes: Cn, C+n, C-n, Dn, D+n, D-n, En,...,... (n = 1,2,4,8,16,32,64,128 + dots)

Each note command consists of a musical note followed by a duration specifier.

Each musical note is one of the seven basic notes: 'C', 'D', 'E', 'F', 'G', 'A', and 'B'. It can be followed by either '+' (indicating a sharp) or '-' (a flat). The notes 'C' through 'B' form an octave as depicted in the figure below. The octave for each command is determined by the current octave, which is set by the octave commands as described later. It is not possible to play the note 'C-' of the lowest octave (1) nor the note 'B+' of the highest octave (8).

Each duration specifier is basically one of the following numbers: '1', '2', '4', '8', '16', '32', '64', and '128', where '1' denotes a whole note, '2' a half note, '4' a quarter note, '8' an eighth note, and so on. This specifier is optional; when omitted, the duration will be the default one set by the L command (which is described below). In addition, duration specifiers can contain dots next to the numbers. A dot adds the half duration of the basic note. For example, '4.' denotes the duration of '4' (a quarter) plus '8' (an eighth, i.e. half of a quarter), or as 1.5 times long as '4'. It is possible that a single note has more than one dot, where each extra dot extends the duration by half of the previous one. For example, '4..' denotes the duration of '4' plus '8' plus '16', '4...' denotes the duration of '4' plus '8' plus '16' plus '32', and so on. The duration extended by dots cannot be shorter than that of '128' due to limitation of Dick's computer; therefore neither '128.' nor '32...' will be accepted. The dots specified without the numbers extend the default duration. For example, 'C.' is equivalent to 'C4.' when the default duration is '4'. Note that 'C4C8' and 'C4.' are unequivalent; the former contains two distinct notes, while the latter just one note.

Rest: Rn (n = 1,2,4,8,16,32,64,128 + dots)

The R command rests for the specified duration. The duration should be specified in the same way as the note commands, and it can be omitted, too. Note that 'R4R8' and 'R4.' are equivalent, unlike 'C4C8' and 'C4.', since the both rest for the same duration of '4' plus '8'.

Octave: On (n = 1-8), <, >

The O command sets the current octave to the specified number. '>' raises one octave up, and '<' drops one down. It is not allowed to set the octave beyond the range from 1 to 8 by these commands. The octave is initially set to 4.

Default duration: Ln (n = 1,2,4,8,16,32,64,128)

The L command sets the default duration. The duration should be specified in the same way as the note commands, but cannot be omitted nor followed by dots. The default duration is initially set to 4.

Volume: Vn (n = 1-255)

The V command sets the current volume. Larger is louder. The volume is initially set to 100.

<image>

As an amateur composer, Dick decided to play his pieces of music by the PLAY statement. He managed to write a program with a long MML sequence, and attempted to run the program to play his music -- but unfortunately he encountered an unexpected error: the MML sequence was too long to be handled in his computer's small memory!

Since he didn't want to give up all the efforts he had made to use the PLAY statement, he decided immediately to make the MML sequence shorter so that it fits in the small memory. It was too hard for him, though. So he asked you to write a program that, for each given MML sequence, prints the shortest MML sequence (i.e. MML sequence containing minimum number of characters) that expresses the same music as the given one. Note that the final values of octave, volume, and default duration can be differrent from the original MML sequence.

Input

The input consists of multiple data sets. Each data set is given by a single line that contains an MML sequence up to 100,000 characters. All sequences only contain the commands described above. Note that each sequence contains at least one note, and there is no rest before the first note and after the last note.

The end of input is indicated by a line that only contains "*". This is not part of any data sets and hence should not be processed.

Output

For each test case, print its case number and the shortest MML sequence on a line.

If there are multiple solutions, print any of them.

Example

Input

C4C4G4G4A4A4G2F4F4E4E4D4D4C2
O4C4.C8F4.F8G8F8E8D8C2
B-8>C8<B-8V40R2R..R8.V100EV50L1CG
*

Output

Case 1: CCGGAAG2FFEEDDC2
Case 2: C.C8F.L8FGFEDC2
Case 3: L8B-B+B-RL1RE4V50CG


Problem Statement

"Everlasting -One-" is an award-winning online game launched this year. This game has rapidly become famous for its large number of characters you can play.

In this game, a character is characterized by attributes. There are $N$ attributes in this game, numbered $1$ through $N$. Each attribute takes one of the two states, light or darkness. It means there are $2^N$ kinds of characters in this game.

You can change your character by job change. Although this is the only way to change your character's attributes, it is allowed to change jobs as many times as you want.

The rule of job change is a bit complex. It is possible to change a character from $A$ to $B$ if and only if there exist two attributes $a$ and $b$ such that they satisfy the following four conditions:

* The state of attribute $a$ of character $A$ is light.

* The state of attribute $b$ of character $B$ is light.

* There exists no attribute $c$ such that both characters $A$ and $B$ have the light state of attribute $c$.

* A pair of attribute $(a, b)$ is compatible.

Here, we say a pair of attribute $(a, b)$ is compatible if there exists a sequence of attributes $c_1, c_2, \ldots, c_n$ satisfying the following three conditions:

* $c_1 = a$.

* $c_n = b$.

* Either $(c_i, c_{i+1})$ or $(c_{i+1}, c_i)$ is a special pair for all $i = 1, 2, \ldots, n-1$. You will be given the list of special pairs.

Since you love this game with enthusiasm, you are trying to play the game with all characters (it's really crazy). However, you have immediately noticed that one character can be changed to a limited set of characters with this game's job change rule. We say character $A$ and $B$ are essentially different if you cannot change character $A$ into character $B$ by repeating job changes.

Then, the following natural question arises; how many essentially different characters are there? Since the output may be very large, you should calculate the answer modulo $1{,}000{,}000{,}007$.

Input

The input is a sequence of datasets. The number of datasets is not more than $50$ and the total size of input is less than $5$ MB.

Each dataset is formatted as follows.

> $N$ $M$
> $a_1$ $b_1$
> :
> :
> $a_M$ $b_M$

The first line of each dataset contains two integers $N$ and $M$ ($1 \le N \le 10^5$ and $0 \le M \le 10^5$). Then $M$ lines follow. The $i$-th line contains two integers $a_i$ and $b_i$ ($1 \le a_i \lt b_i \le N$) which denote the $i$-th special pair. The input is terminated by two zeroes.

It is guaranteed that $(a_i, b_i) \ne (a_j, b_j)$ if $i \ne j$.

Output

For each dataset, output the number of essentially different characters modulo $1{,}000{,}000{,}007$.

Sample Input

3 2
1 2
2 3
5 0
100000 0
0 0

Output for the Sample Input

3
32
607723520

Example

Input

3 2
1 2
2 3
5 0
100000 0
0 0

Output

3
32
607723520


Example

Input

2 2 2 1
0 0 0

Output

24


The JAG Kingdom consists of $N$ cities and $M$ bidirectional roads. The $i$-th road ($u_i, v_i, c_i$) connects the city $u_i$ and the city $v_i$ with the length $c_i$. One day, you, a citizen of the JAG Kingdom, decided to go to the city $T$ from the city $S$. However, you know that one of the roads in the JAG Kingdom is currently under construction and you cannot pass the road. You don't know which road it is. You can know whether a road is under construction only when you are in either city connected by the road.

Your task is to minimize the total length of the route in the worst case. You don't need to decide a route in advance of departure and you can choose where to go next at any time. If you cannot reach the city $T$ in the worst case, output '-1'.

Input

The input consists of a single test case formatted as follows.

$N$ $M$ $S$ $T$
$u_1$ $v_1$ $c_1$
:
$u_M$ $v_M$ $c_M$

The first line contains four integers $N, M, S,$ and $T$, where $N$ is the number of the cities ($2 \leq N \leq 100,000$), $M$ is the number of the bidirectional roads ($1 \leq M \leq 200,000$), $S$ is the city you start from ($1 \leq S \leq N$), and $T$ is the city you want to reach to ($1 \leq T \leq N, S \ne T$). The following $M$ lines represent road information: the $i$-th line of the $M$ lines consists of three integers $u_i, v_i, c_i,$ which means the $i$-th road connects the cities $u_i$ and $v_i$ ($1 \leq u_i, v_i \leq N, u_i \ne v_i$) with the length $c_i$ ($1 \leq c_i \leq 10^9$). You can assume that all the pairs of the cities are connected if no road is under construction. That is, there is at least one route from city $x$ to city $y$ with given roads, for all cities $x$ and $y$. It is also guaranteed that there are no multiple-edges, i.e., $\\{u_i,v_i\\} \ne \\{u_j,v_j\\}$ for all $1 \leq i < j \leq M$.

Output

Output the minimum total length of the route in the worst case. If you cannot reach the city $T$ in the worst case, output '-1'.

Examples

Input

3 3 1 3
1 2 1
2 3 5
1 3 3

Output

6

Input

4 4 1 4
1 2 1
2 4 1
1 3 1
3 4 1

Output

4

Input

5 4 4 1
1 2 3
2 3 4
3 4 5
4 5 6

Output

-1


Problem

You bought a tree-shaped lighting fixture called a tree light.

This luminaire has n contacts, each numbered from 0 to n-1. Each contact consists of a light bulb that can express 10 levels of brightness and a device for switching the state of the light bulb. Initially, the brightness of the bulbs at all contacts is zero.

In addition, there is a cable wire between the contacts. All contacts are connected by n-1 cable lines and are hung with contact 0 facing up. Here, a set of contacts connected to the contact i via zero or more cable wires downward from the contact i is called a subtree rooted at the contact i.

You take one of the following actions with respect to this luminaire:

* count (r, x, y): Counts the number of light bulbs with a brightness of x or more and y or less among the light bulbs of the contact contained in the subtree rooted at the contact r.
* change (r, x, y): Change the brightness of all the bulbs of the contacts contained in the subtree rooted at the contact r to y, whose brightness is exactly x.

Since q actions are given, output the number of light bulbs at that time each time count (r, x, y) is given.

Constraints

* 1 ≤ n ≤ 105
* 1 ≤ q ≤ 105
* 0 ≤ ui, vi, ri ≤ n−1 (ui ≠ vi)
* 0 ≤ xi, yi ≤ 9 (when ti = 1 xi ≤ yi)

Input

The input is given in the following format.

n q
u1 v1
u2 v2
...
un−1 vn−1
t1 r1 x1 y1
t2 r2 x2 y2
...
tq rq xq yq

The number of contacts n that make up the tree light and the number of actions you take q are given on the first line, separated by blanks.
Cable line information is given on the following n-1 line, separated by blanks. The information of the i-th cable line indicates that the cable line i connects the contact ui and the contact vi with the contact ui facing up.
n & plus; The actions you take are given in the q lines after the first line, separated by blanks. If ti = 1, it represents count (ri, xi, yi), and if ti = 2, it represents change (ri, xi, yi).

Output

For each count (ri, xi, yi), output the answer on one line.

Examples

Input

7 5
0 1
1 2
1 3
0 4
4 5
4 6
1 0 0 9
2 0 0 5
2 1 5 8
1 0 5 8
1 0 8 8

Output

7
7
3

Input

7 5
0 1
1 2
2 3
0 4
4 5
5 6
2 1 0 5
2 4 0 6
2 3 5 6
2 5 6 5
1 0 0 5

Output

5


The goal of the 15 puzzle problem is to complete pieces on $4 \times 4$ cells where one of the cells is empty space.

In this problem, the space is represented by 0 and pieces are represented by integers from 1 to 15 as shown below.

1 2 3 4
6 7 8 0
5 10 11 12
9 13 14 15

You can move a piece toward the empty space at one step. Your goal is to make the pieces the following configuration in the shortest move (fewest steps).

1 2 3 4
5 6 7 8
9 10 11 12
13 14 15 0

Write a program which reads an initial state of the puzzle and prints the fewest steps to solve the puzzle.

Constraints

* The given puzzle is solvable in at most 45 steps.

Input

The $4 \times 4$ integers denoting the pieces or space are given.

Output

Print the fewest steps in a line.

Example

Input

1 2 3 4
6 7 8 0
5 10 11 12
9 13 14 15

Output

8


Write a program which reads three integers a, b and c, and prints "Yes" if a < b < c, otherwise "No".

Constraints

* 0 ≤ a, b, c ≤ 100

Input

Three integers a, b and c separated by a single space are given in a line.

Output

Print "Yes" or "No" in a line.

Examples

Input

1 3 8

Output

Yes

Input

3 8 1

Output

No


Chef loves to prepare delicious dishes. This time, Chef has decided to prepare a special dish for you, and needs to gather several apples to do so.
Chef has N apple trees in his home garden. Each tree has a certain (non-zero) number of apples on it. In order to create his dish, Chef wants to pluck every apple from every tree.
Chef has an unusual method of collecting apples. In a single minute, he can perform the following task:

Pick any subset of trees such that every tree in the subset has the same number of apples.
From each tree in the subset, pluck any number of apples, as long as the number of apples left on the tree equals the number of apples on a tree not in the subset.

If all trees have the same number of apples left, Chef can pluck all of the apples remaining in a single minute.
Chef does not want to keep you waiting, so wants to achieve this task in the minimum possible time. Can you tell him what the minimum time required is?

Input
The first line of the input contains a single integer T denoting the number of test cases. This will be followed by T test cases. The first line of each test case contains a single integer N denoting the number of apple trees in Chef's garden. The next line of each test case contains N space separated integers denoting the number of apples on each tree.

Output
For each of the T test cases, output a single line - the minimum time to pluck all apples from all trees.

Constraints

1 <= T <= 10
1 <= N <= 10^5
1 <= Number of apples on a tree <= 10^5

Scoring

Example

Input
2
3
3 3 3
4
1 2 3 3

Output
1
3

Explanation
For test 1, Chef can select all the trees and can pluck all the apples in 1 minute.
For test 2, there are many ways Chef can pluck all of the apples in 3 minutes. Here is one example:

First minute: Select the third and fourth trees. Pluck 1 apple from the third tree, and 2 apples from the fourth tree.
Second minute: Select the second and third tree. Pluck 1 apple from each tree.
Third minute: Select all of the trees and pluck the last apple from each tree.


Aman has a hardware store in Una. One day when he went down to the store room to fetch a box of nails. He found that the price tag had faded out. The first and the last digits of the price were not readable. Although, the number of nails in the box could be read clearly. The box read,
72 nails, Rs. _679_

What were the two faded digits, and what was the price of one nail?

Aman’s friend Arnab has great knowledge of computer programming. So Aman approached him.  He wants him write a program that solves the general version of the above problem:

N nails, Rs. _XYZ_

The total number of nails, N, is between 1 and 99, including both. The total price originally consisted of five digits, but we can see only the three digits in the middle. We assume that the first digit is nonzero, that the price of one nail is an integer number of rupees, and that all the nails cost the same price. Given N, X, Y, and Z, write a program that guesses the two faded digits and the original price. In case that there is more than one candidate for the original price, the output should be the most expensive one. That is, the program is to report the two faded digits and the maximum price per nail for the nails

Input
The input consists of T test cases. The number of test cases ( T ) is given on the first line of the input file. The first line of each test case contains an integer N (0 < N < 100), which represents the number of nails. In the following line, there are the three decimal digits X, Y, and Z, separated by a space, of the original price $_XYZ_.

Output
For each test case, your program has to do the following. For a test case, there may be more than one candidate for the original price or there is none. In the latter case your program is to report 0. therwise, if there is more than one candidate for the original price, the program is to report the two faded digits and the maximum price per turkey for the turkeys. The following shows sample input and output for three test cases.

Example

Input:
3
72
6 7 9
5
2 3 7
78
0 0 5

Output:
3 2 511
9 5 18475
0


The Government of Greedistan has just found out that there is a lot of gold beneath some land area in their country. They quickly surveyed the land area and found that some people are living there, and surprisingly the houses are organized in a M x N grid, each cell having exactly one house.
To acquire all the gold beneath this area, the government has planned to make up a rumor ( a volcano is about to erupt near by ) and let the people vacate their houses themselves. They start the rumor at only one house on day 1. It takes exactly one day for the rumor to spread from a house to any of its neighbors ( top, left, bottom, right ). They all vacate their houses as soon as they know about the volcano.
 The government wants to choose the starting house for the rumor in such a way that it takes minimum number of days for all the people to vacate their houses. Find this minimum time.

Input
The first line contains T, the number of test cases. Each of the next T lines contain two integers M and N. If one of M or N is zero, other one will also be zero, and this means, there are no houses at all.

T ≤ 1,000
0 ≤ M ≤ 1,000,000
0 ≤ N ≤ 1,000,000

Output
 The minimum number of days it takes to spread the rumor to all houses.

Example

Input:
2
1 5
3 4

Output:
3
4

Explanation:
Case 1 : Starting cell (1,3)
Case 2 : See the following table with a possible answer, each cell has the first day in which they hear the rumor.

 3234
 2123
 3234


You are given two integer arrays A and B each of size N. Let us define interaction of arrays A and B to be the sum of A[i] * B[i] for each i from 1 to N.

You want to maximize the value of interaction of the arrays. You are allowed to make at most K (possibly zero) operations of following kind.

In a single operation, you can increase or decrease any of the elements of array A by 1.

Find out the maximum value of interaction of the arrays that you can get.

Input

The first line of input contains a single integer T denoting number of test cases.
For each test case:

First line contains two space separated integers N, K.
Second line contains N space separated integers denoting array A.
Third line contains N space separated integers denoting array B.

Output

For each test case, output a single integer denoting the answer of the problem.

Constraints

1 ≤ T ≤ 10
1 ≤ N ≤ 10^5
0 ≤ |A[i]|, |B[i]| ≤ 10^5
0 ≤ K ≤ 10^9

Example
Input:
2
2 2
1 2
-2 3
3 5
1 2 -3
-2 3 -5

Output:
10
44

Explanation
In the first example,
you can increase value A[2] using two two operations. Now, A would be [1, 4]. The value of interaction will be 1 * -2 + 4 * 3 = -2 + 12 = 10.


In a museum there is an empty wall. We can imagine this wall as a triangle on a coordinate plane with vertices (0; 0), (N; 0), (N; N * A / B), where N, A, B are some positive integers.

The space has been allotted to a photographer who wants his masterpiece on that wall. He is confused with the size of the photo frame and wants you to decide the number of ways in which he can fix a rectangular frame on that triangular wall.

Input

The first line contains a single positive integer T ≤ 100, the number of test cases. T test cases follow. The only line of each test case contains three positive integers N, A, B where N,A,B ≤ 50

Output

For each test case, output a single line containing the number of ways in which a rectangular region can be selected on the wall.

Example

Input:
2
4 2 3
4 5 4

Output:
5
15

Explanation
In the first case we calculate the number of rectangles which lie in triangle with vertices (0; 0), (4; 0), (4; 8/3). There exist 5 such rectangles. Among them 3 have size 1 x 1. One has size 2 x 1 and one have size 1 x 2.


Sridhar was a seasoned traveler. He liked to visit new places. More than all he was a meticulous planner. This time he was planning to visit Europe. He wrote down his travel itinerary like as follows:

If he wanted to visit Madrid, Paris, Munich, Warsaw and Kiev in this order, he would write it down like as:

Madrid Paris 100$
Paris Munich 200$
Munich Warsaw 150$
Warsaw Kiev 120$

More formally, if he wanted to go from A to B directly and the price is C dollars, then he would write

A B C$

on a card.
Each move was written on a different card. Sridhar was a great planner, so he would never visit the same place twice. Just before starting his journey, the cards got shuffled. Help Sridhar figure out the actual order of the cards and the total cost of his journey.

Input

The first line of the input contains an integer T, the number of test cases. T test cases follow. Each case contains an integer N, the number of cities Sridhar is planning to visit. N-1 lines follow. Each line is of the form

Ai Bi Ci$

where the i-th line refers to the i-th card after getting shuffled.

Output

For each case the output contains N lines, the first N-1 lines should contain the N-1 cards in their proper original order, the N-th line should contain the total cost of the travel.
See Example for detailed format.

Constraints

1 ≤ T ≤ 10
1 ≤ N ≤ 5000
1 ≤ length of Ai ≤ 50
1 ≤ length of Bi ≤ 50
1 ≤ Ci ≤ 1000
Ai, Bi will contain only lowercase and uppercase latin characters, no two cities will have same names.
The names of cities are case-sensitive. So "warsaw" and "Warsaw" should be considered as different cities.

Example

Input
1
5
Warsaw Kiev 120$
Madrid Paris 100$
Munich Warsaw 150$
Paris Munich 200$

Output
Madrid Paris 100$
Paris Munich 200$
Munich Warsaw 150$
Warsaw Kiev 120$
570$


You are given a bracket sequence s (not necessarily a regular one). A bracket sequence is a string containing only characters '(' and ')'.

A regular bracket sequence is a bracket sequence that can be transformed into a correct arithmetic expression by inserting characters '1' and '+' between the original characters of the sequence. For example, bracket sequences "()()" and "(())" are regular (the resulting expressions are: "(1)+(1)" and "((1+1)+1)"), and ")(", "(" and ")" are not.

Your problem is to calculate the number of regular bracket sequences of length 2n containing the given bracket sequence s as a substring (consecutive sequence of characters) modulo 10^9+7 (1000000007).

Input

The first line of the input contains one integer n (1 ≤ n ≤ 100) — the half-length of the resulting regular bracket sequences (the resulting sequences must have length equal to 2n).

The second line of the input contains one string s (1 ≤ |s| ≤ 200) — the string s that should be a substring in each of the resulting regular bracket sequences (|s| is the length of s).

Output

Print only one integer — the number of regular bracket sequences containing the given bracket sequence s as a substring. Since this number can be huge, print it modulo 10^9+7 (1000000007).

Examples

Input

5
()))()

Output

5

Input

3
(()

Output

4

Input

2
(((

Output

0

Note

All regular bracket sequences satisfying the conditions above for the first example:

  * "(((()))())";
  * "((()()))()";
  * "((()))()()";
  * "(()(()))()";
  * "()((()))()".

All regular bracket sequences satisfying the conditions above for the second example:

  * "((()))";
  * "(()())";
  * "(())()";
  * "()(())".

And there is no regular bracket sequences of length 4 containing "(((" as a substring in the third example.


While some people enjoy spending their time solving programming contests, Dina prefers taking beautiful pictures. As soon as Byteland Botanical Garden announced Summer Oenothera Exhibition she decided to test her new camera there.

The exhibition consists of l = 10^{100} Oenothera species arranged in a row and consecutively numbered with integers from 0 to l - 1. Camera lens allows to take a photo of w species on it, i.e. Dina can take a photo containing flowers with indices from x to x + w - 1 for some integer x between 0 and l - w. We will denote such photo with [x, x + w - 1].

She has taken n photos, the i-th of which (in chronological order) is [x_i, x_i + w - 1] in our notation. She decided to build a time-lapse video from these photos once she discovered that Oenothera blossoms open in the evening.

Dina takes each photo and truncates it, leaving its segment containing exactly k flowers, then she composes a video of these photos keeping their original order and voilà, a beautiful artwork has been created!

A scene is a contiguous sequence of photos such that the set of flowers on them is the same. The change between two scenes is called a cut. For example, consider the first photo contains flowers [1, 5], the second photo contains flowers [3, 7] and the third photo contains flowers [8, 12]. If k = 3, then Dina can truncate the first and the second photo into [3, 5], and the third photo into [9, 11]. First two photos form a scene, third photo also forms a scene and the transition between these two scenes which happens between the second and the third photos is a cut. If k = 4, then each of the transitions between photos has to be a cut.

Dina wants the number of cuts to be as small as possible. Please help her! Calculate the minimum possible number of cuts for different values of k.

Input

The first line contains three positive integer n, w, q (1 ≤ n, q ≤ 100 000, 1 ≤ w ≤ 10^9) — the number of taken photos, the number of flowers on a single photo and the number of queries.

Next line contains n non-negative integers x_i (0 ≤ x_i ≤ 10^9) — the indices of the leftmost flowers on each of the photos.

Next line contains q positive integers k_i (1 ≤ k_i ≤ w) — the values of k for which you have to solve the problem.

It's guaranteed that all k_i are distinct.

Output

Print q integers — for each width of the truncated photo k_i, the minimum number of cuts that is possible.

Examples

Input

3 6 5
2 4 0
1 2 3 4 5

Output

0
0
1
1
2

Input

6 4 3
1 2 3 4 3 2
1 2 3

Output

0
1
2


JATC and his friend Giraffe are currently in their room, solving some problems. Giraffe has written on the board an array a_1, a_2, ..., a_n of integers, such that 1 ≤ a_1 < a_2 < … < a_n ≤ 10^3, and then went to the bathroom.

JATC decided to prank his friend by erasing some consecutive elements in the array. Since he doesn't want for the prank to go too far, he will only erase in a way, such that Giraffe can still restore the array using the information from the remaining elements. Because Giraffe has created the array, he's also aware that it's an increasing array and all the elements are integers in the range [1, 10^3].

JATC wonders what is the greatest number of elements he can erase?

Input

The first line of the input contains a single integer n (1 ≤ n ≤ 100) — the number of elements in the array.

The second line of the input contains n integers a_i (1 ≤ a_1<a_2<...<a_n ≤ 10^3) — the array written by Giraffe.

Output

Print a single integer — the maximum number of consecutive elements in the array that JATC can erase.

If it is impossible to erase even a single element, print 0.

Examples

Input

6
1 3 4 5 6 9

Output

2

Input

3
998 999 1000

Output

2

Input

5
1 2 3 4 5

Output

4

Note

In the first example, JATC can erase the third and fourth elements, leaving the array [1, 3, \\_, \\_, 6, 9]. As you can see, there is only one way to fill in the blanks.

In the second example, JATC can erase the second and the third elements. The array will become [998, \\_, \\_]. Because all the elements are less than or equal to 1000, the array is still can be restored. Note, that he can't erase the first 2 elements.

In the third example, JATC can erase the first 4 elements. Since all the elements are greater than or equal to 1, Giraffe can still restore the array. Note, that he can't erase the last 4 elements.


The Fair Nut has two arrays a and b, consisting of n numbers. He found them so long ago that no one knows when they came to him.

The Fair Nut often changes numbers in his arrays. He also is interested in how similar a and b are after every modification.

Let's denote similarity of two arrays as the minimum number of operations to apply to make arrays equal (every operation can be applied for both arrays). If it is impossible, similarity will be equal -1.

Per one operation you can choose a subarray with length k (k is fixed), and change every element a_i, which belongs to the chosen subarray, to a_i ⊕ x (x can be chosen), where ⊕ denotes the [bitwise XOR operation](https://en.wikipedia.org/wiki/Bitwise_operation#XOR).

Nut has already calculated the similarity of the arrays after every modification. Can you do it?

Note that you just need to calculate those values, that is you do not need to apply any operations.

Input

The first line contains three numbers n, k and q (1 ≤ k ≤ n ≤ 2 ⋅ 10^5, 0 ≤ q ≤ 2 ⋅ 10^5) — the length of the arrays, the length of the subarrays, to which the operations are applied, and the number of queries.

The second line contains n integers a_1, a_2, …, a_n (0 ≤ a_i < 2^{14}) — elements of array a.

The third line contains n integers b_1, b_2, …, b_n (0 ≤ b_i < 2^{14}) — elements of array b.

Each of the next q lines describes query and contains string s and two integers p and v (1 ≤ p ≤ n, 0 ≤ v < 2^{14}) — array, which this query changes («a» or «b» without quotes), index of changing element and its new value.

Output

On the first line print initial similarity of arrays a and b.

On the i-th of following q lines print similarity of a and b after applying first i modifications.

Examples

Input

3 3 1
0 4 2
1 2 3
b 2 5

Output

-1
1

Input

3 2 2
1 3 2
0 0 0
a 1 0
b 1 1

Output

2
-1
2

Note

In the first sample making arrays [0, 4, 2] and [1, 2, 3] is impossible with k=3. After the modification, you can apply the operation with x=1 to the whole first array (its length is equal to k), and it will be equal to the second array.

In order to make arrays equal in the second sample before changes, you can apply operations with x=1 on subarray [1, 2] of a and with x=2 on subarray [2, 3] of b.

After all queries arrays will be equal [0, 3, 2] and [1, 0, 0]. The same operations make them equal [1, 2, 2].


This is an interactive problem.

Vasya and Petya are going to play the following game: Petya has some positive integer number a. After that Vasya should guess this number using the following questions. He can say a pair of non-negative integer numbers (x, y). Petya will answer him:

  * "x", if (x mod a) ≥ (y mod a).
  * "y", if (x mod a) < (y mod a).

We define (x mod a) as a remainder of division x by a.

Vasya should guess the number a using no more, than 60 questions.

It's guaranteed that Petya has a number, that satisfies the inequality 1 ≤ a ≤ 10^9.

Help Vasya playing this game and write a program, that will guess the number a.

Interaction

Your program should play several games.

Before the start of any game your program should read the string:

  * "start" (without quotes) — the start of the new game.
  * "mistake" (without quotes) — in the previous game, you found the wrong answer. Your program should terminate after reading this string and it will get verdict "Wrong answer".
  * "end" (without quotes) — all games finished. Your program should terminate after reading this string.

After reading the string "start" (without quotes) the new game starts.

At the beginning, your program should ask several questions about pairs of non-negative integer numbers (x, y). You can only ask the numbers, that satisfy the inequalities 0 ≤ x, y ≤ 2 ⋅ 10^9. To ask a question print "? x y" (without quotes). As the answer, you should read one symbol:

  * "x" (without quotes), if (x mod a) ≥ (y mod a).
  * "y" (without quotes), if (x mod a) < (y mod a).
  * "e" (without quotes) — you asked more than 60 questions. Your program should terminate after reading this string and it will get verdict "Wrong answer".

After your program asked several questions your program should print the answer in form "! a" (without quotes). You should print the number a satisfying the inequalities 1 ≤ a ≤ 10^9. It's guaranteed that Petya's number a satisfied this condition. After that, the current game will finish.

We recall that your program can't ask more than 60 questions during one game.

If your program doesn't terminate after reading "mistake" (without quotes), "end" (without quotes) or "e" (without quotes), it can get any verdict, because it will continue reading from closed input. Also, if your program prints answer or question in the incorrect format it can get any verdict, too. Be careful.

Don't forget to flush the output after printing questions and answers.

To flush the output, you can use:

  * fflush(stdout) in C++.
  * System.out.flush() in Java.
  * stdout.flush() in Python.
  * flush(output) in Pascal.
  * See the documentation for other languages.

It's guaranteed that you should play at least 1 and no more than 100 games.

Hacks:

In hacks, you can use only one game. To hack a solution with Petya's number a (1 ≤ a ≤ 10^9) in the first line you should write a single number 1 and in the second line you should write a single number a.

Example

Input

start
x
x
start
x
x
y
start
x
x
y
y
end

Output

? 0 0
? 10 1
! 1
? 0 0
? 3 4
? 2 5
! 2
? 2 4
? 2 5
? 3 10
? 9 1
! 3

Note

In the first test, you should play 3 games with Petya's numbers 1, 2 and 3.

In the first game, Petya will answer "x" (without quotes) to any question, because (x mod 1) = 0 for any integer x.

In the second game, if you will ask pair (0, 0), the answer will be "x" (without quotes), because (0 mod 2) ≥ (0 mod 2). But if you will ask pair (2, 5), the answer will be "y" (without quotes), because (2 mod 2) < (5 mod 2), because (2 mod 2) = 0 and (5 mod 2) = 1.


You still have partial information about the score during the historic football match. You are given a set of pairs (a_i, b_i), indicating that at some point during the match the score was "a_i: b_i". It is known that if the current score is «x:y», then after the goal it will change to "x+1:y" or "x:y+1". What is the largest number of times a draw could appear on the scoreboard?

The pairs "a_i:b_i" are given in chronological order (time increases), but you are given score only for some moments of time. The last pair corresponds to the end of the match.

Input

The first line contains a single integer n (1 ≤ n ≤ 10000) — the number of known moments in the match.

Each of the next n lines contains integers a_i and b_i (0 ≤ a_i, b_i ≤ 10^9), denoting the score of the match at that moment (that is, the number of goals by the first team and the number of goals by the second team).

All moments are given in chronological order, that is, sequences x_i and y_j are non-decreasing. The last score denotes the final result of the match.

Output

Print the maximum number of moments of time, during which the score was a draw. The starting moment of the match (with a score 0:0) is also counted.

Examples

Input

3
2 0
3 1
3 4

Output

2

Input

3
0 0
0 0
0 0

Output

1

Input

1
5 4

Output

5

Note

In the example one of the possible score sequences leading to the maximum number of draws is as follows: 0:0, 1:0, 2:0, 2:1, 3:1, 3:2, 3:3, 3:4.


During a break in the buffet of the scientific lyceum of the Kingdom of Kremland, there was formed a queue of n high school students numbered from 1 to n. Initially, each student i is on position i. Each student i is characterized by two numbers — a_i and b_i. Dissatisfaction of the person i equals the product of a_i by the number of people standing to the left of his position, add the product b_i by the number of people standing to the right of his position. Formally, the dissatisfaction of the student i, which is on the position j, equals a_i ⋅ (j-1) + b_i ⋅ (n-j).

The director entrusted Stas with the task: rearrange the people in the queue so that minimize the total dissatisfaction.

Although Stas is able to solve such problems, this was not given to him. He turned for help to you.

Input

The first line contains a single integer n (1 ≤ n ≤ 10^5) — the number of people in the queue.

Each of the following n lines contains two integers a_i and b_i (1 ≤ a_i, b_i ≤ 10^8) — the characteristic of the student i, initially on the position i.

Output

Output one integer — minimum total dissatisfaction which can be achieved by rearranging people in the queue.

Examples

Input

3
4 2
2 3
6 1

Output

12

Input

4
2 4
3 3
7 1
2 3

Output

25

Input

10
5 10
12 4
31 45
20 55
30 17
29 30
41 32
7 1
5 5
3 15

Output

1423

Note

In the first example it is optimal to put people in this order: (3, 1, 2). The first person is in the position of 2, then his dissatisfaction will be equal to 4 ⋅ 1+2 ⋅ 1=6. The second person is in the position of 3, his dissatisfaction will be equal to 2 ⋅ 2+3 ⋅ 0=4. The third person is in the position of 1, his dissatisfaction will be equal to 6 ⋅ 0+1 ⋅ 2=2. The total dissatisfaction will be 12.

In the second example, you need to put people in this order: (3, 2, 4, 1). The total dissatisfaction will be 25.


Nauuo is a girl who loves playing cards.

One day she was playing cards but found that the cards were mixed with some empty ones.

There are n cards numbered from 1 to n, and they were mixed with another n empty cards. She piled up the 2n cards and drew n of them. The n cards in Nauuo's hands are given. The remaining n cards in the pile are also given in the order from top to bottom.

In one operation she can choose a card in her hands and play it — put it at the bottom of the pile, then draw the top card from the pile.

Nauuo wants to make the n numbered cards piled up in increasing order (the i-th card in the pile from top to bottom is the card i) as quickly as possible. Can you tell her the minimum number of operations?

Input

The first line contains a single integer n (1≤ n≤ 2⋅ 10^5) — the number of numbered cards.

The second line contains n integers a_1,a_2,…,a_n (0≤ a_i≤ n) — the initial cards in Nauuo's hands. 0 represents an empty card.

The third line contains n integers b_1,b_2,…,b_n (0≤ b_i≤ n) — the initial cards in the pile, given in order from top to bottom. 0 represents an empty card.

It is guaranteed that each number from 1 to n appears exactly once, either in a_{1..n} or b_{1..n}.

Output

The output contains a single integer — the minimum number of operations to make the n numbered cards piled up in increasing order.

Examples

Input

3
0 2 0
3 0 1

Output

2

Input

3
0 2 0
1 0 3

Output

4

Input

11
0 0 0 5 0 0 0 4 0 0 11
9 2 6 0 8 1 7 0 3 0 10

Output

18

Note

Example 1

We can play the card 2 and draw the card 3 in the first operation. After that, we have [0,3,0] in hands and the cards in the pile are [0,1,2] from top to bottom.

Then, we play the card 3 in the second operation. The cards in the pile are [1,2,3], in which the cards are piled up in increasing order.

Example 2

Play an empty card and draw the card 1, then play 1, 2, 3 in order.


Tokitsukaze is playing a room escape game designed by SkywalkerT. In this game, she needs to find out hidden clues in the room to reveal a way to escape.

After a while, she realizes that the only way to run away is to open the digital door lock since she accidentally went into a secret compartment and found some clues, which can be interpreted as:

  * Only when you enter n possible different passwords can you open the door;
  * Passwords must be integers ranged from 0 to (m - 1);
  * A password cannot be x (0 ≤ x < m) if x and m are not coprime (i.e. x and m have some common divisor greater than 1);
  * A password cannot be x (0 ≤ x < m) if there exist non-negative integers e and k such that p^e = k m + x, where p is a secret integer;
  * Any integer that doesn't break the above rules can be a password;
  * Several integers are hidden in the room, but only one of them can be p.

Fortunately, she finds that n and m are recorded in the lock. However, what makes Tokitsukaze frustrated is that she doesn't do well in math. Now that she has found an integer that is suspected to be p, she wants you to help her find out n possible passwords, or determine the integer cannot be p.

Input

The only line contains three integers n, m and p (1 ≤ n ≤ 5 × 10^5, 1 ≤ p < m ≤ 10^{18}).

It is guaranteed that m is a positive integer power of a single prime number.

Output

If the number of possible different passwords is less than n, print a single integer -1.

Otherwise, print n distinct integers ranged from 0 to (m - 1) as passwords. You can print these integers in any order. Besides, if there are multiple solutions, print any.

Examples

Input

1 2 1

Output

-1

Input

3 5 1

Output

2 4 3

Input

2 5 4

Output

2 3

Input

4 9 8

Output

2 4 7 5

Note

In the first example, there is no possible password.

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


Airports often use moving walkways to help you walking big distances faster. Each such walkway has some speed that effectively increases your speed. You can stand on such a walkway and let it move you, or you could also walk and then your effective speed is your walking speed plus walkway's speed.

Limak wants to get from point 0 to point L on a straight line. There are n disjoint walkways in between. The i-th walkway is described by two integers x_i and y_i and a real value s_i. The i-th walkway starts at x_i, ends at y_i and has speed s_i.

Every walkway is located inside the segment [0, L] and no two walkways have positive intersection. However, they can touch by endpoints.

Limak needs to decide how to distribute his energy. For example, it might make more sense to stand somewhere (or to walk slowly) to then have a lot of energy to walk faster.

Limak's initial energy is 0 and it must never drop below that value. At any moment, he can walk with any speed v in the interval [0, 2] and it will cost him v energy per second, but he continuously recovers energy with speed of 1 energy per second. So, when he walks with speed v, his energy increases by (1-v). Note that negative value would mean losing energy.

In particular, he can walk with speed 1 and this won't change his energy at all, while walking with speed 0.77 effectively gives him 0.23 energy per second.

Limak can choose his speed arbitrarily (any real value in interval [0, 2]) at every moment of time (including the moments when he is located on non-integer positions). Everything is continuous (non-discrete).

What is the fastest time Limak can get from 0 to L?

Input

The first line contains integers n and L (1 ≤ n ≤ 200 000, 1 ≤ L ≤ 10^9), the number of walkways and the distance to walk.

Each of the next n lines contains integers x_i, y_i and real value s_i (0 ≤ x_i < y_i ≤ L, 0.1 ≤ s_i ≤ 10.0). The value s_i is given with at most 9 digits after decimal point.

It's guaranteed, that no two walkways have a positive intersection. The walkways are listed from left to right. That is, y_i ≤ x_{i + 1} for 1 ≤ i ≤ n - 1.

Output

Print one real value, the fastest possible time to reach L. Your answer will be considered correct if its absolute or relative error won't exceed 10^{-9}.

Examples

Input

1 5
0 2 2.0

Output

3.000000000000

Input

1 5
2 4 0.91

Output

3.808900523560

Input

3 1000
0 990 1.777777
995 996 1.123456789
996 1000 2.0

Output

361.568848429553

Note

The drawings show the first two examples. In the first one, there is a walkway from 0 to 2 with speed 2.0 and Limak wants to get to point 5. The second example has a walkway from 2 to 4 with speed 0.91.

<image>

In the first example, one of optimal strategies is as follows.

  * Get from 0 to 2 by standing still on the walkway. It moves you with speed 2 so it takes 1 second and you save up 1 energy.
  * Get from 2 to 4 by walking with max speed 2 for next 1 second. It takes 1 second again and the energy drops to 0.
  * Get from 4 to 5 by walking with speed 1. It takes 1 second and the energy stays constant at the value 0.

The total time is 1 + 1 + 1 = 3.


Petya loves lucky numbers. Everybody knows that lucky numbers are positive integers whose decimal representation contains only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.

Let next(x) be the minimum lucky number which is larger than or equals x. Petya is interested what is the value of the expression next(l) + next(l + 1) + ... + next(r - 1) + next(r). Help him solve this problem.

Input

The single line contains two integers l and r (1 ≤ l ≤ r ≤ 109) — the left and right interval limits.

Output

In the single line print the only number — the sum next(l) + next(l + 1) + ... + next(r - 1) + next(r).

Please do not use the %lld specificator to read or write 64-bit integers in C++. It is preferred to use the cin, cout streams or the %I64d specificator.

Examples

Input

2 7

Output

33

Input

7 7

Output

7

Note

In the first sample: next(2) + next(3) + next(4) + next(5) + next(6) + next(7) = 4 + 4 + 4 + 7 + 7 + 7 = 33

In the second sample: next(7) = 7


A palindrome is a string t which reads the same backward as forward (formally, t[i] = t[|t| + 1 - i] for all i ∈ [1, |t|]). Here |t| denotes the length of a string t. For example, the strings 010, 1001 and 0 are palindromes.

You have n binary strings s_1, s_2, ..., s_n (each s_i consists of zeroes and/or ones). You can swap any pair of characters any number of times (possibly, zero). Characters can be either from the same string or from different strings — there are no restrictions.

Formally, in one move you:

  * choose four integer numbers x, a, y, b such that 1 ≤ x, y ≤ n and 1 ≤ a ≤ |s_x| and 1 ≤ b ≤ |s_y| (where x and y are string indices and a and b are positions in strings s_x and s_y respectively),
  * swap (exchange) the characters s_x[a] and s_y[b].

What is the maximum number of strings you can make palindromic simultaneously?

Input

The first line contains single integer Q (1 ≤ Q ≤ 50) — the number of test cases.

The first line on each test case contains single integer n (1 ≤ n ≤ 50) — the number of binary strings you have.

Next n lines contains binary strings s_1, s_2, ..., s_n — one per line. It's guaranteed that 1 ≤ |s_i| ≤ 50 and all strings constist of zeroes and/or ones.

Output

Print Q integers — one per test case. The i-th integer should be the maximum number of palindromic strings you can achieve simultaneously performing zero or more swaps on strings from the i-th test case.

Example

Input

4
1
0
3
1110
100110
010101
2
11111
000001
2
001
11100111

Output

1
2
2
2

Note

In the first test case, s_1 is palindrome, so the answer is 1.

In the second test case you can't make all three strings palindromic at the same time, but you can make any pair of strings palindromic. For example, let's make s_1 = 0110, s_2 = 111111 and s_3 = 010000.

In the third test case we can make both strings palindromic. For example, s_1 = 11011 and s_2 = 100001.

In the last test case s_2 is palindrome and you can make s_1 palindrome, for example, by swapping s_1[2] and s_1[3].


There is given an integer k and a grid 2^k × 2^k with some numbers written in its cells, cell (i, j) initially contains number a_{ij}. Grid is considered to be a torus, that is, the cell to the right of (i, 2^k) is (i, 1), the cell below the (2^k, i) is (1, i) There is also given a lattice figure F, consisting of t cells, where t is odd. F doesn't have to be connected.

We can perform the following operation: place F at some position on the grid. (Only translations are allowed, rotations and reflections are prohibited). Now choose any nonnegative integer p. After that, for each cell (i, j), covered by F, replace a_{ij} by a_{ij}⊕ p, where ⊕ denotes the [bitwise XOR operation](https://en.wikipedia.org/wiki/Bitwise_operation#XOR).

More formally, let F be given by cells (x_1, y_1), (x_2, y_2), ..., (x_t, y_t). Then you can do the following operation: choose any x, y with 1≤ x, y ≤ 2^k, any nonnegative integer p, and for every i from 1 to n replace number in the cell (((x + x_i - 1)mod 2^k) + 1, ((y + y_i - 1)mod 2^k) + 1) with a_{((x + x_i - 1)mod 2^k) + 1, ((y + y_i - 1)mod 2^k) + 1}⊕ p.

Our goal is to make all the numbers equal to 0. Can we achieve it? If we can, find the smallest number of operations in which it is possible to do this.

Input

The first line contains a single integer k (1 ≤ k ≤ 9).

The i-th of the next 2^k lines contains 2^k integers a_{i1}, a_{i2}, ..., a_{i2^k} (0 ≤ a_{ij} < 2^{60}) — initial values in the i-th row of the grid.

The next line contains a single integer t (1≤ t ≤ min(99, 4^k), t is odd) — number of cells of figure.

i-th of next t lines contains two integers x_i and y_i (1 ≤ x_i, y_i ≤ 2^k), describing the position of the i-th cell of the figure.

It is guaranteed that all cells are different, but it is not guaranteed that the figure is connected.

Output

If it is impossible to make all numbers in the grid equal to 0 with these operations, output -1.

Otherwise, output a single integer — the minimal number of operations needed to do this. It can be shown that if it is possible to make all numbers equal 0, it is possible to do so in less than 10^{18} operations.

Example

Input

2
5 5 5 5
2 6 2 3
0 0 2 0
0 0 0 0
5
1 1
1 2
1 3
1 4
2 4

Output

3

Note

The figure and the operations for the example are shown above:

<image>


Polycarp has three sisters: Alice, Barbara, and Cerene. They're collecting coins. Currently, Alice has a coins, Barbara has b coins and Cerene has c coins. Recently Polycarp has returned from the trip around the world and brought n coins.

He wants to distribute all these n coins between his sisters in such a way that the number of coins Alice has is equal to the number of coins Barbara has and is equal to the number of coins Cerene has. In other words, if Polycarp gives A coins to Alice, B coins to Barbara and C coins to Cerene (A+B+C=n), then a + A = b + B = c + C.

Note that A, B or C (the number of coins Polycarp gives to Alice, Barbara and Cerene correspondingly) can be 0.

Your task is to find out if it is possible to distribute all n coins between sisters in a way described above.

You have to answer t independent test cases.

Input

The first line of the input contains one integer t (1 ≤ t ≤ 10^4) — the number of test cases.

The next t lines describe test cases. Each test case is given on a new line and consists of four space-separated integers a, b, c and n (1 ≤ a, b, c, n ≤ 10^8) — the number of coins Alice has, the number of coins Barbara has, the number of coins Cerene has and the number of coins Polycarp has.

Output

For each test case, print "YES" if Polycarp can distribute all n coins between his sisters and "NO" otherwise.

Example

Input

5
5 3 2 8
100 101 102 105
3 2 1 100000000
10 20 15 14
101 101 101 3

Output

YES
YES
NO
NO
YES


Screen resolution of Polycarp's monitor is a × b pixels. Unfortunately, there is one dead pixel at his screen. It has coordinates (x, y) (0 ≤ x < a, 0 ≤ y < b). You can consider columns of pixels to be numbered from 0 to a-1, and rows — from 0 to b-1.

Polycarp wants to open a rectangular window of maximal size, which doesn't contain the dead pixel. The boundaries of the window should be parallel to the sides of the screen.

Print the maximal area (in pixels) of a window that doesn't contain the dead pixel inside itself.

Input

In the first line you are given an integer t (1 ≤ t ≤ 10^4) — the number of test cases in the test. In the next lines you are given descriptions of t test cases.

Each test case contains a single line which consists of 4 integers a, b, x and y (1 ≤ a, b ≤ 10^4; 0 ≤ x < a; 0 ≤ y < b) — the resolution of the screen and the coordinates of a dead pixel. It is guaranteed that a+b>2 (e.g. a=b=1 is impossible).

Output

Print t integers — the answers for each test case. Each answer should contain an integer equal to the maximal possible area (in pixels) of a rectangular window, that doesn't contain the dead pixel.

Example

Input

6
8 8 0 0
1 10 0 3
17 31 10 4
2 1 0 0
5 10 3 9
10 10 4 8

Output

56
6
442
1
45
80

Note

In the first test case, the screen resolution is 8 × 8, and the upper left pixel is a dead pixel. Here you can see one of two possible layouts of the maximal window.

<image>


This is an interactive problem.

Yui is a girl who enjoys playing Mahjong.

<image>

She has a mysterious set which consists of tiles (this set can be empty). Each tile has an integer value between 1 and n, and at most n tiles in the set have the same value. So the set can contain at most n^2 tiles.

You want to figure out which values are on the tiles. But Yui is shy, she prefers to play a guessing game with you.

Let's call a set consisting of three tiles triplet if their values are the same. For example, \{2, 2, 2\} is a triplet, but \{2, 3, 3\} is not.

Let's call a set consisting of three tiles straight if their values are consecutive integers. For example, \{2, 3, 4\} is a straight, but \{1, 3, 5\} is not.

At first, Yui gives you the number of triplet subsets and straight subsets of the initial set respectively. After that, you can insert a tile with an integer value between 1 and n into the set at most n times. Every time you insert a tile, you will get the number of triplet subsets and straight subsets of the current set as well.

Note that two tiles with the same value are treated different. In other words, in the set \{1, 1, 2, 2, 3\} you can find 4 subsets \{1, 2, 3\}.

Try to guess the number of tiles in the initial set with value i for all integers i from 1 to n.

Input

The first line contains a single integer n (4 ≤ n ≤ 100).

The second line contains two integers which represent the number of triplet subsets and straight subsets of the initial set respectively.

Output

When you are ready to answer, print a single line of form "! a_1 a_2 … a_n" (0 ≤ a_i ≤ n), where a_i is equal to the number of tiles in the initial set with value i.

Interaction

To insert a tile, print a single line of form "+ x" (1 ≤ x ≤ n), where x is the value of the tile you insert. Then you should read two integers which represent the number of triplet subsets and straight subsets of the current set respectively.

After printing a line, do not forget to flush the output. Otherwise, you will get Idleness limit exceeded. To do this, use:

  * fflush(stdout) or cout.flush() in C++;
  * System.out.flush() in Java;
  * flush(output) in Pascal;
  * stdout.flush() in Python;
  * see documentation for other languages.

You will get Wrong answer if you insert more than n tiles.

Hacks

To make a hack you should provide a test in such format:

The first line contains a single integer n (4 ≤ n ≤ 100).

The second line contains n integers a_1,a_2,…,a_n (0 ≤ a_i ≤ n) — a_i is equal to the number of tiles with value i in the set.

Example

Input

5
1 6
2 9
5 12
5 24
6 24

Output

+ 1
+ 1
+ 2
+ 5
! 2 1 3 0 2

Note

In the first test, the initial set of tiles is \{1, 1, 2, 3, 3, 3, 5, 5\}. It has only one triplet subset \{3, 3, 3\} and six straight subsets, all equal to \{1, 2, 3\}. After inserting a tile with value 1 the set of tiles will be \{1, 1, 1, 2, 3, 3, 3, 5, 5\} and will have two triplet subsets \{1, 1, 1\}, \{3, 3, 3\} and nine straight subsets, all equal to \{1, 2, 3\}.


The game of Berland poker is played with a deck of n cards, m of which are jokers. k players play this game (n is divisible by k).

At the beginning of the game, each player takes n/k cards from the deck (so each card is taken by exactly one player). The player who has the maximum number of jokers is the winner, and he gets the number of points equal to x - y, where x is the number of jokers in the winner's hand, and y is the maximum number of jokers among all other players. If there are two or more players with maximum number of jokers, all of them are winners and they get 0 points.

Here are some examples:

  * n = 8, m = 3, k = 2. If one player gets 3 jokers and 1 plain card, and another player gets 0 jokers and 4 plain cards, then the first player is the winner and gets 3 - 0 = 3 points;
  * n = 4, m = 2, k = 4. Two players get plain cards, and the other two players get jokers, so both of them are winners and get 0 points;
  * n = 9, m = 6, k = 3. If the first player gets 3 jokers, the second player gets 1 joker and 2 plain cards, and the third player gets 2 jokers and 1 plain card, then the first player is the winner, and he gets 3 - 2 = 1 point;
  * n = 42, m = 0, k = 7. Since there are no jokers, everyone gets 0 jokers, everyone is a winner, and everyone gets 0 points.

Given n, m and k, calculate the maximum number of points a player can get for winning the game.

Input

The first line of the input contains one integer t (1 ≤ t ≤ 500) — the number of test cases.

Then the test cases follow. Each test case contains three integers n, m and k (2 ≤ n ≤ 50, 0 ≤ m ≤ n, 2 ≤ k ≤ n, k is a divisors of n).

Output

For each test case, print one integer — the maximum number of points a player can get for winning the game.

Example

Input

4
8 3 2
4 2 4
9 6 3
42 0 7

Output

3
0
1
0

Note

Test cases of the example are described in the statement.


Vladimir would like to prepare a present for his wife: they have an anniversary! He decided to buy her exactly n flowers.

Vladimir went to a flower shop, and he was amazed to see that there are m types of flowers being sold there, and there is unlimited supply of flowers of each type. Vladimir wants to choose flowers to maximize the happiness of his wife. He knows that after receiving the first flower of the i-th type happiness of his wife increases by a_i and after receiving each consecutive flower of this type her happiness increases by b_i. That is, if among the chosen flowers there are x_i > 0 flowers of type i, his wife gets a_i + (x_i - 1) ⋅ b_i additional happiness (and if there are no flowers of type i, she gets nothing for this particular type).

Please help Vladimir to choose exactly n flowers to maximize the total happiness of his wife.

Input

The first line contains the only integer t (1 ≤ t ≤ 10 000), the number of test cases. It is followed by t descriptions of the test cases.

Each test case description starts with two integers n and m (1 ≤ n ≤ 10^9, 1 ≤ m ≤ 100 000), the number of flowers Vladimir needs to choose and the number of types of available flowers.

The following m lines describe the types of flowers: each line contains integers a_i and b_i (0 ≤ a_i, b_i ≤ 10^9) for i-th available type of flowers.

The test cases are separated by a blank line. It is guaranteed that the sum of values m among all test cases does not exceed 100 000.

Output

For each test case output a single integer: the maximum total happiness of Vladimir's wife after choosing exactly n flowers optimally.

Example

Input

2
4 3
5 0
1 4
2 2

5 3
5 2
4 2
3 1

Output

14
16

Note

In the first example case Vladimir can pick 1 flower of the first type and 3 flowers of the second type, in this case the total happiness equals 5 + (1 + 2 ⋅ 4) = 14.

In the second example Vladimir can pick 2 flowers of the first type, 2 flowers of the second type, and 1 flower of the third type, in this case the total happiness equals (5 + 1 ⋅ 2) + (4 + 1 ⋅ 2) + 3 = 16.


One Sunday Petr went to a bookshop and bought a new book on sports programming. The book had exactly n pages.

Petr decided to start reading it starting from the next day, that is, from Monday. Petr's got a very tight schedule and for each day of the week he knows how many pages he will be able to read on that day. Some days are so busy that Petr will have no time to read whatsoever. However, we know that he will be able to read at least one page a week.

Assuming that Petr will not skip days and will read as much as he can every day, determine on which day of the week he will read the last page of the book.

Input

The first input line contains the single integer n (1 ≤ n ≤ 1000) — the number of pages in the book.

The second line contains seven non-negative space-separated integers that do not exceed 1000 — those integers represent how many pages Petr can read on Monday, Tuesday, Wednesday, Thursday, Friday, Saturday and Sunday correspondingly. It is guaranteed that at least one of those numbers is larger than zero.

Output

Print a single number — the number of the day of the week, when Petr will finish reading the book. The days of the week are numbered starting with one in the natural order: Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday.

Examples

Input

100
15 20 20 15 10 30 45

Output

6

Input

2
1 0 0 0 0 0 0

Output

1

Note

Note to the first sample:

By the end of Monday and therefore, by the beginning of Tuesday Petr has 85 pages left. He has 65 pages left by Wednesday, 45 by Thursday, 30 by Friday, 20 by Saturday and on Saturday Petr finishes reading the book (and he also has time to read 10 pages of something else).

Note to the second sample:

On Monday of the first week Petr will read the first page. On Monday of the second week Petr will read the second page and will finish reading the book.


After making a strategic plan with carriers for expansion of mobile network throughout the whole country, the government decided to cover rural areas with the last generation of 5G network.

Since 5G antenna towers will be built in the area of mainly private properties, the government needs an easy way to find information about landowners for each property partially or fully contained in the planned building area.

The planned building area is represented as a rectangle with sides width and height.

Every 5G antenna tower occupies a circle with a center in (x,y) and radius r.

There is a database of Geodetic Institute containing information about each property. Each property is defined with its identification number and polygon represented as an array of (x,y) points in the counter-clockwise direction.

Your task is to build an IT system which can handle queries of type (x, y, r) in which (x,y) represents a circle center, while r represents its radius. The IT system should return the total area of properties that need to be acquired for the building of a tower so that the government can estimate the price. Furthermore, the system should return a list of identification numbers of these properties (so that the owners can be contacted for land acquisition).

A property needs to be acquired if the circle of the antenna tower is intersecting or touching it.

Input

The first line contains the size of the building area as double values width, height, and an integer n — the number of properties in the database.

Each of the next n lines contains the description of a single property in the form of an integer number v (3 ≤ v ≤ 40) — the number of points that define a property, as well as 2*v double numbers — the coordinates (x,y) of each property point. Line i (0 ≤ i ≤ n-1) contains the information for property with id i.

The next line contains an integer q — the number of queries.

Each of the next q lines contains double values x, y, r — the coordinates of an antenna circle center (x, y) and its radius r.

1 ≤ n * q ≤ 10^6

Output

For each of the q queries, your program should output a line containing the total area of all the properties that need to be acquired, an integer representing the number of such properties, as well as the list of ids of these properties (separated by blank characters, arbitrary order).

Example

Input

10 10 3
4 2 2 3 2 3 3 2 3
3 3.5 2 4.5 2 4.5 3
4 7 8 7.5 8.5 8 8 7.5 9
5
2 3.5 0.5
3.3 2 0.4
5 2.5 0.5
7.5 8.5 0.5
3 7 0.5

Output

1.000000 1 0
1.500000 2 0 1
0.500000 1 1
0.250000 1 2
0.000000 0

Note

You can assume that the land not covered with properties (polygons) is under the government's ownership and therefore doesn't need to be acquired. Properties do not intersect with each other.

Precision being used for solution checking is 10^{-4}.


You are given n non-decreasing arrays of non-negative numbers.

Vasya repeats the following operation k times:

  * Selects a non-empty array.
  * Puts the first element of the selected array in his pocket.
  * Removes the first element from the selected array.

Vasya wants to maximize the sum of the elements in his pocket.

Input

The first line contains two integers n and k (1 ≤ n, k ≤ 3 000): the number of arrays and operations.

Each of the next n lines contain an array. The first integer in each line is t_i (1 ≤ t_i ≤ 10^6): the size of the i-th array. The following t_i integers a_{i, j} (0 ≤ a_{i, 1} ≤ … ≤ a_{i, t_i} ≤ 10^8) are the elements of the i-th array.

It is guaranteed that k ≤ ∑_{i=1}^n t_i ≤ 10^6.

Output

Print one integer: the maximum possible sum of all elements in Vasya's pocket after k operations.

Example

Input

3 3
2 5 10
3 1 2 3
2 1 20

Output

26


There are n persons located on a plane. The i-th person is located at the point (x_i, y_i) and initially looks at the point (u_i, v_i).

At the same moment of time, all persons will start to rotate clockwise synchronously with the same angular speed. They will rotate until they do one full 360-degree turn.

It is said that persons A and B made eye contact if person A looks in person B's direction at the same moment when person B looks in person A's direction. If there is a person C located between persons A and B, that will not obstruct A and B from making eye contact. A person can make eye contact with more than one person at the same time.

Calculate the number of pairs of persons that will make eye contact at least once during the rotation (including the initial moment).

Input

The first line contains one integer t (1 ≤ t ≤ 10^4) — the number of test cases.

The first line of each test case contains a single integer n (1 ≤ n ≤ 10^5) — the number of persons. The following n lines describe persons, each line containing four space-separated integers x_i, y_i, u_i, v_i (|x_i|, |y_i|, |u_i|, |v_i| ≤ 10^9; x_i ≠ u_i or y_i ≠ v_i), where (x_i, y_i) are the coordinates of the point where the i-th person is located and (u_i, v_i) are the coordinates of the point that the i-th person looks at initially. Each person's location is unique in each test case.

The sum of n over all test cases does not exceed 10^5.

Output

For each test case, print one integer — the number of pairs of persons who will make eye contact at least once during the rotation, including the initial moment.

Example

Input

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

Output

0
1
9


You are storing an integer array of length m in a database. To maintain internal integrity and protect data, the database stores n copies of this array.

Unfortunately, the recent incident may have altered the stored information in every copy in the database.

It's believed, that the incident altered at most two elements in every copy. You need to recover the original array based on the current state of the database.

In case there are multiple ways to restore the array, report any. If there is no array that differs from every copy in no more than two positions, report that as well.

Input

The first line contains integers n and m (2 ≤ n; 1 ≤ m; n ⋅ m ≤ 250 000) — the number of copies and the size of the array.

Each of the following n lines describes one of the currently stored copies in the database, it consists of m integers s_{i, 1}, s_{i, 2}, ..., s_{i, m} (1 ≤ s_{i, j} ≤ 10^9).

Output

If there is an array consistent with all given copies, print "Yes" and then the array itself. The array must have length m and contain integers between 1 and 10^9 only.

Otherwise, print "No".

If there are multiple possible arrays, print any of them.

Examples

Input

3 4
1 10 10 100
1 1 1 100
10 100 1 100

Output

Yes
1 10 1 100

Input

10 7
1 1 1 1 1 1 1
1 1 1 1 1 1 2
1 1 1 1 1 2 2
1 1 1 1 2 2 1
1 1 1 2 2 1 1
1 1 2 2 1 1 1
1 2 2 1 1 1 1
2 2 1 1 1 1 1
2 1 1 1 1 1 1
1 1 1 1 1 1 1

Output

Yes
1 1 1 1 1 1 1

Input

2 5
2 2 1 1 1
1 1 2 2 2

Output

No

Note

In the first example, the array [1, 10, 1, 100] differs from first and second copies in just one position, and from the third copy in two positions.

In the second example, array [1, 1, 1, 1, 1, 1, 1] is the same as the first copy and differs from all other copies in at most two positions.

In the third example, there is no array differing in at most two positions from every database's copy.


Phoenix's homeland, the Fire Nation had n cities that were connected by m roads, but the roads were all destroyed by an earthquake. The Fire Nation wishes to repair n-1 of these roads so that all the cities are connected again.

The i-th city has a_i tons of asphalt. x tons of asphalt are used up when repairing a road, and to repair a road between i and j, cities i and j must have at least x tons of asphalt between them. In other words, if city i had a_i tons of asphalt and city j had a_j tons, there would remain a_i+a_j-x tons after repairing the road between them. Asphalt can be moved between cities if the road between them is already repaired.

Please determine if it is possible to connect all the cities, and if so, output any sequence of roads to repair.

Input

The first line contains integers n, m, and x (2 ≤ n ≤ 3 ⋅ 10^5; n-1 ≤ m ≤ 3 ⋅ 10^5; 1 ≤ x ≤ 10^9) — the number of cities, number of roads, and amount of asphalt needed to repair one road.

The next line contains n space-separated integer a_i (0 ≤ a_i ≤ 10^9) — the amount of asphalt initially at city i.

The next m lines contains two integers x_i and y_i (x_i≠ y_i; 1 ≤ x_i, y_i ≤ n) — the cities connected by the i-th road. It is guaranteed that there is at most one road between each pair of cities, and that the city was originally connected before the earthquake.

Output

If it is not possible to connect all the cities, print NO. Otherwise, print YES followed by n-1 integers e_1, e_2, ..., e_{n-1}, the order in which the roads should be repaired. e_i is the index of the i-th road to repair. If there are multiple solutions, print any.

Examples

Input

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

Output

YES
3
2
1
4

Input

2 1 2
1 1
1 2

Output

YES
1

Input

2 1 2
0 1
1 2

Output

NO

Input

5 6 5
0 9 4 0 10
1 2
1 3
2 3
3 4
1 4
4 5

Output

YES
6
4
1
2

Note

In the first example, the roads are repaired in the following order:

  * Road 3 is repaired, connecting cities 3 and 4. City 4 originally had 4 tons of asphalt. After this road is constructed, 3 tons remain.
  * Road 2 is repaired, connecting cities 2 and 3. The asphalt from city 4 can be transported to city 3 and used for the road. 2 tons remain.
  * Road 1 is repaired, connecting cities 1 and 2. The asphalt is transported to city 2 and used for the road. 1 ton remain.
  * Road 4 is repaired, connecting cities 4 and 5. The asphalt is transported to city 4 and used for the road. No asphalt remains.

All the cities are now connected.

In the second example, cities 1 and 2 use all their asphalt together to build the road. They each have 1 ton, so together they have 2 tons, which is enough.

In the third example, there isn't enough asphalt to connect cities 1 and 2.


This is the easy version of the problem. The only difference between the easy version and the hard version is the constraints on n. You can only make hacks if both versions are solved.

A permutation of 1, 2, …, n is a sequence of n integers, where each integer from 1 to n appears exactly once. For example, [2,3,1,4] is a permutation of 1, 2, 3, 4, but [1,4,2,2] isn't because 2 appears twice in it.

Recall that the number of inversions in a permutation a_1, a_2, …, a_n is the number of pairs of indices (i, j) such that i < j and a_i > a_j.

Let p and q be two permutations of 1, 2, …, n. Find the number of permutation pairs (p,q) that satisfy the following conditions:

  * p is lexicographically smaller than q.
  * the number of inversions in p is greater than the number of inversions in q.

Print the number of such pairs modulo mod. Note that mod may not be a prime.

Input

The only line contains two integers n and mod (1≤ n≤ 50, 1≤ mod≤ 10^9).

Output

Print one integer, which is the answer modulo mod.

Example

Input

4 403458273

Output

17

Note

The following are all valid pairs (p,q) when n=4.

  * p=[1,3,4,2], q=[2,1,3,4],
  * p=[1,4,2,3], q=[2,1,3,4],
  * p=[1,4,3,2], q=[2,1,3,4],
  * p=[1,4,3,2], q=[2,1,4,3],
  * p=[1,4,3,2], q=[2,3,1,4],
  * p=[1,4,3,2], q=[3,1,2,4],
  * p=[2,3,4,1], q=[3,1,2,4],
  * p=[2,4,1,3], q=[3,1,2,4],
  * p=[2,4,3,1], q=[3,1,2,4],
  * p=[2,4,3,1], q=[3,1,4,2],
  * p=[2,4,3,1], q=[3,2,1,4],
  * p=[2,4,3,1], q=[4,1,2,3],
  * p=[3,2,4,1], q=[4,1,2,3],
  * p=[3,4,1,2], q=[4,1,2,3],
  * p=[3,4,2,1], q=[4,1,2,3],
  * p=[3,4,2,1], q=[4,1,3,2],
  * p=[3,4,2,1], q=[4,2,1,3].


n fish, numbered from 1 to n, live in a lake. Every day right one pair of fish meet, and the probability of each other pair meeting is the same. If two fish with indexes i and j meet, the first will eat up the second with the probability aij, and the second will eat up the first with the probability aji = 1 - aij. The described process goes on until there are at least two fish in the lake. For each fish find out the probability that it will survive to be the last in the lake.

Input

The first line contains integer n (1 ≤ n ≤ 18) — the amount of fish in the lake. Then there follow n lines with n real numbers each — matrix a. aij (0 ≤ aij ≤ 1) — the probability that fish with index i eats up fish with index j. It's guaranteed that the main diagonal contains zeros only, and for other elements the following is true: aij = 1 - aji. All real numbers are given with not more than 6 characters after the decimal point.

Output

Output n space-separated real numbers accurate to not less than 6 decimal places. Number with index i should be equal to the probability that fish with index i will survive to be the last in the lake.

Examples

Input

2
0 0.5
0.5 0

Output

0.500000 0.500000

Input

5
0 1 1 1 1
0 0 0.5 0.5 0.5
0 0.5 0 0.5 0.5
0 0.5 0.5 0 0.5
0 0.5 0.5 0.5 0

Output

1.000000 0.000000 0.000000 0.000000 0.000000


Vasya used to be an accountant before the war began and he is one of the few who knows how to operate a computer, so he was assigned as the programmer.

We all know that programs often store sets of integers. For example, if we have a problem about a weighted directed graph, its edge can be represented by three integers: the number of the starting vertex, the number of the final vertex and the edge's weight. So, as Vasya was trying to represent characteristics of a recently invented robot in his program, he faced the following problem.

Vasya is not a programmer, so he asked his friend Gena, what the convenient way to store n integers is. Gena used to code in language X-- and so he can use only the types that occur in this language. Let's define, what a "type" is in language X--:

  * First, a type is a string "int".
  * Second, a type is a string that starts with "pair", then followed by angle brackets listing exactly two comma-separated other types of language X--. This record contains no spaces.
  * No other strings can be regarded as types.

More formally: type := int | pair<type,type>. For example, Gena uses the following type for graph edges: pair<int,pair<int,int>>.

Gena was pleased to help Vasya, he dictated to Vasya a type of language X--, that stores n integers. Unfortunately, Gena was in a hurry, so he omitted the punctuation. Now Gena has already left and Vasya can't find the correct punctuation, resulting in a type of language X--, however hard he tries.

Help Vasya and add the punctuation marks so as to receive the valid type of language X--. Otherwise say that the task is impossible to perform.

Input

The first line contains a single integer n (1 ≤ n ≤ 105), showing how many numbers the type dictated by Gena contains.

The second line contains space-separated words, said by Gena. Each of them is either "pair" or "int" (without the quotes).

It is guaranteed that the total number of words does not exceed 105 and that among all the words that Gena said, there are exactly n words "int".

Output

If it is possible to add the punctuation marks so as to get a correct type of language X-- as a result, print a single line that represents the resulting type. Otherwise, print "Error occurred" (without the quotes). Inside the record of a type should not be any extra spaces and other characters.

It is guaranteed that if such type exists, then it is unique.

Note that you should print the type dictated by Gena (if such type exists) and not any type that can contain n values.

Examples

Input

3
pair pair int int int

Output

pair<pair<int,int>,int>

Input

1
pair int

Output

Error occurred


Furik and Rubik love playing computer games. Furik has recently found a new game that greatly interested Rubik. The game consists of n parts and to complete each part a player may probably need to complete some other ones. We know that the game can be fully completed, that is, its parts do not form cyclic dependencies.

Rubik has 3 computers, on which he can play this game. All computers are located in different houses. Besides, it has turned out that each part of the game can be completed only on one of these computers. Let's number the computers with integers from 1 to 3. Rubik can perform the following actions:

  * Complete some part of the game on some computer. Rubik spends exactly 1 hour on completing any part on any computer.
  * Move from the 1-st computer to the 2-nd one. Rubik spends exactly 1 hour on that.
  * Move from the 1-st computer to the 3-rd one. Rubik spends exactly 2 hours on that.
  * Move from the 2-nd computer to the 1-st one. Rubik spends exactly 2 hours on that.
  * Move from the 2-nd computer to the 3-rd one. Rubik spends exactly 1 hour on that.
  * Move from the 3-rd computer to the 1-st one. Rubik spends exactly 1 hour on that.
  * Move from the 3-rd computer to the 2-nd one. Rubik spends exactly 2 hours on that.

Help Rubik to find the minimum number of hours he will need to complete all parts of the game. Initially Rubik can be located at the computer he considers necessary.

Input

The first line contains integer n (1 ≤ n ≤ 200) — the number of game parts. The next line contains n integers, the i-th integer — ci (1 ≤ ci ≤ 3) represents the number of the computer, on which you can complete the game part number i.

Next n lines contain descriptions of game parts. The i-th line first contains integer ki (0 ≤ ki ≤ n - 1), then ki distinct integers ai, j (1 ≤ ai, j ≤ n; ai, j ≠ i) — the numbers of parts to complete before part i.

Numbers on all lines are separated by single spaces. You can assume that the parts of the game are numbered from 1 to n in some way. It is guaranteed that there are no cyclic dependencies between the parts of the game.

Output

On a single line print the answer to the problem.

Examples

Input

1
1
0

Output

1

Input

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

Output

7

Note

Note to the second sample: before the beginning of the game the best strategy is to stand by the third computer. First we complete part 5. Then we go to the 1-st computer and complete parts 3 and 4. Then we go to the 2-nd computer and complete parts 1 and 2. In total we get 1+1+2+1+2, which equals 7 hours.


You must have heard of the two brothers dreaming of ruling the world. With all their previous plans failed, this time they decided to cooperate with each other in order to rule the world.

As you know there are n countries in the world. These countries are connected by n - 1 directed roads. If you don't consider direction of the roads there is a unique path between every pair of countries in the world, passing through each road at most once.

Each of the brothers wants to establish his reign in some country, then it's possible for him to control the countries that can be reached from his country using directed roads.

The brothers can rule the world if there exists at most two countries for brothers to choose (and establish their reign in these countries) so that any other country is under control of at least one of them. In order to make this possible they want to change the direction of minimum number of roads. Your task is to calculate this minimum number of roads.

Input

The first line of input contains an integer n (1 ≤ n ≤ 3000). Each of the next n - 1 lines contains two space-separated integers ai and bi (1 ≤ ai, bi ≤ n; ai ≠ bi) saying there is a road from country ai to country bi.

Consider that countries are numbered from 1 to n. It's guaranteed that if you don't consider direction of the roads there is a unique path between every pair of countries in the world, passing through each road at most once.

Output

In the only line of output print the minimum number of roads that their direction should be changed so that the brothers will be able to rule the world.

Examples

Input

4
2 1
3 1
4 1

Output

1

Input

5
2 1
2 3
4 3
4 5

Output

0


You've got a 5 × 5 matrix, consisting of 24 zeroes and a single number one. Let's index the matrix rows by numbers from 1 to 5 from top to bottom, let's index the matrix columns by numbers from 1 to 5 from left to right. In one move, you are allowed to apply one of the two following transformations to the matrix:

  1. Swap two neighboring matrix rows, that is, rows with indexes i and i + 1 for some integer i (1 ≤ i < 5).
  2. Swap two neighboring matrix columns, that is, columns with indexes j and j + 1 for some integer j (1 ≤ j < 5).

You think that a matrix looks beautiful, if the single number one of the matrix is located in its middle (in the cell that is on the intersection of the third row and the third column). Count the minimum number of moves needed to make the matrix beautiful.

Input

The input consists of five lines, each line contains five integers: the j-th integer in the i-th line of the input represents the element of the matrix that is located on the intersection of the i-th row and the j-th column. It is guaranteed that the matrix consists of 24 zeroes and a single number one.

Output

Print a single integer — the minimum number of moves needed to make the matrix beautiful.

Examples

Input

0 0 0 0 0
0 0 0 0 1
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0

Output

3

Input

0 0 0 0 0
0 0 0 0 0
0 1 0 0 0
0 0 0 0 0
0 0 0 0 0

Output

1


In the city of Ultima Thule job applicants are often offered an IQ test.

The test is as follows: the person gets a piece of squared paper with a 4 × 4 square painted on it. Some of the square's cells are painted black and others are painted white. Your task is to repaint at most one cell the other color so that the picture has a 2 × 2 square, completely consisting of cells of the same color. If the initial picture already has such a square, the person should just say so and the test will be completed.

Your task is to write a program that determines whether it is possible to pass the test. You cannot pass the test if either repainting any cell or no action doesn't result in a 2 × 2 square, consisting of cells of the same color.

Input

Four lines contain four characters each: the j-th character of the i-th line equals "." if the cell in the i-th row and the j-th column of the square is painted white, and "#", if the cell is black.

Output

Print "YES" (without the quotes), if the test can be passed and "NO" (without the quotes) otherwise.

Examples

Input

####
.#..
####
....

Output

YES

Input

####
....
####
....

Output

NO

Note

In the first test sample it is enough to repaint the first cell in the second row. After such repainting the required 2 × 2 square is on the intersection of the 1-st and 2-nd row with the 1-st and 2-nd column.


One day, liouzhou_101 got a chat record of Freda and Rainbow. Out of curiosity, he wanted to know which sentences were said by Freda, and which were said by Rainbow. According to his experience, he thought that Freda always said "lala." at the end of her sentences, while Rainbow always said "miao." at the beginning of his sentences. For each sentence in the chat record, help liouzhou_101 find whose sentence it is.

Input

The first line of the input contains an integer n (1 ≤ n ≤ 10), number of sentences in the chat record. Each of the next n lines contains a sentence. A sentence is a string that contains only Latin letters (A-Z, a-z), underline (_), comma (,), point (.) and space ( ). Its length doesn’t exceed 100.

Output

For each sentence, output "Freda's" if the sentence was said by Freda, "Rainbow's" if the sentence was said by Rainbow, or "OMG>.< I don't know!" if liouzhou_101 can’t recognize whose sentence it is. He can’t recognize a sentence if it begins with "miao." and ends with "lala.", or satisfies neither of the conditions.

Examples

Input

5
I will go to play with you lala.
wow, welcome.
miao.lala.
miao.
miao .

Output

Freda's
OMG>.< I don't know!
OMG>.< I don't know!
Rainbow's
OMG>.< I don't know!


Gerald plays the following game. He has a checkered field of size n × n cells, where m various cells are banned. Before the game, he has to put a few chips on some border (but not corner) board cells. Then for n - 1 minutes, Gerald every minute moves each chip into an adjacent cell. He moves each chip from its original edge to the opposite edge. Gerald loses in this game in each of the three cases:

  * At least one of the chips at least once fell to the banned cell.
  * At least once two chips were on the same cell.
  * At least once two chips swapped in a minute (for example, if you stand two chips on two opposite border cells of a row with even length, this situation happens in the middle of the row).

In that case he loses and earns 0 points. When nothing like that happened, he wins and earns the number of points equal to the number of chips he managed to put on the board. Help Gerald earn the most points.

Input

The first line contains two space-separated integers n and m (2 ≤ n ≤ 1000, 0 ≤ m ≤ 105) — the size of the field and the number of banned cells. Next m lines each contain two space-separated integers. Specifically, the i-th of these lines contains numbers xi and yi (1 ≤ xi, yi ≤ n) — the coordinates of the i-th banned cell. All given cells are distinct.

Consider the field rows numbered from top to bottom from 1 to n, and the columns — from left to right from 1 to n.

Output

Print a single integer — the maximum points Gerald can earn in this game.

Examples

Input

3 1
2 2

Output

0

Input

3 0

Output

1

Input

4 3
3 1
3 2
3 3

Output

1

Note

In the first test the answer equals zero as we can't put chips into the corner cells.

In the second sample we can place one chip into either cell (1, 2), or cell (3, 2), or cell (2, 1), or cell (2, 3). We cannot place two chips.

In the third sample we can only place one chip into either cell (2, 1), or cell (2, 4).


Xenia is an amateur programmer. Today on the IT lesson she learned about the Hamming distance.

The Hamming distance between two strings s = s1s2... sn and t = t1t2... tn of equal length n is value <image>. Record [si ≠ ti] is the Iverson notation and represents the following: if si ≠ ti, it is one, otherwise — zero.

Now Xenia wants to calculate the Hamming distance between two long strings a and b. The first string a is the concatenation of n copies of string x, that is, <image>. The second string b is the concatenation of m copies of string y.

Help Xenia, calculate the required Hamming distance, given n, x, m, y.

Input

The first line contains two integers n and m (1 ≤ n, m ≤ 1012). The second line contains a non-empty string x. The third line contains a non-empty string y. Both strings consist of at most 106 lowercase English letters.

It is guaranteed that strings a and b that you obtain from the input have the same length.

Output

Print a single integer — the required Hamming distance.

Please, do not use the %lld specifier to read or write 64-bit integers in С++. It is preferred to use the cin, cout streams or the %I64d specifier.

Examples

Input

100 10
a
aaaaaaaaaa

Output

0

Input

1 1
abacaba
abzczzz

Output

4

Input

2 3
rzr
az

Output

5

Note

In the first test case string a is the same as string b and equals 100 letters a. As both strings are equal, the Hamming distance between them is zero.

In the second test case strings a and b differ in their 3-rd, 5-th, 6-th and 7-th characters. Thus, the Hamming distance equals 4.

In the third test case string a is rzrrzr and string b is azazaz. The strings differ in all characters apart for the second one, the Hamming distance between them equals 5.


Sereja has a bracket sequence s1, s2, ..., sn, or, in other words, a string s of length n, consisting of characters "(" and ")".

Sereja needs to answer m queries, each of them is described by two integers li, ri (1 ≤ li ≤ ri ≤ n). The answer to the i-th query is the length of the maximum correct bracket subsequence of sequence sli, sli + 1, ..., sri. Help Sereja answer all queries.

You can find the definitions for a subsequence and a correct bracket sequence in the notes.

Input

The first line contains a sequence of characters s1, s2, ..., sn (1 ≤ n ≤ 106) without any spaces. Each character is either a "(" or a ")". The second line contains integer m (1 ≤ m ≤ 105) — the number of queries. Each of the next m lines contains a pair of integers. The i-th line contains integers li, ri (1 ≤ li ≤ ri ≤ n) — the description of the i-th query.

Output

Print the answer to each question on a single line. Print the answers in the order they go in the input.

Examples

Input

())(())(())(
7
1 1
2 3
1 2
1 12
8 12
5 11
2 10

Output

0
0
2
10
4
6
6

Note

A subsequence of length |x| of string s = s1s2... s|s| (where |s| is the length of string s) is string x = sk1sk2... sk|x| (1 ≤ k1 < k2 < ... < k|x| ≤ |s|).

A correct bracket sequence is a bracket sequence that can be transformed into a correct aryphmetic expression by inserting characters "1" and "+" between the characters of the string. For example, bracket sequences "()()", "(())" are correct (the resulting expressions "(1)+(1)", "((1+1)+1)"), and ")(" and "(" are not.

For the third query required sequence will be «()».

For the fourth query required sequence will be «()(())(())».


Sereja is a coder and he likes to take part in Codesorfes rounds. However, Uzhland doesn't have good internet connection, so Sereja sometimes skips rounds.

Codesorfes has rounds of two types: Div1 (for advanced coders) and Div2 (for beginner coders). Two rounds, Div1 and Div2, can go simultaneously, (Div1 round cannot be held without Div2) in all other cases the rounds don't overlap in time. Each round has a unique identifier — a positive integer. The rounds are sequentially (without gaps) numbered with identifiers by the starting time of the round. The identifiers of rounds that are run simultaneously are different by one, also the identifier of the Div1 round is always greater.

Sereja is a beginner coder, so he can take part only in rounds of Div2 type. At the moment he is taking part in a Div2 round, its identifier equals to x. Sereja remembers very well that he has taken part in exactly k rounds before this round. Also, he remembers all identifiers of the rounds he has taken part in and all identifiers of the rounds that went simultaneously with them. Sereja doesn't remember anything about the rounds he missed.

Sereja is wondering: what minimum and what maximum number of Div2 rounds could he have missed? Help him find these two numbers.

Input

The first line contains two integers: x (1 ≤ x ≤ 4000) — the round Sereja is taking part in today, and k (0 ≤ k < 4000) — the number of rounds he took part in.

Next k lines contain the descriptions of the rounds that Sereja took part in before. If Sereja took part in one of two simultaneous rounds, the corresponding line looks like: "1 num2 num1" (where num2 is the identifier of this Div2 round, num1 is the identifier of the Div1 round). It is guaranteed that num1 - num2 = 1. If Sereja took part in a usual Div2 round, then the corresponding line looks like: "2 num" (where num is the identifier of this Div2 round). It is guaranteed that the identifiers of all given rounds are less than x.

Output

Print in a single line two integers — the minimum and the maximum number of rounds that Sereja could have missed.

Examples

Input

3 2
2 1
2 2

Output

0 0

Input

9 3
1 2 3
2 8
1 4 5

Output

2 3

Input

10 0

Output

5 9

Note

In the second sample we have unused identifiers of rounds 1, 6, 7. The minimum number of rounds Sereja could have missed equals to 2. In this case, the round with the identifier 1 will be a usual Div2 round and the round with identifier 6 will be synchronous with the Div1 round.

The maximum number of rounds equals 3. In this case all unused identifiers belong to usual Div2 rounds.


Iahub and Iahubina went to a picnic in a forest full of trees. Less than 5 minutes passed before Iahub remembered of trees from programming. Moreover, he invented a new problem and Iahubina has to solve it, otherwise Iahub won't give her the food.

Iahub asks Iahubina: can you build a rooted tree, such that

  * each internal node (a node with at least one son) has at least two sons;
  * node i has ci nodes in its subtree?

Iahubina has to guess the tree. Being a smart girl, she realized that it's possible no tree can follow Iahub's restrictions. In this way, Iahub will eat all the food. You need to help Iahubina: determine if there's at least one tree following Iahub's restrictions. The required tree must contain n nodes.

Input

The first line of the input contains integer n (1 ≤ n ≤ 24). Next line contains n positive integers: the i-th number represents ci (1 ≤ ci ≤ n).

Output

Output on the first line "YES" (without quotes) if there exist at least one tree following Iahub's restrictions, otherwise output "NO" (without quotes).

Examples

Input

4
1 1 1 4

Output

YES

Input

5
1 1 5 2 1

Output

NO


After winning gold and silver in IOI 2014, Akshat and Malvika want to have some fun. Now they are playing a game on a grid made of n horizontal and m vertical sticks.

An intersection point is any point on the grid which is formed by the intersection of one horizontal stick and one vertical stick.

In the grid shown below, n = 3 and m = 3. There are n + m = 6 sticks in total (horizontal sticks are shown in red and vertical sticks are shown in green). There are n·m = 9 intersection points, numbered from 1 to 9.

<image>

The rules of the game are very simple. The players move in turns. Akshat won gold, so he makes the first move. During his/her move, a player must choose any remaining intersection point and remove from the grid all sticks which pass through this point. A player will lose the game if he/she cannot make a move (i.e. there are no intersection points remaining on the grid at his/her move).

Assume that both players play optimally. Who will win the game?

Input

The first line of input contains two space-separated integers, n and m (1 ≤ n, m ≤ 100).

Output

Print a single line containing "Akshat" or "Malvika" (without the quotes), depending on the winner of the game.

Examples

Input

2 2

Output

Malvika

Input

2 3

Output

Malvika

Input

3 3

Output

Akshat

Note

Explanation of the first sample:

The grid has four intersection points, numbered from 1 to 4.

<image>

If Akshat chooses intersection point 1, then he will remove two sticks (1 - 2 and 1 - 3). The resulting grid will look like this.

<image>

Now there is only one remaining intersection point (i.e. 4). Malvika must choose it and remove both remaining sticks. After her move the grid will be empty.

In the empty grid, Akshat cannot make any move, hence he will lose.

Since all 4 intersection points of the grid are equivalent, Akshat will lose no matter which one he picks.


There is a simple way to create hard tasks: take one simple problem as the query, and try to find an algorithm that can solve it faster than bruteforce. This kind of tasks usually appears in OI contest, and usually involves data structures.

Let's try to create a task, for example, we take the "Hamming distance problem": for two binary strings s and t with the same length, the Hamming distance between them is the number of positions at which the corresponding symbols are different. For example, the Hamming distance between "00111" and "10101" is 2 (the different symbols are marked with bold).

We use the Hamming distance problem as a query in the following way: you are given two strings a and b and several queries. Each query will be: what is the Hamming distance between two strings ap1ap1 + 1...ap1 + len - 1 and bp2bp2 + 1...bp2 + len - 1?

Note, that in this problem the strings are zero-based, that is s = s0s1... s|s| - 1.

Input

The first line contains a string a (1 ≤ |a| ≤ 200000). The second line contains a string b (1 ≤ |b| ≤ 200000). Each character of both strings is either "0" or "1".

The third line contains an integer q (1 ≤ q ≤ 400000) — the number of queries. Each of the following q lines contains three integers: p1, p2 and len (0 ≤ p1 ≤ |a| - len; 0 ≤ p2 ≤ |b| - len), these numbers denote the parameters of the current query.

Output

Output q integers — the answers for the queries.

Examples

Input

101010
11110000
3
0 0 3
2 3 4
5 7 1

Output

1
1
0

Input

10001010101011001010100101010011010
101010100101001010100100101010
5
0 0 12
3 9 7
6 4 15
12 15 10
13 3 20

Output

5
4
3
5
13