Monk's birthday is coming this weekend! He wants to plan a Birthday party and is preparing an invite list with his friend Puchi.  He asks Puchi to tell him names to add to the list.
Puchi is a random guy and keeps coming up with names of people randomly to add to the invite list, even if the name is already on the list!  Monk hates redundancy and hence, enlists the names only once.
Find the final invite-list, that contain names without any repetition.

Input:
First line contains an integer T. T test cases follow.
First line of each test contains an integer N, the number of names that Puchi pops up with.

Output:
For each testcase,Output the final invite-list with each name in a new line. The  names in the final invite-list are sorted lexicographically.

Constraints:
1 ≤ T ≤ 10
1 ≤ N ≤ 10^5
1 ≤ Length of each name ≤ 10^5

SAMPLE INPUT
1
7
chandu
paro
rahul
mohi
paro
arindam
rahul

SAMPLE OUTPUT
arindam
chandu
mohi
paro
rahul


Suppose you have a string S which has length N and is indexed from 0 to N−1. String R is the reverse of the string S. The string S is funny if the condition |Si−Si−1|=|Ri−Ri−1| is true for every i from 1 to N−1.

(Note: Given a string str, stri denotes the ascii value of the ith character (0-indexed) of str. |x| denotes the absolute value of an integer x)

SAMPLE INPUT
2
acxz
bcxz

SAMPLE OUTPUT
Funny
Not Funny

Explanation

Consider the 1st testcase acxz :

c-a
=
x-z
= 2

z-x
=
a-c
= 2

Consider the 2st testcase bcxz

|c-b| != |x-z|


Roy is looking for Wobbly Numbers.

An N-length wobbly number is of the form "ababababab..." and so on of length N, where a != b.

A 3-length wobbly number would be of form "aba".
Eg: 101, 121, 131, 252, 646 etc
But 111, 222, 999 etc are not 3-length wobbly number, because here a != b condition is not satisfied.
Also 010 is not a 3-length wobbly number because it has preceding 0. So 010 equals 10 and 10 is not a 3-length wobbly number.

A 4-length wobbly number would be of form "abab".
Eg: 2323, 3232, 9090, 1414 etc

Similarly we can form a list of N-length wobbly numbers.

Now your task is to find K^th wobbly number from a lexicographically sorted list of N-length wobbly numbers. If the number does not exist print -1 else print the K^th wobbly number. See the sample test case and explanation for more clarity.

Input:
First line contains T - number of test cases
Each of the next T lines contains two space separated integers - N and K.

Output:
For each test case print the required output in a new line.

Constraints:
1 ≤ T ≤ 100
3 ≤ N ≤ 1000
1 ≤ K ≤ 100

SAMPLE INPUT
6
3 1
3 2
3 100
4 3
4 4
5 2

SAMPLE OUTPUT
101
121
-1
1313
1414
12121

Explanation

First 10 terms of 3-length wobbly numbers arranged lexicographically is as follows:
101, 121, 131, 141, 151, 161, 171, 181, 191, 202

1st wobbly number of length 3 is 101.
2nd wobbly number of length 3 is 121.
100th wobbly number of length 3 does not exist, so the output is -1.

First 10 terms of 4-length wobbly numbers arranged lexicographically is as follows:
1010, 1212, 1313, 1414, 1515, 1616, 1717, 1818, 1919, 2020

3rd wobbly number of length 4 is 1313.
4th wobbly number of length 4 is 1414.

Similarly 2nd wobbly number of length 5 is 12121


Jack is the most intelligent student in the class.To boost his intelligence,his class teacher gave him a problem named "Substring Count".

Problem :
His Class teacher gave him n strings numbered from 1 to n which consists of only lowercase letters (each having length not more than 10) and then ask Q questions related to the given strings.

Each question is described by the 2 integers L,R and a string str,Now his teacher wants to know how many strings numbered from L to R contains str as a substrings.

As expected, Jack solved this problem with in a minute but he failed to solve it efficiently.Now ,its your turn to teach him.How to do it efficiently?? and save him from punishment.

INPUT
First line of input contains a single integer n denoting the number of strings given by class teacher to jack.Next n lines of input contains n strings (one per line).Next line fo input contains a single integer Q denoting the number of questions asked by his teacher.next Q lines of input contains Q question (one per line) as explained above.

OUTPUT
print the correct answer for each of the question asked by his teacher.

CONSTRAINTS
1 ≤ n ≤ 10000
1 ≤ strlen(str) ≤ 10
1 ≤ Q ≤ 5*10^5
1 ≤ L,R ≤ n

NOTE: strings consist of only lower case characters

SAMPLE INPUT
3
code
coder
coding
2
1 3 code
1 3 co

SAMPLE OUTPUT
2
3

Explanation

Q1:: code coder coding only two out of 3 strings contain cod as substring
Q2:: code coder coding all the 3 strings contain co as substring


In code world all genders are considered equal ( It means their is nothing like male or female). Now their are N distinct  persons living in this hypothetical world. Each person can pair up with any other person or can even  remain single. One day Vbhu planned to visit code world. Being a maths guy , he always try to be mathematical. So he started counting the ways in which N persons living in code world can make pairs or  remain single. A single person can make pair with at most one other person.Seeing that N can be large , Vibhu ask you for help. Now being a great programmer you need to help Vbhu count the number of ways in which N persons living in code world can make pairs or remain single.

Note : Its not necessary that everyone is required to make pair with someone.  Person can remain single also.

Input Format :  First line contain number of test cases T. Then next T lines contain a single integer N , denoting the number of persons living in code world.

Output Format : You need to print the number of ways in which N different persons can make their pairs or stay single. As answer can be large so print it modulo 10^9+7.

Constraints :
1 ≤ T ≤10^5
1 ≤ N ≤10^6
Warning: Large Input/Output data, be careful with certain languages

SAMPLE INPUT
2
2
3

SAMPLE OUTPUT
2
4

Explanation

In first test case , For N=2 answer will be 2. Possible ways are :
    {1},{2} (It means Person 1 and Person 2 are single)
    {1,2}  (It means Person 1 and Person 2 had formed a pair)

For second test case , For N=3 , answer will be 4. Possible ways are :
    {1},{2},{3} (It means all three Persons are single)
    {1,2},{3} (It means Person 1 and Person 2 had formed a pair and Person 3 is single)
    {1},{2,3} (It means Person 2 and Person 3 had formed a pair and Person 1 is single)
    {1,3},{2} (It means Person 1 and Person 3 had formed a pair and Person 2 is single)


We have N camels numbered 1,2,\ldots,N. Snuke has decided to make them line up in a row.

The happiness of Camel i will be L_i if it is among the K_i frontmost camels, and R_i otherwise.

Snuke wants to maximize the total happiness of the camels. Find the maximum possible total happiness of the camel.

Solve this problem for each of the T test cases given.

Constraints

* All values in input are integers.
* 1 \leq T \leq 10^5
* 1 \leq N \leq 2 \times 10^{5}
* 1 \leq K_i \leq N
* 1 \leq L_i, R_i \leq 10^9
* The sum of values of N in each input file is at most 2 \times 10^5.

Input

Input is given from Standard Input in the following format:

T
\mathrm{case}_1
\vdots
\mathrm{case}_T

Each case is given in the following format:

N
K_1 L_1 R_1
\vdots
K_N L_N R_N

Output

Print T lines. The i-th line should contain the answer to the i-th test case.

Example

Input

3
2
1 5 10
2 15 5
3
2 93 78
1 71 59
3 57 96
19
19 23 16
5 90 13
12 85 70
19 67 78
12 16 60
18 48 28
5 4 24
12 97 97
4 57 87
19 91 74
18 100 76
7 86 46
9 100 57
3 76 73
6 84 93
1 6 84
11 75 94
19 15 3
12 11 34

Output

25
221
1354


Print the K-th element of the following sequence of length 32:

1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51

Constraints

* 1 \leq K \leq 32
* All values in input are integers.

Input

Input is given from Standard Input in the following format:

K

Output

Print the K-th element.

Examples

Input

6

Output

2

Input

27

Output

5


We have N balance beams numbered 1 to N. The length of each beam is 1 meters. Snuke walks on Beam i at a speed of 1/A_i meters per second, and Ringo walks on Beam i at a speed of 1/B_i meters per second.

Snuke and Ringo will play the following game:

* First, Snuke connects the N beams in any order of his choice and makes a long beam of length N meters.
* Then, Snuke starts at the left end of the long beam. At the same time, Ringo starts at a point chosen uniformly at random on the long beam. Both of them walk to the right end of the long beam.
* Snuke wins if and only if he catches up to Ringo before Ringo reaches the right end of the long beam. That is, Snuke wins if there is a moment when Snuke and Ringo stand at the same position, and Ringo wins otherwise.

Find the probability that Snuke wins when Snuke arranges the N beams so that the probability of his winning is maximized.

This probability is a rational number, so we ask you to represent it as an irreducible fraction P/Q (to represent 0, use P=0, Q=1).

Constraints

* 1 \leq N \leq 10^5
* 1 \leq A_i,B_i \leq 10^9
* All values in input are integers.

Input

Input is given from Standard Input in the following format:

N
A_1 B_1
A_2 B_2
\vdots
A_N B_N

Output

Print the numerator and denominator of the irreducible fraction that represents the maximum probability of Snuke's winning.

Examples

Input

2
3 2
1 2

Output

1 4

Input

4
1 5
4 7
2 1
8 4

Output

1 2

Input

3
4 1
5 2
6 3

Output

0 1

Input

10
866111664 178537096
705445072 318106937
472381277 579910117
353498483 865935868
383133839 231371336
378371075 681212831
304570952 16537461
955719384 267238505
844917655 218662351
550309930 62731178

Output

697461712 2899550585


Diverta City is a new city consisting of N towns numbered 1, 2, ..., N.

The mayor Ringo is planning to connect every pair of two different towns with a bidirectional road. The length of each road is undecided.

A Hamiltonian path is a path that starts at one of the towns and visits each of the other towns exactly once. The reversal of a Hamiltonian path is considered the same as the original Hamiltonian path.

There are N! / 2 Hamiltonian paths. Ringo wants all these paths to have distinct total lengths (the sum of the lengths of the roads on a path), to make the city diverse.

Find one such set of the lengths of the roads, under the following conditions:

* The length of each road must be a positive integer.
* The maximum total length of a Hamiltonian path must be at most 10^{11}.

Constraints

* N is a integer between 2 and 10 (inclusive).

Input

Input is given from Standard Input in the following format:

N

Output

Print a set of the lengths of the roads that meets the objective, in the following format:

w_{1, 1} \ w_{1, 2} \ w_{1, 3} \ ... \ w_{1, N}
w_{2, 1} \ w_{2, 2} \ w_{2, 3} \ ... \ w_{2, N}
:  :     :
w_{N, 1} \ w_{N, 2} \ w_{N, 3} \ ... \ w_{N, N}

where w_{i, j} is the length of the road connecting Town i and Town j, which must satisfy the following conditions:

* w_{i, i} = 0
* w_{i, j} = w_{j, i} \ (i \neq j)
* 1 \leq w_{i, j} \leq 10^{11} \ (i \neq j)

If there are multiple sets of lengths of the roads that meet the objective, any of them will be accepted.

Examples

Input

3

Output

0 6 15
6 0 21
15 21 0

Input

4

Output

0 111 157 193
111 0 224 239
157 224 0 258
193 239 258 0


A string is called a KEYENCE string when it can be changed to `keyence` by removing its contiguous substring (possibly empty) only once.

Given a string S consisting of lowercase English letters, determine if S is a KEYENCE string.

Constraints

* The length of S is between 7 and 100 (inclusive).
* S consists of lowercase English letters.

Input

Input is given from Standard Input in the following format:

S

Output

If S is a KEYENCE string, print `YES`; otherwise, print `NO`.

Examples

Input

keyofscience

Output

YES

Input

mpyszsbznf

Output

NO

Input

ashlfyha

Output

NO

Input

keyence

Output

YES


You are given N positive integers a_1, a_2, ..., a_N.

For a non-negative integer m, let f(m) = (m\ mod\ a_1) + (m\ mod\ a_2) + ... + (m\ mod\ a_N).

Here, X\ mod\ Y denotes the remainder of the division of X by Y.

Find the maximum value of f.

Constraints

* All values in input are integers.
* 2 \leq N \leq 3000
* 2 \leq a_i \leq 10^5

Input

Input is given from Standard Input in the following format:

N
a_1 a_2 ... a_N

Output

Print the maximum value of f.

Examples

Input

3
3 4 6

Output

10

Input

5
7 46 11 20 11

Output

90

Input

7
994 518 941 851 647 2 581

Output

4527


There are N people standing on the x-axis. Let the coordinate of Person i be x_i. For every i, x_i is an integer between 0 and 10^9 (inclusive). It is possible that more than one person is standing at the same coordinate.

You will given M pieces of information regarding the positions of these people. The i-th piece of information has the form (L_i, R_i, D_i). This means that Person R_i is to the right of Person L_i by D_i units of distance, that is, x_{R_i} - x_{L_i} = D_i holds.

It turns out that some of these M pieces of information may be incorrect. Determine if there exists a set of values (x_1, x_2, ..., x_N) that is consistent with the given pieces of information.

Constraints

* 1 \leq N \leq 100 000
* 0 \leq M \leq 200 000
* 1 \leq L_i, R_i \leq N (1 \leq i \leq M)
* 0 \leq D_i \leq 10 000 (1 \leq i \leq M)
* L_i \neq R_i (1 \leq i \leq M)
* If i \neq j, then (L_i, R_i) \neq (L_j, R_j) and (L_i, R_i) \neq (R_j, L_j).
* D_i are integers.

Input

Input is given from Standard Input in the following format:

N M
L_1 R_1 D_1
L_2 R_2 D_2
:
L_M R_M D_M

Output

If there exists a set of values (x_1, x_2, ..., x_N) that is consistent with all given pieces of information, print `Yes`; if it does not exist, print `No`.

Examples

Input

3 3
1 2 1
2 3 1
1 3 2

Output

Yes

Input

3 3
1 2 1
2 3 1
1 3 5

Output

No

Input

4 3
2 1 1
2 3 5
3 4 2

Output

Yes

Input

10 3
8 7 100
7 9 100
9 8 100

Output

No

Input

100 0

Output

Yes


You are given a permutation p_1,p_2,...,p_N consisting of 1,2,..,N. You can perform the following operation any number of times (possibly zero):

Operation: Swap two adjacent elements in the permutation.

You want to have p_i ≠ i for all 1≤i≤N. Find the minimum required number of operations to achieve this.

Constraints

* 2≤N≤10^5
* p_1,p_2,..,p_N is a permutation of 1,2,..,N.

Input

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

N
p_1 p_2 .. p_N

Output

Print the minimum required number of operations

Examples

Input

5
1 4 3 5 2

Output

2

Input

2
1 2

Output

1

Input

2
2 1

Output

0

Input

9
1 2 4 9 5 8 7 3 6

Output

3


There are N oases on a number line. The coordinate of the i-th oases from the left is x_i.

Camel hopes to visit all these oases. Initially, the volume of the hump on his back is V. When the volume of the hump is v, water of volume at most v can be stored. Water is only supplied at oases. He can get as much water as he can store at a oasis, and the same oasis can be used any number of times.

Camel can travel on the line by either walking or jumping:

* Walking over a distance of d costs water of volume d from the hump. A walk that leads to a negative amount of stored water cannot be done.
* Let v be the amount of water stored at the moment. When v>0, Camel can jump to any point on the line of his choice. After this move, the volume of the hump becomes v/2 (rounded down to the nearest integer), and the amount of stored water becomes 0.

For each of the oases, determine whether it is possible to start from that oasis and visit all the oases.

Constraints

* 2 ≤ N,V ≤ 2 × 10^5
* -10^9 ≤ x_1 < x_2 < ... < x_N ≤ 10^9
* V and x_i are all integers.

Input

Input is given from Standard Input in the following format:

N V
x_1 x_2 ... x_{N}

Output

Print N lines. The i-th line should contain `Possible` if it is possible to start from the i-th oasis and visit all the oases, and `Impossible` otherwise.

Examples

Input

3 2
1 3 6

Output

Possible
Possible
Possible

Input

7 2
-10 -4 -2 0 2 4 10

Output

Impossible
Possible
Possible
Possible
Possible
Possible
Impossible

Input

16 19
-49 -48 -33 -30 -21 -14 0 15 19 23 44 52 80 81 82 84

Output

Possible
Possible
Possible
Possible
Possible
Possible
Possible
Possible
Possible
Possible
Possible
Possible
Impossible
Impossible
Impossible
Impossible


Imagine a game played on a line. Initially, the player is located at position 0 with N candies in his possession, and the exit is at position E. There are also N bears in the game. The i-th bear is located at x_i. The maximum moving speed of the player is 1 while the bears do not move at all.

When the player gives a candy to a bear, it will provide a coin after T units of time. More specifically, if the i-th bear is given a candy at time t, it will put a coin at its position at time t+T. The purpose of this game is to give candies to all the bears, pick up all the coins, and go to the exit. Note that the player can only give a candy to a bear if the player is at the exact same position of the bear. Also, each bear will only produce a coin once. If the player visits the position of a coin after or at the exact same time that the coin is put down, the player can pick up the coin. Coins do not disappear until collected by the player.

Shik is an expert of this game. He can give candies to bears and pick up coins instantly. You are given the configuration of the game. Please calculate the minimum time Shik needs to collect all the coins and go to the exit.

Constraints

* 1 \leq N \leq 100,000
* 1 \leq T, E \leq 10^9
* 0 < x_i < E
* x_i < x_{i+1} for 1 \leq i < N
* All input values are integers.

Input

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

N E T
x_1 x_2 ... x_N

Output

Print an integer denoting the answer.

Examples

Input

3 9 1
1 3 8

Output

12

Input

3 9 3
1 3 8

Output

16

Input

2 1000000000 1000000000
1 999999999

Output

2999999996


There is a factory that inputs the data of the side and diagonal lengths to the machine and cuts out the plastic plate. At this factory, we cut out only parallelogram molds, although they vary in size. You have been ordered by your boss to count the number of rectangles and rhombuses produced among the parallelograms that are cut out.

Create a program that reads "Data to be input to the machine" and outputs the number of rectangles and diamonds manufactured.

<image>

Input

The input is given in the following format:

a1, b1, c1
a2, b2, c2
::

The data to be entered into the machine is given in multiple lines. On line i, the integers ai, bi, which represent the lengths of two adjacent sides of the i-th parallelogram, and the integer ci, which represents the length of the diagonal, are given, separated by commas (1 ≤ ai, bi, ci ≤ 1000). , ai + bi> ci). The number of data does not exceed 100.

Output

The first line outputs the number of rectangles manufactured, and the second line outputs the number of diamonds manufactured.

Example

Input

3,4,5
5,5,8
4,4,4
5,4,3

Output

1
2


In 20XX, the Aizu Chuo Road, which has a total distance of 58km and 6 sections from Atsushiokanomachi, Kitakata City to Minamiaizucho, is scheduled to be completed and opened.

For half a year after opening, the toll will be halved for vehicles that pass the departure IC or arrival IC between 17:30 and 19:30 and have a mileage of 40km or less. However, the charge will be in units of 50 yen and rounded up. The table below is a list of fares and distances.

<image>

<image>

For example, from Kitakata (2) to Aizuwakamatsu (4), the fare is 450 yen and the distance is 12km. If it is half price time zone, it will be 250 yen.

Create a program that calculates and outputs the charge by inputting the departure IC, departure IC transit time, arrival IC, and arrival IC transit time. However, the time entered will be the value in 24-hour notation. In addition, even if you pass at exactly 17:30 and 19:30, it will be included in the half price time zone.

Input

A sequence of multiple datasets is given as input. The end of the input is indicated by a single line of zeros. Each dataset is given in the following format:

d
hd md
a
ha ma

The first line gives the departure IC number d (1 ≤ d ≤ 7), and the second line gives the time hd (0 ≤ hd ≤ 23) and minutes md (0 ≤ md ≤ 59) of the departure IC transit time. ..

The arrival IC number a (1 ≤ a ≤ 7) is given on the third line, and the time ha (0 ≤ ha ≤ 23) and minute ma (0 ≤ ma ≤ 59) of the arrival IC transit time are given on the fourth line. ..

Output

The toll (integer) is output to one line for each data set.

Example

Input

2
17 25
4
17 45
4
17 25
7
19 35
0

Output

250
1300


The educational program (AHK Education) of the Aiz Broadcasting Corporation broadcasts a program called "Play with Tsukuro" for children. Today is the time to make a box with drawing paper, but I would like to see if the rectangular drawing paper I prepared can make a rectangular parallelepiped. However, do not cut or fold the drawing paper.

Given six rectangles, write a program to determine if you can make a rectangular parallelepiped using them.

Input

The input is given in the following format.

h1 w1
h2 w2
h3 w3
h4 w4
h5 w5
h6 w6

The input consists of 6 lines, each line given the integer hi (1 ≤ hi ≤ 1000) for the vertical length of each rectangle and the integer wi (1 ≤ wi ≤ 1000) for the horizontal length.

Output

If a rectangular parallelepiped can be created, "yes" is output, and if it cannot be created, "no" is output. However, since a cube is a kind of rectangular parallelepiped, "yes" is output even if it is a cube.

Examples

Input

2 2
2 3
2 3
2 3
2 2
3 2

Output

yes

Input

2 2
2 3
2 3
2 3
2 2
2 2

Output

no


problem

Chairman K is a regular customer of the JOI pizza shop in the center of JOI city. For some reason, he decided to start a life-saving life this month. So he wanted to order the pizza with the highest calories per dollar among the pizzas he could order at the JOI pizza store. Let's call such a pizza the "best pizza". The "best pizza" is not limited to one type.

At JOI Pizza, you can freely choose from N types of toppings and order the ones placed on the basic dough. You cannot put more than one topping of the same type. You can also order a pizza that doesn't have any toppings on the dough. The price of the dough is $ A and the price of the toppings is $ B. The price of pizza is the sum of the price of the dough and the price of the toppings. That is, the price of a pizza with k types of toppings (0 ≤ k ≤ N) is A + k x B dollars. The total calorie of the pizza is the sum of the calories of the dough and the calories of the toppings placed.

Create a program to find the number of calories per dollar for the "best pizza" given the price of the dough and the price of the toppings, and the calorie value of the dough and each topping.

input

The input consists of N + 3 lines.

On the first line, one integer N (1 ≤ N ≤ 100) representing the number of topping types is written. On the second line, two integers A and B (1 ≤ A ≤ 1000, 1 ≤ B ≤ 1000) are written with a blank as a delimiter. A is the price of the dough and B is the price of the toppings. On the third line, one integer C (1 ≤ C ≤ 10000) representing the number of calories in the dough is written.

On the 3 + i line (1 ≤ i ≤ N), one integer Di (1 ≤ Di ≤ 10000) representing the number of calories in the i-th topping is written.

output

Print the number of calories per dollar for the "best pizza" in one line. However, round down the numbers after the decimal point and output as an integer value.

Input / output example

Input example 1

3
12 2
200
50
300
100

Output example 1

37

In I / O Example 1, with the second and third toppings, 200 + 300 + 100 = 600 calories gives a pizza of $ 12 + 2 x 2 = $ 16.
This pizza has 600/16 = 37.5 calories per dollar. Since this is the "best pizza", we output 37, rounded down to the nearest whole number of 37.5.

Input example 2

Four
20 3
900
300
100
400
1300

Output example 2

100

The question text and the data used for the automatic referee are the question text and the test data for scoring, which are created and published by the Japan Committee for Information Olympics.

Example

Input

3
12 2
200
50
300
100

Output

37


Problem

KND is a student programmer at the University of Aizu. His chest is known to be very sexy.

<image>

For simplicity, the part of the skin that can be seen from the chest is represented by the isosceles triangle ABC in the figure. However, due to the slack in the clothes, the two sides AC and BC (where these lengths are l), which have the same length, actually have an additional length x minutes. In order to increase the area of the open part, let's make two new triangular ADCs and BECs by pulling the slack part. Points D and E exist outside the triangle ABC. These two new triangles are caused by slack, and the sum of the lengths of side BE and side EC and the sum of the lengths of side AD and side DC must be l + x. You determine the points D and E so that the sum M of the areas of these three triangles is maximized. As KND's neighbor, you decide to write a program to calculate the maximum area of skin (M) to look out of your clothes, using a, l, x as inputs to find out how sexy his chest is. did.

Constraints

The input satisfies the following conditions.

* All inputs are integers.
* 1 ≤ a ≤ 1000
* 1 ≤ l ≤ 1000
* 1 ≤ x ≤ 1000

Input

The input consists of multiple test cases. One test case is given in the following format. The end of input is indicated by EOF.

a l x

here,

* a: Length of side AB of triangle ABC
* l: Length of two sides AC and BC of triangle ABC
* x: Slack on two sides AC, BC

Is.

Output

Output the maximum area for each test case on one line. This value should not differ more than 10-5 from the value of the judge output.

Example

Input

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

Output

3.9681187851
6.7970540913
6.5668891783
13.9527248554


The King of a little Kingdom on a little island in the Pacific Ocean frequently has childish ideas. One day he said, “You shall make use of a message relaying game when you inform me of something.” In response to the King’s statement, six servants were selected as messengers whose names were Mr. J, Miss C, Mr. E, Mr. A, Dr. P, and Mr. M. They had to relay a message to the next messenger until the message got to the King.

Messages addressed to the King consist of digits (‘0’-‘9’) and alphabet characters (‘a’-‘z’, ‘A’-‘Z’). Capital and small letters are distinguished in messages. For example, “ke3E9Aa” is a message.

Contrary to King’s expectations, he always received wrong messages, because each messenger changed messages a bit before passing them to the next messenger. Since it irritated the King, he told you who are the Minister of the Science and Technology Agency of the Kingdom, “We don’t want such a wrong message any more. You shall develop software to correct it!” In response to the King’s new statement, you analyzed the messengers’ mistakes with all technologies in the Kingdom, and acquired the following features of mistakes of each messenger. A surprising point was that each messenger made the same mistake whenever relaying a message. The following facts were observed.

Mr. J rotates all characters of the message to the left by one. For example, he transforms “aB23d” to “B23da”.

Miss C rotates all characters of the message to the right by one. For example, she transforms “aB23d” to “daB23”.

Mr. E swaps the left half of the message with the right half. If the message has an odd number of characters, the middle one does not move. For example, he transforms “e3ac” to “ace3”, and “aB23d” to “3d2aB”.

Mr. A reverses the message. For example, he transforms “aB23d” to “d32Ba”.

Dr. P increments by one all the digits in the message. If a digit is ‘9’, it becomes ‘0’. The alphabet characters do not change. For example, he transforms “aB23d” to “aB34d”, and “e9ac” to “e0ac”.

Mr. M decrements by one all the digits in the message. If a digit is ‘0’, it becomes ‘9’. The alphabet characters do not change. For example, he transforms “aB23d” to “aB12d”, and “e0ac” to “e9ac”.

The software you must develop is to infer the original message from the final message, given the order of the messengers. For example, if the order of the messengers is A -> J -> M -> P and the message given to the King is “aB23d”, what is the original message? According to the features of the messengers’ mistakes, the sequence leading to the final message is

A           J           M           P
“32Bad” --> “daB23” --> “aB23d” --> “aB12d” --> “aB23d”.

As a result, the original message should be “32Bad”.

Input

The input format is as follows.

n
The order of messengers
The message given to the King
.
.
.
The order of messengers
The message given to the King

The first line of the input contains a positive integer n, which denotes the number of data sets. Each data set is a pair of the order of messengers and the message given to the King. The number of messengers relaying a message is between 1 and 6 inclusive. The same person may not appear more than once in the order of messengers. The length of a message is between 1 and 25 inclusive.

Output

The inferred messages are printed each on a separate line.

Example

Input

5
AJMP
aB23d
E
86AE
AM
6
JPEM
WaEaETC302Q
CP
rTurnAGundam1isdefferentf

Output

32Bad
AE86
7
EC302QTWaEa
TurnAGundam0isdefferentfr


Example

Input

ACM

Output

0


Story

At UZIA High School in the sky city AIZU, the club activities of competitive programming are very active. N Red Coders and n Blue Coders belong to this club.

One day, during club activities, Red Coder and Blue Coder formed a pair, and from this club activity, n groups participated in a contest called KCP. At this high school, it is customary for paired students to shake hands, so the members decided to find their partner right away.

The members run at full speed, so they can only go straight. In addition, the members want to make the total distance traveled by each member as small as possible.

There are two circular tables in the club room.

Problem

There are two circles, n red dots, and n blue dots on a two-dimensional plane. The center coordinates of the two circles are (x1, y1) and (x2, y2), respectively, and the radii are r1 and r2, respectively. The red point i is at the coordinates (rxi, ryi) and the blue point j is at the coordinates (bxj, by j).

You need to repeat the following operation n times.
Select one red point and one blue point from the points that have not been selected yet, set two common destinations, and move each of the two points straight toward that destination. The destination may be set anywhere as long as it is on a two-dimensional plane. However, since the selected two points cannot pass through the inside of the circle when moving, it is not possible to set the destination where such movement occurs.

Minimize the total distance traveled after n operations. If you cannot perform n operations, output "Impossible" (excluding "") instead.

Constraints

The input satisfies the following conditions.

* 1 ≤ n ≤ 100
* -1000 ≤ xi, yi ≤ 1000
* 1 ≤ ri ≤ 50
* -1000 ≤ rxi, ryi, bxi, byi ≤ 1000
* There can never be more than one point at the same coordinates
* Even if the radius of any circle is changed within the absolute value of 10-9, only the absolute value of 10-3 changes at most.
* Even if the radius of any circle is changed within the absolute value of 10-9, the "Impossible" case remains "Impossible".
* The solution does not exceed 10000
* All points are more than 10-3 away from the circle, and the points are not on the circumference or contained in the circle.
* The two circles do not have a common area and are guaranteed to be at least 10-3 apart.

Input

The input is given in the following format.

n
x1 y1 r1
x2 y2 r2
rx1 ry1
rx2 ry2
...
rxn ryn
bx1 by1
bx2 by2
...
bxn byn

All inputs are given as integers.
N is given on the first line.
The second line is given x1, y1, r1 separated by blanks.
On the third line, x2, y2, r2 are given, separated by blanks.
Lines 4 to 3 + n are given the coordinates of the red points (rxi, ryi) separated by blanks.
The coordinates of the blue points (bxj, byj) are given on the 3 + 2 × n lines from 4 + n, separated by blanks.

Output

Output the minimum value of the total distance traveled when n operations are performed on one line. The output is acceptable if the absolute error from the output of the judge solution is within 10-2.
If you cannot perform n operations, output "Impossible" (excluding "") instead.

Examples

Input

2
3 3 2
8 3 2
0 3
3 7
8 0
8 7

Output

13.8190642862

Input

2
3 3 2
8 3 2
3 0
3 7
8 0
8 7

Output

10.0000000000

Input

2
3 3 2
8 3 2
0 0
0 5
11 0
11 5

Output

22.0000000000

Input

1
10 10 10
31 10 10
15 19
26 1

Output

Impossible


You are working as a private teacher. Since you are giving lessons to many pupils, you are very busy, especially during examination seasons. This season is no exception in that regard.

You know days of the week convenient for each pupil, and also know how many lessons you have to give to him or her. You can give just one lesson only to one pupil on each day. Now, there are only a limited number of weeks left until the end of the examination. Can you finish all needed lessons?

Input

The input consists of multiple data sets. Each data set is given in the following format:

N W
t1 c1
list-of-days-of-the-week
t2 c2
list-of-days-of-the-week
...
tN cN
list-of-days-of-the-week

A data set begins with a line containing two integers N (0 < N ≤ 100) and W (0 < W ≤ 1010 ). N is the number of pupils. W is the number of remaining weeks. The following 2N lines describe information about the pupils. The information for each pupil is given in two lines. The first line contains two integers ti and ci. ti (0 < ti ≤ 1010 ) is the number of lessons that the i-th pupil needs. ci (0 < ci ≤ 7) is the number of days of the week convenient for the i-th pupil. The second line is the list of ci convenient days of the week (Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, and Saturday).

The end of input is indicated by a line that contains two zeros. This line should not be processed.

Output

For each data set, print “Yes” if you can finish all lessons, or “No” otherwise.

Example

Input

2 2
6 3
Monday Tuesday Wednesday
8 4
Thursday Friday Saturday Sunday
2 2
7 3
Monday Tuesday Wednesday
9 4
Thursday Friday Saturday Sunday
0 0

Output

Yes
No


A rabbit is playing a role-playing game. Just before entering the castle, he was ambushed by an enemy!

It was a battle between one hero operated by a rabbit and n enemies. Each character has four stats, health hi, attack power ai, defense power di, and agility si. I = 0 is the information of the main character, 1 ≤ i ≤ n is the information of each enemy.

The battle is turn-based. Each turn, the surviving characters attack in descending order of agility. The enemy always attacks the hero. The hero attacks one enemy, but which enemy to attack Can be selected by the main character every turn. When a character with attack power a attacks a character with defense power d, max {a − d, 0} damage is dealt. The total damage received is greater than or equal to the value of physical strength. The character becomes incapacitated immediately. The battle ends when the main character becomes incapacitated, or when all the enemies become incapacitated.

Input

1 ≤ n ≤ 40 000
1 ≤ hi, ai, di, si ≤ 1 000 000 000 (integer)
si are all different.

Output

When the hero is sure to be incapacitated, output -1. Otherwise, output the minimum total damage to the hero in one line.

Examples

Input

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

Output

4

Input

1
1 1 1 1
10000 10000 10000 10000

Output

-1


E: Markup language has declined

It's been centuries since we humans have been declining slowly. The earth may already belong to "Progurama". Programa-sans with an average height of 170 cm, 7 heads, high intelligence, and loves Kodingu. I have returned to my hometown of Nibunki, becoming an important international civil servant, "Esui," who is in charge of the relationship between Mr. Programa and people. I chose this job because it's a job that I can do even at my grandfather's age, so I thought it would be easy.

One day, Mr. Programa and his colleagues gave me something like two design documents. According to Mr. Programa, various information can be easily exchanged using texts and scripts.

The first design document was an explanation of the file that represents the sentence structure. The filename of this file ends with .dml and is called a DML file.

In the DML file, the structure of the sentence is expressed by sandwiching it with a character string called a tag. There are start tag and end tag as tags.

<Start tag name> Contents </ end tag name>

It is represented by the element of. At this time, the start tag name and the end tag name are represented by the same character string.

Tags can be nested and can be <tagA> <tagB> </ tagB> </ tagA>. Also, structures like <tagA> <tagB> </ tagA> </ tagB> are not allowed.

The tag name in the DML file is an arbitrary character string except for some special ones. The following five special tags are available.

* Tag name: dml
* Represents the roots of all tags.
* This start tag always appears only once at the beginning of the file, and the end tag of this tag appears only once at the end of the file.
* Tag name: script
* It always appears at the beginning of the dml tag or at the end tag.
* This tag cannot have a nested structure inside.
* Associate the script file enclosed in this tag.
* The character string enclosed in this tag is not output.
* Tag name: br
* A line break will be performed when displaying.
* Does not have an end tag.
* Tag name: link
* This tag cannot have a nested structure inside.
* When the user clicks on the character string enclosed in this tag, the entire current screen is erased and the DML file with the file name represented by that character string is displayed.
* Tag name: button
* This tag cannot have a nested structure inside.
* When the user clicks on the character string enclosed in this tag, the subroutine with the name represented by that character string is executed from the scripts associated with the script tag.

Tag names are represented only in uppercase and lowercase letters. No spaces appear in the tag name. The character strings that appear in the DML file are uppercase and lowercase letters, spaces,'<','>', and'/'. It is also possible that a tag with the same name exists.

Character strings other than tags enclosed by other than script tags are output left-justified from the upper left (0, 0) of the screen, and line breaks do not occur until the screen edge or br tag appears.

The second design document was an explanation of the DS file that shows the operation when the button is pressed in the DML file. Subroutines are arranged in the DS file.

Subroutine name {
formula;
formula;
...;
}

The semicolon marks the end of the expression.

For example, suppose you have a sentence in a DML file that is enclosed in <title>? </ Title>. The possible expressions at that time are the following four substitution expressions.

title.visible = true;
title.visible = false;
title.visible! = true;
title.visible! = false;

Assigning a boolean value to visible changes whether the content of the tag is displayed or not. If it disappears, the text after that will be packed to the left. When the currently displayed DML file is rewritten by clicking the link tag at the beginning, the initial values are all true.

'! ='Represents a negative assignment. In the above example, the 1st and 4th lines and the 2nd and 3rd lines are equivalent, respectively.

The expression can also change multiple values at the same time as shown below.

titleA.visible = titleB.visible = true;

At this time, processing is performed in order from the right. That is,

titleB.visible = true;
titleA.visible = titleB.visible;

Is equivalent to the two lines of. However, this representation is for convenience only, and the tag is not specified on the far right of the statement in the script. Also,

titleA.visible! = titleB.visible = true;

Is

titleB.visible = true;
titleA.visible! = titleB.visible;

Is equivalent to.

The tag is specified by narrowing down with'.'. For example

dml.body.title

Refers to the title tag, which is surrounded by the dml tag and the body tag. However, the script tag and br tag are not used or specified for narrowing down.

At this time, please note that the elements to be narrowed down are not always directly enclosed. For example, when   <c> </ c>  , both a.b.c and a.c can point to c.

Also, if there are tags with the same name, the number of specified tags is not limited to one. If the specified tag does not exist, the display will not be affected, but if it appears when changing multiple values at the same time, it will be evaluated as if it existed.

BNF is as follows.


E --Disappear Drive

Story

The person in D likes basketball, but he likes shooting, so other techniques are crazy. I'm not particularly good at dribbling, and when I enter the opponent's defensive range, I always get the ball stolen. So I decided to come up with a deadly dribble that would surely pull out any opponent. After some effort, he finally completed the disappearing drive, "Disapia Drive".

This Apia Drive creates a gap by provoking the opponent to deprive him of his concentration and take his eyes off, and in that gap he goes beyond the wall of dimension and slips through the opponent's defensive range. It's a drive. However, crossing the dimensional wall puts a heavy burden on the body, so there is a limit to the number of times the dimensional wall can be crossed. Also, because he always uses his concentration, he can only change direction once, including normal movements. How do you move on the court to reach the goal in the shortest time without being robbed of the ball?

Problem

Consider a rectangle on a two-dimensional plane with (0,0) at the bottom left and (50,94) at the top right. In addition, there are N circles on this plane, the center position of the i-th circle is (x_i, y_i), and the radius is r_i. There is no overlap between the circles.

Let (25,0) be the point S and (25,94) be the point G, and consider the route from S to G. A "path" consists of (1) a line segment connecting S and G, or (2) a combination of a line segment SP and a line segment GP at any point P inside a rectangle. In the middle of the route from S to G, the period from entering the inside of a circle to exiting the inside of the circle is defined as "the section passing through the inside of the circle". However, it is assumed that the circumferences of the rectangle and the circle are not included in the rectangle and the circle, respectively.

Find the length of the shortest route among the routes where the number of sections passing through the inside of the circle is D or less. If you can't reach the goal, return -1.

Input

The input consists of the following format.

N D
x_1 y_1 r_1
...
x_N y_N r_N

The first line consists of two integers, and the number N of circles and the number of times D that can pass inside the circle are given, separated by one blank character. The following N lines are given circle information. The i + 1 line (1 \ leq i \ leq N) consists of three integers, and the x-coordinate x_i, y-coordinate y_i, and radius r_i of the center of the i-th circle are given by separating them with one blank character.

Constraints:

* 0 \ leq N \ leq 5
* 0 \ leq D \ leq 5
* 0 \ leq x_i \ leq 50
* 0 \ leq y_i \ leq 94
* 1 \ leq r_i \ leq 100
* It can be assumed that any two circles are separated by 10 ^ {-5} or more.
* It can be assumed that S and G are not included inside any circle.
* It can be assumed that S and G are separated from any circle by 10 ^ {-5} or more.
* It can be assumed that the point P in the shortest path is more than 10 ^ {-5} away from the circumference of the rectangle and any circumference.

Output

Output the length of the shortest path on one line. Be sure to start a new line at the end of the line. However, if you cannot reach the goal, return -1. Absolute error or relative error of 10 ^ {-7} or less is allowed for the correct answer.

Sample Input 1

Ten
25 47 10

Sample Output 1

96.2027355887

DisappearDrive_sample1.png

The detour route is the shortest because it cannot disappear.

Sample Input 2

1 1
25 47 10

Sample Output 2

94.0000000000

DisappearDrive_sample2.png

It can disappear, so you just have to go straight through it.

Sample Input 3

Ten
20 47 5

Sample Output 3

94.0000000000

DisappearDrive_sample3.png

Since the circumference is not included in the circle, it can pass through without disappearing.

Sample Input 4

Ten
25 47 40

Sample Output 4

-1

DisappearDrive_sample4.png

You can't reach the goal because you can't disappear or detour.

Sample Input 5

5 2
11 10 16
33 40 18
20 66 10
45 79 14
22 85 8

Sample Output 5

96.1320937224

DisappearDrive_sample5.png

Example

Input

1 0
25 47 10

Output

96.2027355887


Example

Input

3 2
3
1 2 1
2 3 2
3 3 1

Output

1


D: The Diversity of Prime Factorization

Problem

Ebi-chan has the FACTORIZATION MACHINE, which can factorize natural numbers M (greater than 1) in O ($ \ log $ M) time! But unfortunately, the machine could display only digits and white spaces.

In general, we consider the factorization of M as p_1 ^ {e_1} \ times p_2 ^ {e_2} \ times ... \ times p_K ^ {e_K} where (1) i <j implies p_i <p_j and (2) p_i is prime. Now, she gives M to the machine, and the machine displays according to the following rules in ascending order with respect to i:

* If e_i = 1, then displays p_i,
* otherwise, displays p_i e_i.

For example, if she gives either `22` or` 2048`, then `2 11` is displayed. If either` 24` or `54`, then` 2 3 3`.

Okay, Ebi-chan has written down the output of the machine, but she notices that she has forgotten to write down the input! Now, your task is to count how many natural numbers result in a noted output. Note that Ebi-chan has mistaken writing and no input could result in the output.

The answer could be too large, so, you must output it modulo 10 ^ 9 + 7 (prime number).

Input

N
q_1 q_2 $ \ cdots $ q_N

In the first line, the number of the output of the machine is given. In the second line, the output of the machine is given.

Constraints

* 1 \ leq N \ leq 10 ^ 5
* 2 \ leq q_i \ leq 10 ^ 6 (1 \ leq i \ leq N)

Output

Print the number of the natural numbers that result in the given output of the machine.

Sample Input 1

3
2 3 3

Sample Output for Input 1

2

24 = 2 ^ 3 \ times 3 and 54 = 2 \ times 3 ^ 3 satisfy the condition.

Sample Input 2

3
2 3 4

Sample Output 2 for Input 2

1

Only 162 = 2 \ times 3 ^ 4 satisfies the condition. Note that 4 is not prime.

Sample Input 3

3
3 5 2

Sample Output for Input 3

1

Since 2 <3 <5, only 75 = 3 \ times 5 ^ 2 satisfies the condition.

Sample Input 4

1
Four

Sample Output for Input 4

0

Ebi-chan should have written down it more carefully.

Example

Input

3
2 3 3

Output

2


Problem

Tomorrow is finally the day of the excursion to Maizu Elementary School. Gatcho, who attends Maizu Elementary School, noticed that he had forgotten to buy tomorrow's sweets because he was so excited. Gaccho wants to stick to sweets so that he can enjoy the excursion to the fullest.

Gaccho gets a $ X $ yen allowance from his mother and goes to buy sweets. However, according to the rules of elementary school, the total amount of sweets to bring for an excursion is limited to $ Y $ yen, and if it exceeds $ Y $ yen, all sweets will be taken up by the teacher.

There are $ N $ towns in the school district where Gaccho lives, and each town has one candy store. Each town is assigned a number from 1 to $ N $, and Gaccho lives in town 1. Each candy store sells several sweets, and the price per one and the satisfaction level that you can get for each purchase are fixed. However, the number of sweets in stock is limited. Also, Gaccho uses public transportation to move between the two towns, so to move directly from town $ i $ to town $ j $, you only have to pay $ d_ {i, j} $ yen. It takes.

At first, Gaccho is in Town 1. Gaccho should make sure that the sum of the total cost of moving and the price of the sweets you bought is within $ X $ yen, and the total price of the sweets you bought is within $ Y $ yen. I'm going to buy sweets. You must have arrived at Town 1 at the end. Gaccho wants to maximize the total satisfaction of the sweets he bought. Find the total satisfaction when you do the best thing.

Constraints

The input satisfies the following conditions.

* $ 1 \ leq N \ leq 14 $
* $ 1 \ leq X \ leq 10000 $
* $ 1 \ leq Y \ leq min (1000, X) $
* $ 1 \ leq K \ leq 300 $
* $ 1 \ leq a_i \ leq 1000 $
* $ 1 \ leq b_i \ leq 1000 $
* $ 1 \ leq c_i \ leq 1000 $
* $ 0 \ leq d_ {i, j} \ leq 10000 $
* $ d_ {i, i} = 0 $

Input

All inputs are given as integers in the following format:

$ N $ $ X $ $ Y $
Information on candy stores in town 1
Information on candy stores in town 2
...
Information on candy stores in town $ N $
$ d_ {1,1} $ $ d_ {1,2} $ ... $ d_ {1, N} $
$ d_ {2,1} $ $ d_ {2,2} $ ... $ d_ {2, N} $
...
$ d_ {N, 1} $ $ d_ {N, 2} $ ... $ d_ {N, N} $

On the first line, the number of towns $ N $, the amount of money you have $ X $, and the maximum amount you can use to buy sweets $ Y $ are given, separated by blanks.
From the second line, information on each $ N $ candy store is given.
In the following $ N $ row and $ N $ column, the amount $ d_ {i, j} $ required to go back and forth between town $ i $ and town $ j $ is given, separated by blanks.

Information on candy stores in each town is given in the following format.

$ K $
$ a_1 $ $ b_1 $ $ c_1 $
$ a_2 $ $ b_2 $ $ c_2 $
...
$ a_K $ $ b_K $ $ c_K $

The first line gives $ K $, the number of types of sweets sold at the candy store. In the following $ K $ line, the price of one candy $ a_i $, the satisfaction level $ b_i $ per candy, and the number of stocks $ c_i $ are given, separated by blanks.

Output

Output the maximum value of the total satisfaction level on one line.

Examples

Input

1 10 10
3
1 10 1
2 20 2
3 30 3
0

Output

100

Input

2 10 10
3
1 10 1
2 20 2
3 30 3
1
5 200 1
0 2
3 0

Output

200

Input

3 10 10
1
1 1 1
1
3 3 3
1
5 5 5
0 1 0
1 0 0
0 1 0

Output

10

Input

4 59 40
1
7 6 3
1
10 3 9
2
9 8 5
7 6 10
4
8 2 9
1 7 1
7 7 9
1 2 3
0 28 7 26
14 0 10 24
9 6 0 21
9 24 14 0

Output

34


A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7.

Write a program which reads a list of N integers and prints the number of prime numbers in the list.

Constraints

1 ≤ N ≤ 10000

2 ≤ an element of the list ≤ 108

Input

The first line contains an integer N, the number of elements in the list.

N numbers are given in the following lines.

Output

Print the number of prime numbers in the given list.

Examples

Input

5
2
3
4
5
6

Output

3

Input

11
7
8
9
10
11
12
13
14
15
16
17

Output

4


Draw a chessboard which has a height of H cm and a width of W cm. For example, the following figure shows a chessboard which has a height of 6 cm and a width of 10 cm.

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

Note that the top left corner should be drawn by '#'.

Constraints

* 1 ≤ H ≤ 300
* 1 ≤ W ≤ 300

Input

The input consists of multiple datasets. Each dataset consists of two integers H and W separated by a single space.

The input ends with two 0 (when both H and W are zero).

Output

For each dataset, print the chessboard made of '#' and '.'.

Print a blank line after each dataset.

Example

Input

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

Output

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

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

#.#
.#.
#.#

#.
.#

#


There are N+1 lights. Lights are placed at  (0, 0), (1, 0), (2, 0) ... (N, 0). Initially all the lights are on. You want to turn off all of them one after one.  You want to follow a special pattern in turning off the lights.

You will start at (0, 0). First, you walk to the right most light that is on, turn it off. Then you walk to the left most light that is on, turn it off. Then again to the right most light that is on and so on. You will stop after turning off all lights. You want to know how much distance you walked in the process. Note that distance between (a,0) and (b,0) is |a-b|.

Input
The first line of the input contains an integer T denoting the number of test cases. Each test case has a single integer N on separate line.

Output
For each test case, output the distance you walked.

Constraints

1 ≤ T ≤ 10^5
1 ≤ N ≤ 10^5

Example
Input
2
1
2

Output
2
5

Explanation
Testcase #2
You are initially at (0, 0)
Right most on-light is (2, 0). Distance = 2.
Now you are at (2, 0).
Left most on-light is (0, 0). Distance = 2.
Now you are at (0, 0)
Right most on-light is (1, 0). Distance = 1.
Now you are at (1, 0) and all lights are turned off.
Total distance walked = 5.


Chef has a an array A consisting of N elements. He wants to add some elements into the array as per the below mentioned process.
After each minute, Chef iterates over the array in order from left to right, and takes every two neighbouring pair of elements, say x and y, he adds a new element x + y in the middle of elements x and y.
For example, if initial array A = {1, 6, 9}.

After first minute, the array A will be equal to {1, 7, 6, 15, 9}. Please note that the elements shown in the bold font are the newly added elements during first minute. As you can observe that 7 = 1 + 6, and 15 = 6 + 9.
After second minute, the array will be {1, 8, 7, 13, 6, 21, 15, 24, 9}. Once again, elements added during the second minute, are shown in bold.

Chef wants to know the sum of elements between x^th and y^th positions in the array A (i.e. Ax + Ax + 1 + ... + Ay) after m minutes. As the answer could be large, output it modulo 10^9+7 (1000000007). Please note that we use 1 based indexing in the problem.

Input

The first line of the input contains an integer T denoting the number of test cases. The description of T test cases follows.
The first line of each test case contains four space-separated integers N, m, x, y denoting the number of elements in the array A in the beginning, amount of minutes and range for finding sum.
The second line contains N space-separated integers A1, A2, ..., AN denoting the array A in the beginning.

Output

For each test case, output a single line containing an integer corresponding to the sum of elements between x^th and y^th positions in the array A after m minutes modulo 10^9+7.

Constraints

1 ≤ T ≤ 10
1 ≤ N ≤ 10^5
1 ≤ Ai ≤ 10^3
1 ≤ m ≤ 30
1 ≤ x ≤ y ≤ size of the array A (|A|) after m minutes

Example
Input:
2
3 1 1 5
1 6 9
3 2 6 7
1 6 9

Output:
38
36

Explanation
Example case 1. After the first minute A = {1, 7, 6, 15, 9} and sum of all elements will be 38.
Example case 2. After the second minute the array A will be {1, 8, 7, 13, 6, 21, 15, 24, 9} and sum of elements between 6^th and 7^th equals to 21 + 15 = 36.


Middle Strings

Miss Roma has got a new job in a computer agency. To test her skills the manager has appointed her with a small project.
She will get a string of any length but of ODD length and what she has to do
is finding a center string of length 3 in the original string.

For Example: She gets a string 'CANDY' then she needs to display the output 'AND'.

You have to help her. So, develop a code which accepts a string and displays the middle string of length 3.

Strings must be submitted in UPPER CASE only.
 If String is of length less than 3 display output as 0.

Input
First line consists of a string of  ODD length which is in uppercase.

Output
Second Line displays the appropriate output of length 3

Example

Input:
CANDY

Output:
AND

Input:
SOLVING

Output:
LVI


You might have heard about our new goodie distribution program aka the "Laddu Accrual System". This problem is designed to give you a glimpse of its rules. You can read the page once before attempting the problem if you wish, nonetheless we will be providing all the information needed here itself.

Laddu Accrual System is our new goodie distribution program. In this program, we will be distributing Laddus in place of goodies for your winnings and various other activities (described below), that you perform on our system. Once you collect enough number of Laddus, you can then redeem them to get yourself anything from a wide range of CodeChef goodies.

Let us know about various activities and amount of laddus you get corresponding to them.

Contest Win (CodeChef’s Long, Cook-Off, LTIME, or any contest hosted with us) : 300 + Bonus (Bonus = 20 - contest rank). Note that if your rank is > 20, then you won't get any bonus.
Top Contributor on Discuss : 300
Bug Finder	: 50 - 1000 (depending on the bug severity). It may also fetch you a CodeChef internship!
Contest Hosting	 : 50

You can do a checkout for redeeming laddus once a month. The minimum laddus redeemable at Check Out are 200 for Indians and 400 for the rest of the world.

You are given history of various activities of a user. The user has not redeemed any of the its laddus accrued.. Now the user just wants to redeem as less amount of laddus he/she can, so that the laddus can last for as long as possible. Find out for how many maximum number of months he can redeem the laddus.

Input

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

First line contains an integer followed by a string denoting activities, origin respectively, where activities denotes number of activities of the user, origin denotes whether the user is Indian or the rest of the world. origin can be "INDIAN" or "NON_INDIAN".
For each of the next activities lines, each line contains an activity.
			An activity can be of four types as defined above.

Contest Win : Input will be of form of CONTEST_WON rank, where rank denotes the rank of the user.
Top Contributor : Input will be of form of TOP_CONTRIBUTOR.
Bug Finder : Input will be of form of BUG_FOUND severity, where severity denotes the severity of the bug.
Contest Hosting : Input will be of form of CONTEST_HOSTED.

Output

For each test case, find out the maximum number of months for which the user can redeem the laddus accrued.

Constraints

1 ≤ T, activities ≤ 100
1 ≤ rank ≤ 5000
50 ≤ severity ≤ 1000

Example
Input:
2
4 INDIAN
CONTEST_WON 1
TOP_CONTRIBUTOR
BUG_FOUND 100
CONTEST_HOSTED
4 NON_INDIAN
CONTEST_WON 1
TOP_CONTRIBUTOR
BUG_FOUND 100
CONTEST_HOSTED

Output:
3
1

Explanation
In the first example,

For winning contest with rank 1, user gets 300 + 20 - 1 = 319 laddus.
For top contributor, user gets 300 laddus.
For finding a bug with severity of 100, user gets 100 laddus.
For hosting a contest, user gets 50 laddus.

So, overall user gets 319 + 300 + 100 + 50 = 769 laddus.
Now, the user is an Indian user, he can redeem only 200 laddus per month. So, for first three months, he will redeem 200 * 3 = 600 laddus. The remaining 169 laddus, he can not redeem as he requires at least 200 laddues in a month to redeem.
So, answer is 3.

In the second example, user is a non-Indian user, he can redeem 400 laddues per month. So, in the first month, he will redeem 400 laddus. The remaining 369 laddus, he can not redeem as he requires at least 400 laddues in a month to redeem.
So, answer is 1.


George is getting tired of the decimal number system.  He intends to switch and use the septenary (base 7) number system for his future needs.  Write a program to help George start his transformation into the septenary number system by taking in a list of decimal numbers and print out the corresponding septenary number.

Input
A list of numbers in decimal format ending with -1.

Output
A list of numbers in septenary.

Example
Input:
1 2 88 42 99 -1

Output:
1 2 154 60 201


The bustling town of Siruseri has just one sports stadium. There
are a number of schools, colleges, sports associations, etc. that
use this stadium as the venue for their sports events.
 Anyone interested in using the stadium has to apply to the Manager
of the stadium indicating both the starting date (a positive integer
S) and the length of the sporting event in days (a positive integer D)
they plan to organise.  Since these requests could overlap it may not
be possible to satisfy everyone.

It is the job of the Manager to decide who gets to use the
stadium and who does not. The Manager, being a genial man, would like
to keep as many organisations happy as possible and hence would
like to allocate the stadium so that maximum number of events are held.

Suppose, for example, the Manager receives the following 4 requests:

Event No.
Start Date
Length

125
297
3156
493

He would allot the stadium to events 1, 4 and 3. Event 1 begins on day 2
and ends on day 6, event 4 begins on day 9 and ends on day 11 and event
3 begins on day 15 and ends on day 20. You can verify that it is not possible
to schedule all the 4 events (since events 2 and 3 overlap  and only one of
them can get to use the stadium).

Your task is to help the manager find the best possible allotment (i.e.,
the maximum number of events that can use the stadium).

Input format

The first line of the input will contain a single integer N (N ≤ 100000)
indicating the number of events for which the Manager has received a request.
Lines 2,3,...,N+1  describe the requirements of the N events.
Line i+1 contains two integer Si and Di indicating the starting date
and the duration of event i. You may assume that 1 ≤ Si ≤ 1000000 and
1 ≤ Di ≤ 1000.

Output format

Your output must consist of a single line containing a single integer M,
indicating the maximum possible number of events that can use the stadium.

Example:
Sample input:

4
2 5
9 7
15 6
9 3

Sample output:

3


In a simplified version of a "Mini Metro" game, there is only one subway line, and all the trains go in the same direction. There are n stations on the line, a_i people are waiting for the train at the i-th station at the beginning of the game. The game starts at the beginning of the 0-th hour. At the end of each hour (couple minutes before the end of the hour), b_i people instantly arrive to the i-th station. If at some moment, the number of people at the i-th station is larger than c_i, you lose.

A player has several trains which he can appoint to some hours. The capacity of each train is k passengers. In the middle of the appointed hour, the train goes from the 1-st to the n-th station, taking as many people at each station as it can accommodate. A train can not take people from the i-th station if there are people at the i-1-th station.

If multiple trains are appointed to the same hour, their capacities are being added up and they are moving together.

The player wants to stay in the game for t hours. Determine the minimum number of trains he will need for it.

Input

The first line contains three integers n, t, and k (1 ≤ n, t ≤ 200, 1 ≤ k ≤ 10^9) — the number of stations on the line, hours we want to survive, and capacity of each train respectively.

Each of the next n lines contains three integers a_i, b_i, and c_i (0 ≤ a_i, b_i ≤ c_i ≤ 10^9) — number of people at the i-th station in the beginning of the game, number of people arriving to i-th station in the end of each hour and maximum number of people at the i-th station allowed respectively.

Output

Output a single integer number — the answer to the problem.

Examples

Input

3 3 10
2 4 10
3 3 9
4 2 8

Output

2

Input

4 10 5
1 1 1
1 0 1
0 5 8
2 7 100

Output

12

Note

<image>

Let's look at the sample. There are three stations, on the first, there are initially 2 people, 3 people on the second, and 4 people on the third. Maximal capacities of the stations are 10, 9, and 8 respectively.

One of the winning strategies is to appoint two trains to the first and the third hours. Then on the first hour, the train takes all of the people from the stations, and at the end of the hour, 4 people arrive at the first station, 3 on the second, and 2 on the third.

In the second hour there are no trains appointed, and at the end of it, the same amount of people are arriving again.

In the third hour, the train first takes 8 people from the first station, and when it arrives at the second station, it takes only 2 people because it can accommodate no more than 10 people. Then it passes by the third station because it is already full. After it, people arrive at the stations once more, and the game ends.

As there was no such moment when the number of people at a station exceeded maximal capacity, we won using two trains.


Vasya has a sequence a consisting of n integers a_1, a_2, ..., a_n. Vasya may pefrom the following operation: choose some number from the sequence and swap any pair of bits in its binary representation. For example, Vasya can transform number 6 (... 00000000110_2) into 3 (... 00000000011_2), 12 (... 000000001100_2), 1026 (... 10000000010_2) and many others. Vasya can use this operation any (possibly zero) number of times on any number from the sequence.

Vasya names a sequence as good one, if, using operation mentioned above, he can obtain the sequence with [bitwise exclusive or](https://en.wikipedia.org/wiki/Exclusive_or) of all elements equal to 0.

For the given sequence a_1, a_2, …, a_n Vasya'd like to calculate number of integer pairs (l, r) such that 1 ≤ l ≤ r ≤ n and sequence a_l, a_{l + 1}, ..., a_r is good.

Input

The first line contains a single integer n (1 ≤ n ≤ 3 ⋅ 10^5) — length of the sequence.

The second line contains n integers a_1, a_2, ..., a_n (1 ≤ a_i ≤ 10^{18}) — the sequence a.

Output

Print one integer — the number of pairs (l, r) such that 1 ≤ l ≤ r ≤ n and the sequence a_l, a_{l + 1}, ..., a_r is good.

Examples

Input

3
6 7 14

Output

2

Input

4
1 2 1 16

Output

4

Note

In the first example pairs (2, 3) and (1, 3) are valid. Pair (2, 3) is valid since a_2 = 7 → 11, a_3 = 14 → 11 and 11 ⊕ 11 = 0, where ⊕ — bitwise exclusive or. Pair (1, 3) is valid since a_1 = 6 → 3, a_2 = 7 → 13, a_3 = 14 → 14 and 3 ⊕ 13 ⊕ 14 = 0.

In the second example pairs (1, 2), (2, 3), (3, 4) and (1, 4) are valid.


There is an infinite line consisting of cells. There are n boxes in some cells of this line. The i-th box stands in the cell a_i and has weight w_i. All a_i are distinct, moreover, a_{i - 1} < a_i holds for all valid i.

You would like to put together some boxes. Putting together boxes with indices in the segment [l, r] means that you will move some of them in such a way that their positions will form some segment [x, x + (r - l)].

In one step you can move any box to a neighboring cell if it isn't occupied by another box (i.e. you can choose i and change a_i by 1, all positions should remain distinct). You spend w_i units of energy moving the box i by one cell. You can move any box any number of times, in arbitrary order.

Sometimes weights of some boxes change, so you have queries of two types:

  1. id nw — weight w_{id} of the box id becomes nw.
  2. l r — you should compute the minimum total energy needed to put together boxes with indices in [l, r]. Since the answer can be rather big, print the remainder it gives when divided by 1000 000 007 = 10^9 + 7. Note that the boxes are not moved during the query, you only should compute the answer.

Note that you should minimize the answer, not its remainder modulo 10^9 + 7. So if you have two possible answers 2 ⋅ 10^9 + 13 and 2 ⋅ 10^9 + 14, you should choose the first one and print 10^9 + 6, even though the remainder of the second answer is 0.

Input

The first line contains two integers n and q (1 ≤ n, q ≤ 2 ⋅ 10^5) — the number of boxes and the number of queries.

The second line contains n integers a_1, a_2, ... a_n (1 ≤ a_i ≤ 10^9) — the positions of the boxes. All a_i are distinct, a_{i - 1} < a_i holds for all valid i.

The third line contains n integers w_1, w_2, ... w_n (1 ≤ w_i ≤ 10^9) — the initial weights of the boxes.

Next q lines describe queries, one query per line.

Each query is described in a single line, containing two integers x and y. If x < 0, then this query is of the first type, where id = -x, nw = y (1 ≤ id ≤ n, 1 ≤ nw ≤ 10^9). If x > 0, then the query is of the second type, where l = x and r = y (1 ≤ l_j ≤ r_j ≤ n). x can not be equal to 0.

Output

For each query of the second type print the answer on a separate line. Since answer can be large, print the remainder it gives when divided by 1000 000 007 = 10^9 + 7.

Example

Input

5 8
1 2 6 7 10
1 1 1 1 2
1 1
1 5
1 3
3 5
-3 5
-1 10
1 4
2 5

Output

0
10
3
4
18
7

Note

Let's go through queries of the example:

  1. 1\ 1 — there is only one box so we don't need to move anything.
  2. 1\ 5 — we can move boxes to segment [4, 8]: 1 ⋅ |1 - 4| + 1 ⋅ |2 - 5| + 1 ⋅ |6 - 6| + 1 ⋅ |7 - 7| + 2 ⋅ |10 - 8| = 10.
  3. 1\ 3 — we can move boxes to segment [1, 3].
  4. 3\ 5 — we can move boxes to segment [7, 9].
  5. -3\ 5 — w_3 is changed from 1 to 5.
  6. -1\ 10 — w_1 is changed from 1 to 10. The weights are now equal to w = [10, 1, 5, 1, 2].
  7. 1\ 4 — we can move boxes to segment [1, 4].
  8. 2\ 5 — we can move boxes to segment [5, 8].


You are playing a strange game with Li Chen. You have a tree with n nodes drawn on a piece of paper. All nodes are unlabeled and distinguishable. Each of you independently labeled the vertices from 1 to n. Neither of you know the other's labelling of the tree.

You and Li Chen each chose a subtree (i.e., a connected subgraph) in that tree. Your subtree consists of the vertices labeled x_1, x_2, …, x_{k_1} in your labeling, Li Chen's subtree consists of the vertices labeled y_1, y_2, …, y_{k_2} in his labeling. The values of x_1, x_2, …, x_{k_1} and y_1, y_2, …, y_{k_2} are known to both of you.

<image> The picture shows two labelings of a possible tree: yours on the left and Li Chen's on the right. The selected trees are highlighted. There are two common nodes.

You want to determine whether your subtrees have at least one common vertex. Luckily, your friend Andrew knows both labelings of the tree. You can ask Andrew at most 5 questions, each of which is in one of the following two forms:

  * A x: Andrew will look at vertex x in your labeling and tell you the number of this vertex in Li Chen's labeling.
  * B y: Andrew will look at vertex y in Li Chen's labeling and tell you the number of this vertex in your labeling.

Determine whether the two subtrees have at least one common vertex after asking some questions. If there is at least one common vertex, determine one of your labels for any of the common vertices.

Interaction

Each test consists of several test cases.

The first line of input contains a single integer t (1 ≤ t ≤ 100) — the number of test cases.

For each testcase, your program should interact in the following format.

The first line contains a single integer n (1 ≤ n ≤ 1 000) — the number of nodes in the tree.

Each of the next n-1 lines contains two integers a_i and b_i (1≤ a_i, b_i≤ n) — the edges of the tree, indicating an edge between node a_i and b_i according to your labeling of the nodes.

The next line contains a single integer k_1 (1 ≤ k_1 ≤ n) — the number of nodes in your subtree.

The next line contains k_1 distinct integers x_1,x_2,…,x_{k_1} (1 ≤ x_i ≤ n) — the indices of the nodes in your subtree, according to your labeling. It is guaranteed that these vertices form a subtree.

The next line contains a single integer k_2 (1 ≤ k_2 ≤ n) — the number of nodes in Li Chen's subtree.

The next line contains k_2 distinct integers y_1, y_2, …, y_{k_2} (1 ≤ y_i ≤ n) — the indices (according to Li Chen's labeling) of the nodes in Li Chen's subtree. It is guaranteed that these vertices form a subtree according to Li Chen's labelling of the tree's nodes.

Test cases will be provided one by one, so you must complete interacting with the previous test (i.e. by printing out a common node or -1 if there is not such node) to start receiving the next one.

You can ask the Andrew two different types of questions.

  * You can print "A x" (1 ≤ x ≤ n). Andrew will look at vertex x in your labeling and respond to you with the number of this vertex in Li Chen's labeling.
  * You can print "B y" (1 ≤ y ≤ n). Andrew will look at vertex y in Li Chen's labeling and respond to you with the number of this vertex in your labeling.

You may only ask at most 5 questions per tree.

When you are ready to answer, print "C s", where s is your label of a vertex that is common to both subtrees, or -1, if no such vertex exists. Printing the answer does not count as a question. Remember to flush your answer to start receiving the next test case.

After printing a question do not forget to print end of line and 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.

If the judge responds with -1, it means that you asked more queries than allowed, or asked an invalid query. Your program should immediately terminate (for example, by calling exit(0)). You will receive Wrong Answer; it means that you asked more queries than allowed, or asked an invalid query. If you ignore this, you can get other verdicts since your program will continue to read from a closed stream.

Hack Format

To hack, use the following format. Note that you can only hack with one test case.

The first line should contain a single integer t (t=1).

The second line should contain a single integer n (1 ≤ n ≤ 1 000).

The third line should contain n integers p_1, p_2, …, p_n (1≤ p_i≤ n) — a permutation of 1 to n. This encodes the labels that Li Chen chose for his tree. In particular, Li Chen chose label p_i for the node you labeled i.

Each of the next n-1 lines should contain two integers a_i and b_i (1≤ a_i, b_i≤ n). These edges should form a tree.

The next line should contain a single integer k_1 (1 ≤ k_1 ≤ n).

The next line should contain k_1 distinct integers x_1,x_2,…,x_{k_1} (1 ≤ x_i ≤ n). These vertices should form a subtree.

The next line should contain a single integer k_2 (1 ≤ k_2 ≤ n).

The next line should contain k_2 distinct integers y_1, y_2, …, y_{k_2} (1 ≤ y_i ≤ n). These vertices should form a subtree in Li Chen's tree according to the permutation above.

Examples

Input

1
3
1 2
2 3
1
1
1
2
2
1

Output

A 1
B 2
C 1

Input

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

Output

B 2
C 1
A 1
C -1

Note

For the first sample, Li Chen's hidden permutation is [2, 3, 1], and for the second, his hidden permutation is [5, 3, 2, 4, 1, 6] for both cases.

In the first sample, there is a tree with three nodes in a line. On the top, is how you labeled the tree and the subtree you chose, and the bottom is how Li Chen labeled the tree and the subtree he chose:

<image>

In the first question, you ask Andrew to look at node 1 in your labelling and tell you the label of it in Li Chen's labelling. Andrew responds with 2. At this point, you know that both of your subtrees contain the same node (i.e. node 1 according to your labeling), so you can output "C 1" and finish. However, you can also ask Andrew to look at node 2 in Li Chen's labelling and tell you the label of it in your labelling. Andrew responds with 1 (this step was given with the only reason — to show you how to ask questions).

For the second sample, there are two test cases. The first looks is the one from the statement:

<image>

We first ask "B 2", and Andrew will tell us 3. In this case, we know 3 is a common vertex, and moreover, any subtree with size 3 that contains node 3 must contain node 1 as well, so we can output either "C 1" or "C 3" as our answer.

In the second case in the second sample, the situation looks as follows:

<image>

In this case, you know that the only subtree of size 3 that doesn't contain node 1 is subtree 4,5,6. You ask Andrew for the label of node 1 in Li Chen's labelling and Andrew says 5. In this case, you know that Li Chen's subtree doesn't contain node 1, so his subtree must be consist of the nodes 4,5,6 (in your labelling), thus the two subtrees have no common nodes.


Hasan loves playing games and has recently discovered a game called TopScore. In this soccer-like game there are p players doing penalty shoot-outs. Winner is the one who scores the most. In case of ties, one of the top-scorers will be declared as the winner randomly with equal probability.

They have just finished the game and now are waiting for the result. But there's a tiny problem! The judges have lost the paper of scores! Fortunately they have calculated sum of the scores before they get lost and also for some of the players they have remembered a lower bound on how much they scored. However, the information about the bounds is private, so Hasan only got to know his bound.

According to the available data, he knows that his score is at least r and sum of the scores is s.

Thus the final state of the game can be represented in form of sequence of p integers a_1, a_2, ..., a_p (0 ≤ a_i) — player's scores. Hasan is player number 1, so a_1 ≥ r. Also a_1 + a_2 + ... + a_p = s. Two states are considered different if there exists some position i such that the value of a_i differs in these states.

Once again, Hasan doesn't know the exact scores (he doesn't know his exact score as well). So he considers each of the final states to be equally probable to achieve.

Help Hasan find the probability of him winning.

It can be shown that it is in the form of P/Q where P and Q are non-negative integers and Q ≠ 0, P ≤ Q. Report the value of P ⋅ Q^{-1} \pmod {998244353}.

Input

The only line contains three integers p, s and r (1 ≤ p ≤ 100, 0 ≤ r ≤ s ≤ 5000) — the number of players, the sum of scores of all players and Hasan's score, respectively.

Output

Print a single integer — the probability of Hasan winning.

It can be shown that it is in the form of P/Q where P and Q are non-negative integers and Q ≠ 0, P ≤ Q. Report the value of P ⋅ Q^{-1} \pmod {998244353}.

Examples

Input

2 6 3

Output

124780545

Input

5 20 11

Output

1

Input

10 30 10

Output

85932500

Note

In the first example Hasan can score 3, 4, 5 or 6 goals. If he scores 4 goals or more than he scores strictly more than his only opponent. If he scores 3 then his opponent also scores 3 and Hasan has a probability of \frac 1 2 to win the game. Thus, overall he has the probability of \frac 7 8 to win.

In the second example even Hasan's lower bound on goal implies him scoring more than any of his opponents. Thus, the resulting probability is 1.


You are given a string of length n. Each character is one of the first p lowercase Latin letters.

You are also given a matrix A with binary values of size p × p. This matrix is symmetric (A_{ij} = A_{ji}). A_{ij} = 1 means that the string can have the i-th and j-th letters of Latin alphabet adjacent.

Let's call the string crisp if all of the adjacent characters in it can be adjacent (have 1 in the corresponding cell of matrix A).

You are allowed to do the following move. Choose any letter, remove all its occurrences and join the remaining parts of the string without changing their order. For example, removing letter 'a' from "abacaba" will yield "bcb".

The string you are given is crisp. The string should remain crisp after every move you make.

You are allowed to do arbitrary number of moves (possible zero). What is the shortest resulting string you can obtain?

Input

The first line contains two integers n and p (1 ≤ n ≤ 10^5, 1 ≤ p ≤ 17) — the length of the initial string and the length of the allowed prefix of Latin alphabet.

The second line contains the initial string. It is guaranteed that it contains only first p lowercase Latin letters and that is it crisp. Some of these p first Latin letters might not be present in the string.

Each of the next p lines contains p integer numbers — the matrix A (0 ≤ A_{ij} ≤ 1, A_{ij} = A_{ji}). A_{ij} = 1 means that the string can have the i-th and j-th letters of Latin alphabet adjacent.

Output

Print a single integer — the length of the shortest string after you make arbitrary number of moves (possible zero).

Examples

Input

7 3
abacaba
0 1 1
1 0 0
1 0 0

Output

7

Input

7 3
abacaba
1 1 1
1 0 0
1 0 0

Output

0

Input

7 4
bacadab
0 1 1 1
1 0 0 0
1 0 0 0
1 0 0 0

Output

5

Input

3 3
cbc
0 0 0
0 0 1
0 1 0

Output

0

Note

In the first example no letter can be removed from the initial string.

In the second example you can remove letters in order: 'b', 'c', 'a'. The strings on the intermediate steps will be: "abacaba" → "aacaa" → "aaaa" → "".

In the third example you can remove letter 'b' and that's it.

In the fourth example you can remove letters in order 'c', 'b', but not in the order 'b', 'c' because two letters 'c' can't be adjacent.


Polycarp has an array a consisting of n integers.

He wants to play a game with this array. The game consists of several moves. On the first move he chooses any element and deletes it (after the first move the array contains n-1 elements). For each of the next moves he chooses any element with the only restriction: its parity should differ from the parity of the element deleted on the previous move. In other words, he alternates parities (even-odd-even-odd-... or odd-even-odd-even-...) of the removed elements. Polycarp stops if he can't make a move.

Formally:

  * If it is the first move, he chooses any element and deletes it;
  * If it is the second or any next move:
    * if the last deleted element was odd, Polycarp chooses any even element and deletes it;
    * if the last deleted element was even, Polycarp chooses any odd element and deletes it.
  * If after some move Polycarp cannot make a move, the game ends.

Polycarp's goal is to minimize the sum of non-deleted elements of the array after end of the game. If Polycarp can delete the whole array, then the sum of non-deleted elements is zero.

Help Polycarp find this value.

Input

The first line of the input contains one integer n (1 ≤ n ≤ 2000) — the number of elements of a.

The second line of the input contains n integers a_1, a_2, ..., a_n (0 ≤ a_i ≤ 10^6), where a_i is the i-th element of a.

Output

Print one integer — the minimum possible sum of non-deleted elements of the array after end of the game.

Examples

Input

5
1 5 7 8 2

Output

0

Input

6
5 1 2 4 6 3

Output

0

Input

2
1000000 1000000

Output

1000000


You are given a huge decimal number consisting of n digits. It is guaranteed that this number has no leading zeros. Each digit of this number is either 0 or 1.

You may perform several (possibly zero) operations with this number. During each operation you are allowed to change any digit of your number; you may change 0 to 1 or 1 to 0. It is possible that after some operation you can obtain a number with leading zeroes, but it does not matter for this problem.

You are also given two integers 0 ≤ y < x < n. Your task is to calculate the minimum number of operations you should perform to obtain the number that has remainder 10^y modulo 10^x. In other words, the obtained number should have remainder 10^y when divided by 10^x.

Input

The first line of the input contains three integers n, x, y (0 ≤ y < x < n ≤ 2 ⋅ 10^5) — the length of the number and the integers x and y, respectively.

The second line of the input contains one decimal number consisting of n digits, each digit of this number is either 0 or 1. It is guaranteed that the first digit of the number is 1.

Output

Print one integer — the minimum number of operations you should perform to obtain the number having remainder 10^y modulo 10^x. In other words, the obtained number should have remainder 10^y when divided by 10^x.

Examples

Input

11 5 2
11010100101

Output

1

Input

11 5 1
11010100101

Output

3

Note

In the first example the number will be 11010100100 after performing one operation. It has remainder 100 modulo 100000.

In the second example the number will be 11010100010 after performing three operations. It has remainder 10 modulo 100000.


The rebels have saved enough gold to launch a full-scale attack. Now the situation is flipped, the rebels will send out the spaceships to attack the Empire bases!

The galaxy can be represented as an undirected graph with n planets (nodes) and m wormholes (edges), each connecting two planets.

A total of s rebel spaceships and b empire bases are located at different planets in the galaxy.

Each spaceship is given a location x, denoting the index of the planet on which it is located, an attacking strength a, a certain amount of fuel f, and a price to operate p.

Each base is given a location x, a defensive strength d, and a certain amount of gold g.

A spaceship can attack a base if both of these conditions hold:

  * the spaceship's attacking strength is greater or equal than the defensive strength of the base
  * the spaceship's fuel is greater or equal to the shortest distance, computed as the number of wormholes, between the spaceship's node and the base's node

The rebels are very proud fighters. So, if a spaceship cannot attack any base, no rebel pilot will accept to operate it.

If a spaceship is operated, the profit generated by that spaceship is equal to the gold of the base it attacks minus the price to operate the spaceship. Note that this might be negative. A spaceship that is operated will attack the base that maximizes its profit.

Darth Vader likes to appear rich at all times. Therefore, whenever a base is attacked and its gold stolen, he makes sure to immediately refill that base with gold.

Therefore, for the purposes of the rebels, multiple spaceships can attack the same base, in which case each spaceship will still receive all the gold of that base.

The rebels have tasked Heidi and the Doctor to decide which set of spaceships to operate in order to maximize the total profit.

However, as the war has been going on for a long time, the pilots have formed unbreakable bonds, and some of them refuse to operate spaceships if their friends are not also operating spaceships.

They have a list of k dependencies of the form s_1, s_2, denoting that spaceship s_1 can be operated only if spaceship s_2 is also operated.

Input

The first line of input contains integers n and m (1 ≤ n ≤ 100, 0 ≤ m ≤ 10000), the number of nodes and the number of edges, respectively.

The next m lines contain integers u and v (1 ≤ u, v ≤ n) denoting an undirected edge between the two nodes.

The next line contains integers s, b and k (1 ≤ s, b ≤ 10^5, 0 ≤ k ≤ 1000), the number of spaceships, bases, and dependencies, respectively.

The next s lines contain integers x, a, f, p (1 ≤ x ≤ n, 0 ≤ a, f, p ≤ 10^9), denoting the location, attack, fuel, and price of the spaceship. Ships are numbered from 1 to s.

The next b lines contain integers x, d, g (1 ≤ x ≤ n, 0 ≤ d, g ≤ 10^9), denoting the location, defence, and gold of the base.

The next k lines contain integers s_1 and s_2 (1 ≤ s_1, s_2 ≤ s), denoting a dependency of s_1 on s_2.

Output

Print a single integer, the maximum total profit that can be achieved.

Example

Input

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

Output

2

Note

The optimal strategy is to operate spaceships 1, 2, and 4, which will attack bases 1, 1, and 2, respectively.


You have a string s — a sequence of commands for your toy robot. The robot is placed in some cell of a rectangular grid. He can perform four commands:

  * 'W' — move one cell up;
  * 'S' — move one cell down;
  * 'A' — move one cell left;
  * 'D' — move one cell right.

Let Grid(s) be the grid of minimum possible area such that there is a position in the grid where you can place the robot in such a way that it will not fall from the grid while running the sequence of commands s. For example, if s = DSAWWAW then Grid(s) is the 4 × 3 grid:

  1. you can place the robot in the cell (3, 2);
  2. the robot performs the command 'D' and moves to (3, 3);
  3. the robot performs the command 'S' and moves to (4, 3);
  4. the robot performs the command 'A' and moves to (4, 2);
  5. the robot performs the command 'W' and moves to (3, 2);
  6. the robot performs the command 'W' and moves to (2, 2);
  7. the robot performs the command 'A' and moves to (2, 1);
  8. the robot performs the command 'W' and moves to (1, 1).

<image>

You have 4 extra letters: one 'W', one 'A', one 'S', one 'D'. You'd like to insert at most one of these letters in any position of sequence s to minimize the area of Grid(s).

What is the minimum area of Grid(s) you can achieve?

Input

The first line contains one integer T (1 ≤ T ≤ 1000) — the number of queries.

Next T lines contain queries: one per line. This line contains single string s (1 ≤ |s| ≤ 2 ⋅ 10^5, s_i ∈ \{W, A, S, D\}) — the sequence of commands.

It's guaranteed that the total length of s over all queries doesn't exceed 2 ⋅ 10^5.

Output

Print T integers: one per query. For each query print the minimum area of Grid(s) you can achieve.

Example

Input

3
DSAWWAW
D
WA

Output

8
2
4

Note

In the first query you have to get string DSAWW\underline{D}AW.

In second and third queries you can not decrease the area of Grid(s).


We are definitely not going to bother you with another generic story when Alice finds about an array or when Alice and Bob play some stupid game. This time you'll get a simple, plain text.

First, let us define several things. We define function F on the array A such that F(i, 1) = A[i] and F(i, m) = A[F(i, m - 1)] for m > 1. In other words, value F(i, m) represents composition A[...A[i]] applied m times.

You are given an array of length N with non-negative integers. You are expected to give an answer on Q queries. Each query consists of two numbers – m and y. For each query determine how many x exist such that F(x,m) = y.

Input

The first line contains one integer N (1 ≤ N ≤ 2 ⋅ 10^5) – the size of the array A. The next line contains N non-negative integers – the array A itself (1 ≤ A_i ≤ N). The next line contains one integer Q (1 ≤ Q ≤ 10^5) – the number of queries. Each of the next Q lines contain two integers m and y (1 ≤ m ≤ 10^{18}, 1≤ y ≤ N).

Output

Output exactly Q lines with a single integer in each that represent the solution. Output the solutions in the order the queries were asked in.

Example

Input

10
2 3 1 5 6 4 2 10 7 7
5
10 1
5 7
10 6
1 1
10 8

Output

3
0
1
1
0

Note

For the first query we can notice that F(3, 10) = 1,\ F(9, 10) = 1 and F(10, 10) = 1.

For the second query no x satisfies condition F(x, 5) = 7.

For the third query F(5, 10) = 6 holds.

For the fourth query F(3, 1) = 1.

For the fifth query no x satisfies condition F(x, 10) = 8.


The football season has just ended in Berland. According to the rules of Berland football, each match is played between two teams. The result of each match is either a draw, or a victory of one of the playing teams. If a team wins the match, it gets w points, and the opposing team gets 0 points. If the game results in a draw, both teams get d points.

The manager of the Berland capital team wants to summarize the results of the season, but, unfortunately, all information about the results of each match is lost. The manager only knows that the team has played n games and got p points for them.

You have to determine three integers x, y and z — the number of wins, draws and loses of the team. If there are multiple answers, print any of them. If there is no suitable triple (x, y, z), report about it.

Input

The first line contains four integers n, p, w and d (1 ≤ n ≤ 10^{12}, 0 ≤ p ≤ 10^{17}, 1 ≤ d < w ≤ 10^{5}) — the number of games, the number of points the team got, the number of points awarded for winning a match, and the number of points awarded for a draw, respectively. Note that w > d, so the number of points awarded for winning is strictly greater than the number of points awarded for draw.

Output

If there is no answer, print -1.

Otherwise print three non-negative integers x, y and z — the number of wins, draws and losses of the team. If there are multiple possible triples (x, y, z), print any of them. The numbers should meet the following conditions:

  * x ⋅ w + y ⋅ d = p,
  * x + y + z = n.

Examples

Input

30 60 3 1

Output

17 9 4

Input

10 51 5 4

Output

-1

Input

20 0 15 5

Output

0 0 20

Note

One of the possible answers in the first example — 17 wins, 9 draws and 4 losses. Then the team got 17 ⋅ 3 + 9 ⋅ 1 = 60 points in 17 + 9 + 4 = 30 games.

In the second example the maximum possible score is 10 ⋅ 5 = 50. Since p = 51, there is no answer.

In the third example the team got 0 points, so all 20 games were lost.


So the Beautiful Regional Contest (BeRC) has come to an end! n students took part in the contest. The final standings are already known: the participant in the i-th place solved p_i problems. Since the participants are primarily sorted by the number of solved problems, then p_1 ≥ p_2 ≥ ... ≥ p_n.

Help the jury distribute the gold, silver and bronze medals. Let their numbers be g, s and b, respectively. Here is a list of requirements from the rules, which all must be satisfied:

  * for each of the three types of medals, at least one medal must be awarded (that is, g>0, s>0 and b>0);
  * the number of gold medals must be strictly less than the number of silver and the number of bronze (that is, g<s and g<b, but there are no requirements between s and b);
  * each gold medalist must solve strictly more problems than any awarded with a silver medal;
  * each silver medalist must solve strictly more problems than any awarded a bronze medal;
  * each bronze medalist must solve strictly more problems than any participant not awarded a medal;
  * the total number of medalists g+s+b should not exceed half of all participants (for example, if n=21, then you can award a maximum of 10 participants, and if n=26, then you can award a maximum of 13 participants).

The jury wants to reward with medals the total maximal number participants (i.e. to maximize g+s+b) so that all of the items listed above are fulfilled. Help the jury find such a way to award medals.

Input

The first line of the input contains an integer t (1 ≤ t ≤ 10000) — the number of test cases in the input. Then t test cases follow.

The first line of a test case contains an integer n (1 ≤ n ≤ 4⋅10^5) — the number of BeRC participants. The second line of a test case contains integers p_1, p_2, ..., p_n (0 ≤ p_i ≤ 10^6), where p_i is equal to the number of problems solved by the i-th participant from the final standings. The values p_i are sorted in non-increasing order, i.e. p_1 ≥ p_2 ≥ ... ≥ p_n.

The sum of n over all test cases in the input does not exceed 4⋅10^5.

Output

Print t lines, the j-th line should contain the answer to the j-th test case.

The answer consists of three non-negative integers g, s, b.

  * Print g=s=b=0 if there is no way to reward participants with medals so that all requirements from the statement are satisfied at the same time.
  * Otherwise, print three positive numbers g, s, b — the possible number of gold, silver and bronze medals, respectively. The sum of g+s+b should be the maximum possible. If there are several answers, print any of them.

Example

Input

5
12
5 4 4 3 2 2 1 1 1 1 1 1
4
4 3 2 1
1
1000000
20
20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1
32
64 64 63 58 58 58 58 58 37 37 37 37 34 34 28 28 28 28 28 28 24 24 19 17 17 17 17 16 16 16 16 11

Output

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

Note

In the first test case, it is possible to reward 1 gold, 2 silver and 3 bronze medals. In this case, the participant solved 5 tasks will be rewarded with the gold medal, participants solved 4 tasks will be rewarded with silver medals, participants solved 2 or 3 tasks will be rewarded with bronze medals. Participants solved exactly 1 task won't be rewarded. It's easy to see, that in this case, all conditions are satisfied and it is possible to reward participants in this way. It is impossible to give more than 6 medals because the number of medals should not exceed half of the number of participants. The answer 1, 3, 2 is also correct in this test case.

In the second and third test cases, it is impossible to reward medals, because at least one medal of each type should be given, but the number of medals should not exceed half of the number of participants.


Today, Osama gave Fadi an integer X, and Fadi was wondering about the minimum possible value of max(a, b) such that LCM(a, b) equals X. Both a and b should be positive integers.

LCM(a, b) is the smallest positive integer that is divisible by both a and b. For example, LCM(6, 8) = 24, LCM(4, 12) = 12, LCM(2, 3) = 6.

Of course, Fadi immediately knew the answer. Can you be just like Fadi and find any such pair?

Input

The first and only line contains an integer X (1 ≤ X ≤ 10^{12}).

Output

Print two positive integers, a and b, such that the value of max(a, b) is minimum possible and LCM(a, b) equals X. If there are several possible such pairs, you can print any.

Examples

Input

2

Output

1 2

Input

6

Output

2 3

Input

4

Output

1 4

Input

1

Output

1 1


Gildong was hiking a mountain, walking by millions of trees. Inspired by them, he suddenly came up with an interesting idea for trees in data structures: What if we add another edge in a tree?

Then he found that such tree-like graphs are called 1-trees. Since Gildong was bored of solving too many tree problems, he wanted to see if similar techniques in trees can be used in 1-trees as well. Instead of solving it by himself, he's going to test you by providing queries on 1-trees.

First, he'll provide you a tree (not 1-tree) with n vertices, then he will ask you q queries. Each query contains 5 integers: x, y, a, b, and k. This means you're asked to determine if there exists a path from vertex a to b that contains exactly k edges after adding a bidirectional edge between vertices x and y. A path can contain the same vertices and same edges multiple times. All queries are independent of each other; i.e. the added edge in a query is removed in the next query.

Input

The first line contains an integer n (3 ≤ n ≤ 10^5), the number of vertices of the tree.

Next n-1 lines contain two integers u and v (1 ≤ u,v ≤ n, u ≠ v) each, which means there is an edge between vertex u and v. All edges are bidirectional and distinct.

Next line contains an integer q (1 ≤ q ≤ 10^5), the number of queries Gildong wants to ask.

Next q lines contain five integers x, y, a, b, and k each (1 ≤ x,y,a,b ≤ n, x ≠ y, 1 ≤ k ≤ 10^9) – the integers explained in the description. It is guaranteed that the edge between x and y does not exist in the original tree.

Output

For each query, print "YES" if there exists a path that contains exactly k edges from vertex a to b after adding an edge between vertices x and y. Otherwise, print "NO".

You can print each letter in any case (upper or lower).

Example

Input

5
1 2
2 3
3 4
4 5
5
1 3 1 2 2
1 4 1 3 2
1 4 1 3 3
4 2 3 3 9
5 2 3 3 9

Output

YES
YES
NO
YES
NO

Note

The image below describes the tree (circles and solid lines) and the added edges for each query (dotted lines).

<image>

Possible paths for the queries with "YES" answers are:

  * 1-st query: 1 – 3 – 2
  * 2-nd query: 1 – 2 – 3
  * 4-th query: 3 – 4 – 2 – 3 – 4 – 2 – 3 – 4 – 2 – 3