JerryL/AlgoSimBench huggingface dataset:
p03044 AtCoder Beginner Contest 126 - Even Relation

We have a tree with N vertices numbered 1 to N. The i-th edge in the tree connects Vertex u_i and Vertex v_i, and its length is w_i. Your objective is to paint each vertex in the tree white or black (it is fine to paint all vertices the same color) so that the following condition is satisfied:

* For any two vertices painted in the same color, the distance between them is an even number.



Find a coloring of the vertices that satisfies the condition and print it. It can be proved that at least one such coloring exists under the constraints of this problem.

Constraints

* All values in input are integers.
* 1 \leq N \leq 10^5
* 1 \leq u_i < v_i \leq N
* 1 \leq w_i \leq 10^9

Input

Input is given from Standard Input in the following format:


N
u_1 v_1 w_1
u_2 v_2 w_2
.
.
.
u_{N - 1} v_{N - 1} w_{N - 1}


Output

Print a coloring of the vertices that satisfies the condition, in N lines. The i-th line should contain `0` if Vertex i is painted white and `1` if it is painted black.

If there are multiple colorings that satisfy the condition, any of them will be accepted.

Examples

Input

3
1 2 2
2 3 1


Output

0
0
1


Input

5
2 5 2
2 3 10
1 3 8
3 4 2


Output

1
0
1
0
1

Example input:
5
2 5 2
2 3 10
1 3 8
3 4 2
3
1 2 2
2 3 1

Example output:
1
0
1
0
1
0
0
1

Difficulty rating: 0

Solution:
(n,),*t=[map(int,t.split())for t in open(0)]
*e,=eval('[],'*-~n)
q=[(1,0)]
f=[-1]*n
for v,w,c in t:e[v]+=(w,c),;e[w]+=(v,c),
for v,c in q:
 f[v-1]=c&1
 for w,d in e[v]:q+=[(w,c+d)]*(f[w-1]<0)
print(*f)
p02902 AtCoder Beginner Contest 142 - Pure

Given is a directed graph G with N vertices and M edges.
The vertices are numbered 1 to N, and the i-th edge is directed from Vertex A_i to Vertex B_i.
It is guaranteed that the graph contains no self-loops or multiple edges.

Determine whether there exists an induced subgraph (see Notes) of G such that the in-degree and out-degree of every vertex are both 1. If the answer is yes, show one such subgraph.
Here the null graph is not considered as a subgraph.

Constraints

* 1 \leq N \leq 1000
* 0 \leq M \leq 2000
* 1 \leq A_i,B_i \leq N
* A_i \neq B_i
* All pairs (A_i, B_i) are distinct.
* All values in input are integers.

Input

Input is given from Standard Input in the following format:


N M
A_1 B_1
A_2 B_2
:
A_M B_M


Output

If there is no induced subgraph of G that satisfies the condition, print `-1`. Otherwise, print an induced subgraph of G that satisfies the condition, in the following format:


K
v_1
v_2
:
v_K


This represents the induced subgraph of G with K vertices whose vertex set is \\{v_1, v_2, \ldots, v_K\\}. (The order of v_1, v_2, \ldots, v_K does not matter.) If there are multiple subgraphs of G that satisfy the condition, printing any of them is accepted.

Examples

Input

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


Output

3
1
2
4


Input

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


Output

-1


Input

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


Output

4
2
3
4
5

Example input:
6 9
1 2
2 3
3 4
4 5
5 6
5 1
5 2
6 1
6 2
4 5
1 2
2 3
2 4
4 1
4 3
4 5
1 2
2 3
2 4
1 4
4 3

Example output:
4
2
3
4
5
3
1
2
4
-1

Difficulty rating: 0

Solution:
from collections import*
n,m,*t=map(int,open(0).read().split())
i=[0]*n
o=[[]for _ in i]
for a,b in zip(*[iter(t)]*2):
  o[a-1]+=b-1,
  i[b-1]+=1
q,r=deque(v for v in range(n)if i[v]<1),[]
while q:
  v=q.popleft()
  r+=v,
  for w in o[v]:
    i[w]-=1
    if i[w]==0:q+=w,
print(-(len(r)==n))
p02573 AtCoder Beginner Contest 177 - Friends

There are N persons called Person 1 through Person N.

You are given M facts that "Person A_i and Person B_i are friends." The same fact may be given multiple times.

If X and Y are friends, and Y and Z are friends, then X and Z are also friends. There is no friendship that cannot be derived from the M given facts.

Takahashi the evil wants to divide the N persons into some number of groups so that every person has no friend in his/her group.

At least how many groups does he need to make?

Constraints

* 2 \leq N \leq 2\times 10^5
* 0 \leq M \leq 2\times 10^5
* 1\leq A_i,B_i\leq N
* A_i \neq B_i

Input

Input is given from Standard Input in the following format:


N M
A_1 B_1
\vdots
A_M B_M


Output

Print the answer.

Examples

Input

5 3
1 2
3 4
5 1


Output

3


Input

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


Output

4


Input

10 4
3 1
4 1
5 9
2 6


Output

3

Example input:
10 4
3 1
4 1
5 9
2 6
5 3
1 2
3 4
5 1
4 10
1 2
2 1
1 2
2 1
1 2
1 3
1 4
2 3
2 4
3 4

Example output:
3
3
4

Difficulty rating: 0

Solution:
f=lambda:map(int,input().split())
n,m=f()
p=[-1]*n
def root(x):
  while p[x]>=0: x=p[x]
  return x
def unite(x,y):
  x,y=root(x),root(y)
  if x==y: return
  if x>y: x,y=y,x
  p[x]+=p[y]
  p[y]=x
for i in range(m):
  a,b=f()
  unite(a-1,b-1)
print(-min(p))
p02678 AtCoder Beginner Contest 168 - .. (Double Dots)

There is a cave.

The cave has N rooms and M passages. The rooms are numbered 1 to N, and the passages are numbered 1 to M. Passage i connects Room A_i and Room B_i bidirectionally. One can travel between any two rooms by traversing passages. Room 1 is a special room with an entrance from the outside.

It is dark in the cave, so we have decided to place a signpost in each room except Room 1. The signpost in each room will point to one of the rooms directly connected to that room with a passage.

Since it is dangerous in the cave, our objective is to satisfy the condition below for each room except Room 1.

* If you start in that room and repeatedly move to the room indicated by the signpost in the room you are in, you will reach Room 1 after traversing the minimum number of passages possible.



Determine whether there is a way to place signposts satisfying our objective, and print one such way if it exists.

Constraints

* All values in input are integers.
* 2 \leq N \leq 10^5
* 1 \leq M \leq 2 \times 10^5
* 1 \leq A_i, B_i \leq N\ (1 \leq i \leq M)
* A_i \neq B_i\ (1 \leq i \leq M)
* One can travel between any two rooms by traversing passages.

Input

Input is given from Standard Input in the following format:


N M
A_1 B_1
:
A_M B_M


Output

If there is no way to place signposts satisfying the objective, print `No`.

Otherwise, print N lines. The first line should contain `Yes`, and the i-th line (2 \leq i \leq N) should contain the integer representing the room indicated by the signpost in Room i.

Examples

Input

4 4
1 2
2 3
3 4
4 2


Output

Yes
1
2
2


Input

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


Output

Yes
6
5
5
1
1

Example input:
6 9
3 4
6 1
2 4
5 3
4 6
1 5
6 2
4 5
5 6
4 4
1 2
2 3
3 4
4 2

Example output:
Yes
6
5
5
1
1
Yes
1
2
2

Difficulty rating: 0

Solution:
(n,m),*t=[map(int,t.split())for t in open(0)]
*e,=eval('[],'*-~n)
for a,b in t:e[a]+=b,;e[b]+=a,
q=[1]
d=[0]*-~n
for v in q:
 for w in e[v]:
  if d[w]<1:d[w]=v;q+=w,
print('Yes',*d[2:])
377_A. Maze

Pavel loves grid mazes. A grid maze is an n × m rectangle maze where each cell is either empty, or is a wall. You can go from one cell to another only if both cells are empty and have a common side.

Pavel drew a grid maze with all empty cells forming a connected area. That is, you can go from any empty cell to any other one. Pavel doesn't like it when his maze has too little walls. He wants to turn exactly k empty cells into walls so that all the remaining cells still formed a connected area. Help him.

Input

The first line contains three integers n, m, k (1 ≤ n, m ≤ 500, 0 ≤ k < s), where n and m are the maze's height and width, correspondingly, k is the number of walls Pavel wants to add and letter s represents the number of empty cells in the original maze.

Each of the next n lines contains m characters. They describe the original maze. If a character on a line equals ".", then the corresponding cell is empty and if the character equals "#", then the cell is a wall.

Output

Print n lines containing m characters each: the new maze that fits Pavel's requirements. Mark the empty cells that you transformed into walls as "X", the other cells must be left without changes (that is, "." and "#").

It is guaranteed that a solution exists. If there are multiple solutions you can output any of them.

Examples

Input

3 4 2
#..#
..#.
#...


Output

#.X#
X.#.
#...


Input

5 4 5
#...
#.#.
.#..
...#
.#.#


Output

#XXX
#X#.
X#..
...#
.#.#

Example input:
3 4 2
#..#
..#.
#...

5 4 5
#...
#.#.
.#..
...#
.#.#


Example output:
#..#
..#X
#..X

#...
#.#.
X#..
XX.#
X#X#


Tags: dfs and similar
Difficulty rating: 1600

Solution:
#include <bits/stdc++.h>
int t, i, n, y, N = 512;
char B[262144];
void G(int i) {
  if (t && B[i] == 88) B[i] = 46, t++, G(i - N), G(i + N), G(i - 1), G(i + 1);
}
int main() {
  for (scanf("%d%d%d", &n, &y, &t); i < n; scanf("%s", B + (++i * N)))
    ;
  for (i = 0; i < N * N; i++)
    if (B[i] == 46) B[y = i] = 88, t--;
  for (G(y); t < n; printf("%s\n", B + (++t * N)))
    ;
}
p03436 AtCoder Beginner Contest 088 - Grid Repainting

Constraints

* H is an integer between 2 and 50 (inclusive).
* W is an integer between 2 and 50 (inclusive).
* s_{i, j} is `.` or `#` (1 \leq i \leq H, 1 \leq j \leq W).
* s_{1, 1} and s_{H, W} are `.`.

Input

Input is given from Standard Input in the following format:


H W
s_{1, 1}s_{1, 2}s_{1, 3} ... s_{1, W}
s_{2, 1}s_{2, 2}s_{2, 3} ... s_{2, W}
:   :
s_{H, 1}s_{H, 2}s_{H, 3} ... s_{H, W}


Output

Print the maximum possible score that Snuke can achieve, or print -1 if the game cannot be completed.

Examples

Input

3 3
..#
#..
...


Output

2


Input

3 3
..#
..
...


Output

2


Input

10 37
.....................................
...#...####...####..###...###...###..
..#.#..#...#.##....#...#.#...#.#...#.
..#.#..#...#.#.....#...#.#...#.#...#.
.#...#.#..##.#.....#...#.#.###.#.###.
.#####.####..#.....#...#..##....##...
.#...#.#...#.#.....#...#.#...#.#...#.
.#...#.#...#.##....#...#.#...#.#...#.
.#...#.####...####..###...###...###..
.....................................


Output

209

Example input:
10 37
.....................................
...#...####...####..###...###...###..
..#.#..#...#.##....#...#.#...#.#...#.
..#.#..#...#.#.....#...#.#...#.#...#.
.#...#.#..##.#.....#...#.#.###.#.###.
.#####.####..#.....#...#..##....##...
.#...#.#...#.#.....#...#.#...#.#...#.
.#...#.#...#.##....#...#.#...#.#...#.
.#...#.####...####..###...###...###..
.....................................
3 3
..#
#..
...
3 3
..#
..
...

Example output:
209
2
2

Difficulty rating: 0

Solution:
t,*g=open(0);h,w=map(int,t.split());v=[[0]*w for _ in range(h)];v[0][0]=1;q=[(0,0)]
while q:
	a,b=q.pop(0)
	for c,d in((-1,0),(0,-1),(1,0),(0,1)):
		x=a+c;y=b+d
		if w>x>=0<=y<h and v[y][x]<1 and g[y][x]==".":q+=[(x,y)];v[y][x]=v[b][a]+1
t=v[-1][-1];print((-1,sum(c.count(".")for c in g)-t)[t>0])
p03544 AtCoder Beginner Contest 079 - Lucas Number

It is November 18 now in Japan. By the way, 11 and 18 are adjacent Lucas numbers.

You are given an integer N. Find the N-th Lucas number.

Here, the i-th Lucas number L_i is defined as follows:

* L_0=2
* L_1=1
* L_i=L_{i-1}+L_{i-2} (i≥2)

Constraints

* 1≤N≤86
* It is guaranteed that the answer is less than 10^{18}.
* N is an integer.

Input

Input is given from Standard Input in the following format:


N


Output

Print the N-th Lucas number.

Examples

Input

5


Output

11


Input

86


Output

939587134549734843

Example input:
5
86

Example output:
11
939587134549734843

Difficulty rating: 0

Solution:
a,b=2,1;exec'a,b=b,a+b;'*input();print a
157_B. Trace

One day, as Sherlock Holmes was tracking down one very important criminal, he found a wonderful painting on the wall. This wall could be represented as a plane. The painting had several concentric circles that divided the wall into several parts. Some parts were painted red and all the other were painted blue. Besides, any two neighboring parts were painted different colors, that is, the red and the blue color were alternating, i. e. followed one after the other. The outer area of the wall (the area that lied outside all circles) was painted blue. Help Sherlock Holmes determine the total area of red parts of the wall.

Let us remind you that two circles are called concentric if their centers coincide. Several circles are called concentric if any two of them are concentric.

Input

The first line contains the single integer n (1 ≤ n ≤ 100). The second line contains n space-separated integers ri (1 ≤ ri ≤ 1000) — the circles' radii. It is guaranteed that all circles are different.

Output

Print the single real number — total area of the part of the wall that is painted red. The answer is accepted if absolute or relative error doesn't exceed 10 - 4.

Examples

Input

1
1


Output

3.1415926536


Input

3
1 4 2


Output

40.8407044967

Note

In the first sample the picture is just one circle of radius 1. Inner part of the circle is painted red. The area of the red part equals π × 12 = π.

In the second sample there are three circles of radii 1, 4 and 2. Outside part of the second circle is painted blue. Part between the second and the third circles is painted red. Part between the first and the third is painted blue. And, finally, the inner part of the first circle is painted red. Overall there are two red parts: the ring between the second and the third circles and the inner part of the first circle. Total area of the red parts is equal (π × 42 - π × 22) + π × 12 = π × 12 + π = 13π

Example input:
1
1

3
1 4 2


Example output:
3.141592653589793

40.840704496667314


Tags: geometry
sortings
Difficulty rating: 1000

Solution:
input();ans=0;k=1
for r in sorted(map(int,input().split())):ans+=r*r*k;k*=-1
print(abs(ans*3.1416))
794_B. Cutting Carrot

Igor the analyst has adopted n little bunnies. As we all know, bunnies love carrots. Thus, Igor has bought a carrot to be shared between his bunnies. Igor wants to treat all the bunnies equally, and thus he wants to cut the carrot into n pieces of equal area. 

Formally, the carrot can be viewed as an isosceles triangle with base length equal to 1 and height equal to h. Igor wants to make n - 1 cuts parallel to the base to cut the carrot into n pieces. He wants to make sure that all n pieces have the same area. Can you help Igor determine where to cut the carrot so that each piece have equal area?

<image> Illustration to the first example.

Input

The first and only line of input contains two space-separated integers, n and h (2 ≤ n ≤ 1000, 1 ≤ h ≤ 105).

Output

The output should contain n - 1 real numbers x1, x2, ..., xn - 1. The number xi denotes that the i-th cut must be made xi units away from the apex of the carrot. In addition, 0 < x1 < x2 < ... < xn - 1 < h must hold. 

Your output will be considered correct if absolute or relative error of every number in your output doesn't exceed 10 - 6.

Formally, let your answer be a, and the jury's answer be b. Your answer is considered correct if <image>.

Examples

Input

3 2


Output

1.154700538379 1.632993161855


Input

2 100000


Output

70710.678118654752

Note

Definition of isosceles triangle: <https://en.wikipedia.org/wiki/Isosceles_triangle>.

Example input:
3 2

2 100000


Example output:
1.1547005383792515 1.632993161855452

70710.67811865476

Tags: geometry
math
Difficulty rating: 1200

Solution:
n,h=map(int,input().split())
for x in range(1,n):print(h*(x/n)**0.5)
851_B. Arpa and an exam about geometry

Arpa is taking a geometry exam. Here is the last problem of the exam.

You are given three points a, b, c.

Find a point and an angle such that if we rotate the page around the point by the angle, the new position of a is the same as the old position of b, and the new position of b is the same as the old position of c.

Arpa is doubting if the problem has a solution or not (i.e. if there exists a point and an angle satisfying the condition). Help Arpa determine if the question has a solution or not.

Input

The only line contains six integers ax, ay, bx, by, cx, cy (|ax|, |ay|, |bx|, |by|, |cx|, |cy| ≤ 109). It's guaranteed that the points are distinct.

Output

Print "Yes" if the problem has a solution, "No" otherwise.

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

Examples

Input

0 1 1 1 1 0


Output

Yes


Input

1 1 0 0 1000 1000


Output

No

Note

In the first sample test, rotate the page around (0.5, 0.5) by <image>.

In the second sample test, you can't find any solution.

Example input:
0 1 1 1 1 0

1 1 0 0 1000 1000


Example output:
Yes

No


Tags: geometry
math
Difficulty rating: 1400

Solution:
a,b,x,y,u,v=map(int,raw_input().split())
u-=x
v-=y
x-=a
y-=b
print ('No','Yes')[(u-x or v-y) and u*u+v*v==x*x+y*y]
p03001 AtCoder Beginner Contest 130 - Rectangle Cutting

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

Constraints

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

Input

Input is given from Standard Input in the following format:


W H x y


Output

Print the maximum possible area of the part whose area is not larger than that of the other, followed by `1` if there are multiple ways to cut the rectangle and achieve that maximum, and `0` otherwise.

The area printed will be judged correct when its absolute or relative error is at most 10^{-9}.

Examples

Input

2 3 1 2


Output

3.000000 0


Input

2 2 1 1


Output

2.000000 1

Example input:
2 3 1 2
2 2 1 1

Example output:
3.000000 0
2.000000 1

Difficulty rating: 0

Solution:
W,H,x,y=map(int,input().split());print(W*H/2,+(W*H==x*y*4))
598_C. Nearest vectors

You are given the set of vectors on the plane, each of them starting at the origin. Your task is to find a pair of vectors with the minimal non-oriented angle between them.

Non-oriented angle is non-negative value, minimal between clockwise and counterclockwise direction angles. Non-oriented angle is always between 0 and π. For example, opposite directions vectors have angle equals to π.

Input

First line of the input contains a single integer n (2 ≤ n ≤ 100 000) — the number of vectors.

The i-th of the following n lines contains two integers xi and yi (|x|, |y| ≤ 10 000, x2 + y2 > 0) — the coordinates of the i-th vector. Vectors are numbered from 1 to n in order of appearing in the input. It is guaranteed that no two vectors in the input share the same direction (but they still can have opposite directions).

Output

Print two integer numbers a and b (a ≠ b) — a pair of indices of vectors with the minimal non-oriented angle. You can print the numbers in any order. If there are many possible answers, print any.

Examples

Input

4
-1 0
0 -1
1 0
1 1


Output

3 4


Input

6
-1 0
0 -1
1 0
1 1
-4 -5
-4 -6


Output

6 5

Example input:
6
-1 0
0 -1
1 0
1 1
-4 -5
-4 -6

4
-1 0
0 -1
1 0
1 1


Example output:
5 6

3 4


Tags: geometry
sortings
Difficulty rating: 2300

Solution:
from math import atan2

s = lambda a, b: a[0] * b[0] + a[1] * b[1]
v = lambda a, b: a[0] * b[1] - a[1] * b[0]

p = []
for i in range(int(input())):
    x, y = map(int, input().split())
    p.append((atan2(x, y), (x, y), i + 1))
p.sort()

d = [(s(a, b), abs(v(a, b)), i, j) for (x, a, i), (y, b, j) in zip(p, p[1:] + p[:1])]
x = d[0]

for y in d:
    if v(y[:2], x[:2]) > 0: x = y

print(x[2], x[3])
613_A. Peter and Snow Blower

Peter got a new snow blower as a New Year present. Of course, Peter decided to try it immediately. After reading the instructions he realized that it does not work like regular snow blowing machines. In order to make it work, you need to tie it to some point that it does not cover, and then switch it on. As a result it will go along a circle around this point and will remove all the snow from its path.

Formally, we assume that Peter's machine is a polygon on a plane. Then, after the machine is switched on, it will make a circle around the point to which Peter tied it (this point lies strictly outside the polygon). That is, each of the points lying within or on the border of the polygon will move along the circular trajectory, with the center of the circle at the point to which Peter tied his machine.

Peter decided to tie his car to point P and now he is wondering what is the area of ​​the region that will be cleared from snow. Help him.

Input

The first line of the input contains three integers — the number of vertices of the polygon n (<image>), and coordinates of point P.

Each of the next n lines contains two integers — coordinates of the vertices of the polygon in the clockwise or counterclockwise order. It is guaranteed that no three consecutive vertices lie on a common straight line.

All the numbers in the input are integers that do not exceed 1 000 000 in their absolute value.

Output

Print a single real value number — the area of the region that will be cleared. Your answer will be considered correct if its absolute or relative error does not exceed 10 - 6. 

Namely: let's assume that your answer is a, and the answer of the jury is b. The checker program will consider your answer correct, if <image>.

Examples

Input

3 0 0
0 1
-1 2
1 2


Output

12.566370614359172464


Input

4 1 -1
0 0
1 2
2 0
1 1


Output

21.991148575128551812

Note

In the first sample snow will be removed from that area:

<image>

Example input:
3 0 0
0 1
-1 2
1 2

4 1 -1
0 0
1 2
2 0
1 1


Example output:
12.566370614359172464

21.991148575128551812


Tags: binary search
geometry
ternary search
Difficulty rating: 1900

Solution:
n,x,y = map(int,raw_input().split())
pi = 3.14159265358979
m = 999999999999999999999
M = -1
a,b=map(int,raw_input().split())
temp = a,b
for i in xrange(n):
    if i != n-1:
        c,d=map(int,raw_input().split())
    else:
        c,d = temp
    k = float((d-b)*(y-b)+(a-c)*(a-x))/((a-c)**2+(d-b)**2)
    p,q=a+k*(c-a),b+k*(d-b)
    l1 = (a-x)**2+(b-y)**2
    l2 = (c-x)**2+(d-y)**2
    if 0<k<1:
        m = min(m,(p-x)**2+(q-y)**2)
    else:
        m = min(m,l1,l2)
    M = max(M,l1,l2)
    a,b=c,d
print (M-m)*pi