### Prompt

Develop a solution in cpp to the problem described below:

Taro, a junior high school student, is working on his homework. Today's homework is to read Chinese classic texts.

As you know, Japanese language shares the (mostly) same Chinese characters but the order of words is a bit different. Therefore the notation called "returning marks" was invented in order to read Chinese classic texts in the order similar to Japanese language.

There are two major types of returning marks: 'Re' mark and jump marks. Also there are a couple of jump marks such as one-two-three marks, top-middle-bottom marks. The marks are attached to letters to describe the reading order of each letter in the Chinese classic text. Figure 1 is an example of a Chinese classic text annotated with returning marks, which are the small letters at the bottom-left of the big Chinese letters.

<image>

Figure 1: a Chinese classic text

Taro generalized the concept of jump marks, and summarized the rules to read Chinese classic texts with returning marks as below. Your task is to help Taro by writing a program that interprets Chinese classic texts with returning marks following his rules, and outputs the order of reading of each letter.

When two (or more) rules are applicable in each step, the latter in the list below is applied first, then the former.

1. Basically letters are read downwards from top to bottom, i.e. the first letter should be read (or skipped) first, and after the i-th letter is read or skipped, (i + 1)-th letter is read next.
2. Each jump mark has a type (represented with a string consisting of lower-case letters) and a number (represented with a positive integer). A letter with a jump mark whose number is 2 or larger must be skipped.
3. When the i-th letter with a jump mark of type t, number n is read, and when there exists an unread letter L at position less than i that has a jump mark of type t, number n + 1, then L must be read next. If there is no such letter L, the (k + 1)-th letter is read, where k is the index of the most recently read letter with a jump mark of type t, number 1.
4. A letter with a 'Re' mark must be skipped.
5. When the i-th letter is read and (i - 1)-th letter has a 'Re' mark, then (i - 1)-th letter must be read next.
6. No letter may be read twice or more. Once a letter is read, the letter must be skipped in the subsequent steps.
7. If no letter can be read next, finish reading.

Let's see the first case of the sample input. We begin reading with the first letter because of the rule 1. However, since the first letter has a jump mark 'onetwo2', we must follow the rule 2 and skip the letter. Therefore the second letter, which has no returning mark, will be read first.

Then the third letter will be read. The third letter has a jump mark 'onetwo1', so we must follow rule 3 and read a letter with a jump mark `onetwo2' next, if exists. The first letter has the exact jump mark, so it will be read third. Similarly, the fifth letter is read fourth, and then the sixth letter is read.

Although we have two letters which have the same jump mark 'onetwo2', we must not take into account the first letter, which has already been read, and must read the fourth letter. Now we have read all six letters and no letter can be read next, so we finish reading. We have read the second, third, first, fifth, sixth, and fourth letter in this order, so the output is 2 3 1 5 6 4.

Input

The input contains multiple datasets. Each dataset is given in the following format:

N
mark1
...
markN

N, a positive integer (1 ≤ N ≤ 10,000), means the number of letters in a Chinese classic text. marki denotes returning marks attached to the i-th letter.

A 'Re' mark is represented by a single letter, namely, 'v' (quotes for clarity). The description of a jump mark is the simple concatenation of its type, specified by one or more lowercase letter, and a positive integer. Note that each letter has at most one jump mark and at most one 'Re' mark. When the same letter has both types of returning marks, the description of the jump mark comes first, followed by 'v' for the 'Re' mark. You can assume this happens only on the jump marks with the number 1.

If the i-th letter has no returning mark, marki is '-' (quotes for clarity). The length of marki never exceeds 20.

You may assume that input is well-formed, that is, there is exactly one reading order that follows the rules above. And in the ordering, every letter is read exactly once.

You may also assume that the N-th letter does not have 'Re' mark.

The input ends when N = 0. Your program must not output anything for this case.

Output

For each dataset, you should output N lines. The first line should contain the index of the letter which is to be read first, the second line for the letter which is to be read second, and so on. All the indices are 1-based.

Example

Input

6
onetwo2
-
onetwo1
onetwo2
-
onetwo1
7
v
topbottom2
onetwo2
-
onetwo1
topbottom1
-
6
baz2
foo2
baz1v
bar2
foo1
bar1
0

Output

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

### Response

```cpp
#define _CRT_SECURE_NO_WARNINGS
#pragma comment(linker, "/STACK:500000000")
#include <functional>
#include <algorithm>
#include <iostream>
#include <string.h>
#include <stdlib.h>
#include <complex>
#include <sstream>
#include <numeric>
#include <ctype.h>
#include <stdio.h>
#include <bitset>
#include <vector>
#include <string>
#include <math.h>
#include <time.h>
#include <queue>
#include <stack>
#include <list>
#include <map>
#include <set>
#define Int long long
#define INF 0x3F3F3F3F
#define eps 1e-9
using namespace std;

#pragma comment(linker, "/STACK:500000000")
#include <functional>
#include <algorithm>
#include <iostream>
#include <string.h>
#include <stdlib.h>
#include <limits.h>
#include <numeric>
#include <sstream>
#include <fstream>
#include <ctype.h>
#include <stdio.h>
#include <bitset>
#include <vector>
#include <string>
#include <math.h>
#include <time.h>
#include <queue>
#include <stack>
#include <list>
#include <map>
#include <set>
#define Int long long
#define eps 1e-9
using namespace std;
typedef pair<int, int> pii;

#define MAXN 11111

int N;
string mark[MAXN];
int used[MAXN], nex[MAXN];
map<string, int> M;
vector<int> ans;

void read(int cur)
{
	while (!used[cur])
	{
		ans.push_back(cur);
		used[cur] = 1;
		if (nex[cur] == -1)
			break;
		cur = nex[cur];
	}
}

int main()
{
	while (cin >> N && N)
	{
		for (int i = 0; i < N; i++)
			cin >> mark[i];
		fill(used, used + 10010, 0);
		fill(nex, nex + 10010, -1);
		M.clear();
		ans.clear();

		for (int i = 0; i < N; i++)
		{
			if (mark[i] == "-")
				read(i);
			else if (mark[i] == "v")
				nex[i + 1] = i;
			else
			{
				string type;
				int number = 0;
				int x = 0;
				while (islower(mark[i][x]))
				{
					type += mark[i][x];
					x++;
				}
				while (x<mark[i].size() && isdigit(mark[i][x]))
				{
					number = number * 10 + mark[i][x] - '0';
					x++;
				}
				if (M.find(type) != M.end())
					nex[i] = M[type];

				if (number > 1)
					M[type] = i;
				else
					M.erase(type);

				if (x < mark[i].size())
					nex[i + 1] = i;
				else if (number == 1)
					read(i);
			}
		}
		for (int i = 0; i < N; i++)
			cout << ans[i] + 1 << endl;
	}
}
```


### Prompt

Construct a Cpp code solution to the problem outlined:

Gleb ordered pizza home. When the courier delivered the pizza, he was very upset, because several pieces of sausage lay on the crust, and he does not really like the crust.

The pizza is a circle of radius r and center at the origin. Pizza consists of the main part — circle of radius r - d with center at the origin, and crust around the main part of the width d. Pieces of sausage are also circles. The radius of the i -th piece of the sausage is ri, and the center is given as a pair (xi, yi).

Gleb asks you to help determine the number of pieces of sausage caught on the crust. A piece of sausage got on the crust, if it completely lies on the crust.

Input

First string contains two integer numbers r and d (0 ≤ d < r ≤ 500) — the radius of pizza and the width of crust.

Next line contains one integer number n — the number of pieces of sausage (1 ≤ n ≤ 105).

Each of next n lines contains three integer numbers xi, yi and ri ( - 500 ≤ xi, yi ≤ 500, 0 ≤ ri ≤ 500), where xi and yi are coordinates of the center of i-th peace of sausage, ri — radius of i-th peace of sausage.

Output

Output the number of pieces of sausage that lay on the crust.

Examples

Input

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

Output

2

Input

10 8
4
0 0 9
0 0 10
1 0 1
1 0 2

Output

0

Note

Below is a picture explaining the first example. Circles of green color denote pieces of sausage lying on the crust.

<image>

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
int main() {
  float r, d;
  cin >> r >> d;
  int n, count = 0;
  cin >> n;
  float t, x, y, rs;
  int i;
  for (i = 0; i < n; i++) {
    cin >> x >> y >> rs;
    t = sqrt(x * x + y * y) - rs;
    if (t >= r - d && t + 2 * rs <= r) count++;
  }
  cout << count << endl;
  return 0;
}

```


### Prompt

Please create a solution in Cpp to the following problem:

There are N pieces of source code. The characteristics of the i-th code is represented by M integers A_{i1}, A_{i2}, ..., A_{iM}.

Additionally, you are given integers B_1, B_2, ..., B_M and C.

The i-th code correctly solves this problem if and only if A_{i1} B_1 + A_{i2} B_2 + ... + A_{iM} B_M + C > 0.

Among the N codes, find the number of codes that correctly solve this problem.

Constraints

* All values in input are integers.
* 1 \leq N, M \leq 20
* -100 \leq A_{ij} \leq 100
* -100 \leq B_i \leq 100
* -100 \leq C \leq 100

Input

Input is given from Standard Input in the following format:

N M C
B_1 B_2 ... B_M
A_{11} A_{12} ... A_{1M}
A_{21} A_{22} ... A_{2M}
\vdots
A_{N1} A_{N2} ... A_{NM}

Output

Print the number of codes among the given N codes that correctly solve this problem.

Examples

Input

2 3 -10
1 2 3
3 2 1
1 2 2

Output

1

Input

5 2 -4
-2 5
100 41
100 40
-3 0
-6 -2
18 -13

Output

2

Input

3 3 0
100 -100 0
0 100 100
100 100 100
-100 100 100

Output

0

### Response

```cpp
#include<iostream>
using namespace std;
int main(){
	int a, b, c, x[20][20], y[20], z[20] = { 0 },p=0;
	cin >> a >> b >> c;
	for (int i = 0; i < b; i++) {
		cin >> y[i];
	}
	for (int j = 0; j < a; j++) {
		for (int i = 0; i < b; i++) {
			cin >> x[j][i];
			z[j] += x[j][i] * y[i];
		}
		if (z[j]+c > 0)p++;
	}
	cout << p << endl;
	return 0;

}
```


### Prompt

In CPP, your task is to solve the following problem:

Teacher thinks that we make a lot of progress. Now we are even allowed to use decimal notation instead of counting sticks. After the test the teacher promised to show us a "very beautiful number". But the problem is, he's left his paper with the number in the teachers' office.

The teacher remembers that the "very beautiful number" was strictly positive, didn't contain any leading zeroes, had the length of exactly p decimal digits, and if we move the last digit of the number to the beginning, it grows exactly x times. Besides, the teacher is sure that among all such numbers the "very beautiful number" is minimal possible.

The teachers' office isn't near and the teacher isn't young. But we've passed the test and we deserved the right to see the "very beautiful number". Help to restore the justice, find the "very beautiful number" for us!

Input

The single line contains integers p, x (1 ≤ p ≤ 106, 1 ≤ x ≤ 9).

Output

If the teacher's made a mistake and such number doesn't exist, then print on a single line "Impossible" (without the quotes). Otherwise, print the "very beautiful number" without leading zeroes.

Examples

Input

6 5

Output

142857

Input

1 2

Output

Impossible

Input

6 4

Output

102564

Note

Sample 1: 142857·5 = 714285.

Sample 2: The number that consists of a single digit cannot stay what it is when multiplied by 2, thus, the answer to the test sample is "Impossible".

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
int p, x;
int a[2000005];
bool Try(int b) {
  a[p] = b;
  int s = 0;
  for (int i = p - 1; i >= 0; i--) {
    s += a[i + 1] * x;
    a[i] = s % 10;
    s /= 10;
  }
  if (a[0] == a[p] && p >= 3 && a[1] > 0) {
    for (int i = 1; i <= p; i++) cout << a[i];
    return true;
  } else
    return false;
}
int main() {
  cin >> p >> x;
  if (p == 1 && x == 1) {
    cout << 1;
    return 0;
  }
  for (int i = 1; i <= 9; i++) {
    if (Try(i)) {
      return 0;
    }
  }
  cout << "Impossible";
  return 0;
}

```


### Prompt

Your challenge is to write a CPP solution to the following problem:

This is an easy version of the problem. The actual problems are different, but the easy version is almost a subtask of the hard version. Note that the constraints and the output format are different.

You are given a string s consisting of n lowercase Latin letters.

You have to color all its characters one of the two colors (each character to exactly one color, the same letters can be colored the same or different colors, i.e. you can choose exactly one color for each index in s).

After coloring, you can swap any two neighboring characters of the string that are colored different colors. You can perform such an operation arbitrary (possibly, zero) number of times.

The goal is to make the string sorted, i.e. all characters should be in alphabetical order.

Your task is to say if it is possible to color the given string so that after coloring it can become sorted by some sequence of swaps. Note that you have to restore only coloring, not the sequence of swaps.

Input

The first line of the input contains one integer n (1 ≤ n ≤ 200) — the length of s.

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

Output

If it is impossible to color the given string so that after coloring it can become sorted by some sequence of swaps, print "NO" (without quotes) in the first line.

Otherwise, print "YES" in the first line and any correct coloring in the second line (the coloring is the string consisting of n characters, the i-th character should be '0' if the i-th character is colored the first color and '1' otherwise).

Examples

Input

9
abacbecfd

Output

YES
001010101

Input

8
aaabbcbb

Output

YES
01011011

Input

7
abcdedc

Output

NO

Input

5
abcde

Output

YES
00000

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
const double pi = 2 * acos(0);
const int oo = 2e9;
const int N = 205;
const int AL = 26;
vector<int> idx[AL];
vector<int> adj[N];
int clr[N];
bool dfs(int u, int c = 0);
int main() {
  int n;
  scanf("%d", &(n));
  string s(n, ' ');
  for (int i = 0; i < n; i++) scanf(" %c", &s[i]);
  memset(clr, -1, sizeof(clr));
  for (int i = 0; i < n; i++) {
    int x = s[i] - 'a';
    for (int c = x + 1; c < AL; c++) {
      for (auto& j : idx[c]) {
        adj[i].push_back(j);
        adj[j].push_back(i);
      }
    }
    idx[x].push_back(i);
  }
  bool valid = true;
  for (int i = 0; i < n; i++) {
    if (clr[i] == -1) valid &= dfs(i);
  }
  if (valid) {
    puts("YES");
    for (int i = 0; i < n; i++) {
      printf("%d", clr[i]);
    }
    printf("\n");
  } else
    printf("NO\n");
  return 0;
}
bool dfs(int u, int c) {
  clr[u] = c;
  bool ret = true;
  for (auto& v : adj[u]) {
    if (clr[v] == -1)
      ret &= dfs(v, !c);
    else if (c == clr[v])
      return false;
  }
  return ret;
}

```


### Prompt

Please provide a cpp coded solution to the problem described below:

Find the sum of weights of edges of the Minimum Spanning Tree for a given weighted undirected graph G = (V, E).

Constraints

* 1 ≤ |V| ≤ 10,000
* 0 ≤ |E| ≤ 100,000
* 0 ≤ wi ≤ 10,000
* The graph is connected
* There are no parallel edges
* There are no self-loops

Input

|V| |E|
s0 t0 w0
s1 t1 w1
:
s|E|-1 t|E|-1 w|E|-1

, where |V| is the number of vertices and |E| is the number of edges in the graph. The graph vertices are named with the numbers 0, 1,..., |V|-1 respectively.

si and ti represent source and target verticess of i-th edge (undirected) and wi represents the weight of the i-th edge.

Output

Print the sum of the weights of the Minimum Spanning Tree.

Examples

Input

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

Output

3

Input

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

Output

5

### Response

```cpp
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>

using namespace std;

struct Edge {
    int to, cost;
    bool operator<(const Edge& o) const {
        return cost > o.cost;
    }
};

const int MAX_V = 10000;
const int INF = 1 << 28;

int V, E;
vector<Edge> edges[MAX_V];
bool done[MAX_V];

int main() {
    cin >> V >> E;
    for (int i = 0; i < E; ++i) {
        int s, t, w;
        cin >> s >> t >> w;
        edges[s].push_back((Edge) { t, w });
        edges[t].push_back((Edge) { s, w });
    }

    int res = 0;
    priority_queue<Edge> que;
    fill(done, done + V, false);
    que.push((Edge) { 0, 0 });
    while (!que.empty()) {
        Edge e = que.top();
        que.pop();
        if (done[e.to]) { continue; }
        done[e.to] = true;
        res += e.cost;
        for (Edge e2: edges[e.to]) {
            que.push(e2);
        }
    }
    cout << res << endl;
}
```


### Prompt

Please provide a Cpp coded solution to the problem described below:

One very well-known internet resource site (let's call it X) has come up with a New Year adventure. Specifically, they decided to give ratings to all visitors.

There are n users on the site, for each user we know the rating value he wants to get as a New Year Present. We know that user i wants to get at least ai rating units as a present.

The X site is administered by very creative and thrifty people. On the one hand, they want to give distinct ratings and on the other hand, the total sum of the ratings in the present must be as small as possible.

Help site X cope with the challenging task of rating distribution. Find the optimal distribution.

Input

The first line contains integer n (1 ≤ n ≤ 3·105) — the number of users on the site. The next line contains integer sequence a1, a2, ..., an (1 ≤ ai ≤ 109).

Output

Print a sequence of integers b1, b2, ..., bn. Number bi means that user i gets bi of rating as a present. The printed sequence must meet the problem conditions.

If there are multiple optimal solutions, print any of them.

Examples

Input

3
5 1 1

Output

5 1 2

Input

1
1000000000

Output

1000000000

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
using namespace std::chrono;
bool SoSec(const pair<int, int> &a, const pair<int, int> &b) {
  return (a.second < b.second);
}
void vw(vector<vector<int>> v) {
  cout << (v.size()) << " is: " << endl;
  for (vector<int> B : v) {
    for (int x : B) {
      cout << x << " ";
    }
    cout << endl;
  }
  cout << endl;
}
void v23(vector<int> v) {
  cout << (v.size()) << " is: " << endl;
  for (int i : v) {
    cout << i << "	";
  }
  cout << endl;
}
long long Sqrt(long long x) {
  if (x == 0 || x == 1) return x;
  long long start = 1, end = x, ans;
  while (start <= end) {
    long long mid = (start + end) / 2;
    if (mid * mid == x) return mid;
    if (mid * mid < x) {
      start = mid + 1;
      ans = mid;
    } else
      end = mid - 1;
  }
  return ans;
}
vector<vector<int>> v;
long long const MAX = 2147483647, REALMAX = 9223372036854775806;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int n;
  cin >> n;
  vector<pair<int, int>> v(n);
  for (int i = 0; i < n; i++) {
    cin >> v[i].first;
    v[i].second = i + 1;
  }
  sort(v.begin(), v.end());
  for (int i = 1; i < n; i++) {
    if (v[i].first <= v[i - 1].first) v[i].first = v[i - 1].first + 1;
  }
  sort(v.begin(), v.end(), SoSec);
  for (int i = 0; i < n; i++) {
    cout << v[i].first << "  ";
  }
}

```


### Prompt

Develop a solution in cpp to the problem described below:

A and B are preparing themselves for programming contests.

To train their logical thinking and solve problems better, A and B decided to play chess. During the game A wondered whose position is now stronger.

For each chess piece we know its weight:

  * the queen's weight is 9,
  * the rook's weight is 5,
  * the bishop's weight is 3,
  * the knight's weight is 3,
  * the pawn's weight is 1,
  * the king's weight isn't considered in evaluating position.

The player's weight equals to the sum of weights of all his pieces on the board.

As A doesn't like counting, he asked you to help him determine which player has the larger position weight.

Input

The input contains eight lines, eight characters each — the board's description.

The white pieces on the board are marked with uppercase letters, the black pieces are marked with lowercase letters.

The white pieces are denoted as follows: the queen is represented is 'Q', the rook — as 'R', the bishop — as'B', the knight — as 'N', the pawn — as 'P', the king — as 'K'.

The black pieces are denoted as 'q', 'r', 'b', 'n', 'p', 'k', respectively.

An empty square of the board is marked as '.' (a dot).

It is not guaranteed that the given chess position can be achieved in a real game. Specifically, there can be an arbitrary (possibly zero) number pieces of each type, the king may be under attack and so on.

Output

Print "White" (without quotes) if the weight of the position of the white pieces is more than the weight of the position of the black pieces, print "Black" if the weight of the black pieces is more than the weight of the white pieces and print "Draw" if the weights of the white and black pieces are equal.

Examples

Input

...QK...
........
........
........
........
........
........
...rk...

Output

White

Input

rnbqkbnr
pppppppp
........
........
........
........
PPPPPPPP
RNBQKBNR

Output

Draw

Input

rppppppr
...k....
........
........
........
........
K...Q...
........

Output

Black

Note

In the first test sample the weight of the position of the white pieces equals to 9, the weight of the position of the black pieces equals 5.

In the second test sample the weights of the positions of the black and the white pieces are equal to 39.

In the third test sample the weight of the position of the white pieces equals to 9, the weight of the position of the black pieces equals to 16.

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
const double eps = 1e-8;
char mat[10][10];
int w[26];
int main() {
  w['q' - 'a'] = 9;
  w['r' - 'a'] = 5;
  w['b' - 'a'] = 3;
  w['n' - 'a'] = 3;
  w['p' - 'a'] = 1;
  char c;
  int black = 0, white = 0;
  for (int i = 0; i < 8; i++) {
    for (int j = 0; j < 8; j++) {
      scanf("%c", &c);
      if (c >= 'a' && c <= 'z') {
        black += w[c - 'a'];
      } else if (c >= 'A' && c <= 'Z') {
        white += w[c - 'A'];
      }
    }
    getchar();
  }
  if (black == white)
    puts("Draw");
  else if (black > white)
    puts("Black");
  else
    puts("White");
  return 0;
}

```


### Prompt

Generate a CPP solution to the following problem:

You are given an undirected unweighted graph with N vertices and M edges that contains neither self-loops nor double edges.
Here, a self-loop is an edge where a_i = b_i (1≤i≤M), and double edges are two edges where (a_i,b_i)=(a_j,b_j) or (a_i,b_i)=(b_j,a_j) (1≤i<j≤M).
How many different paths start from vertex 1 and visit all the vertices exactly once?
Here, the endpoints of a path are considered visited.

For example, let us assume that the following undirected graph shown in Figure 1 is given.

<image>

Figure 1: an example of an undirected graph

The following path shown in Figure 2 satisfies the condition.

<image>

Figure 2: an example of a path that satisfies the condition

However, the following path shown in Figure 3 does not satisfy the condition, because it does not visit all the vertices.

<image>

Figure 3: an example of a path that does not satisfy the condition

Neither the following path shown in Figure 4, because it does not start from vertex 1.

<image>

Figure 4: another example of a path that does not satisfy the condition

Constraints

* 2≦N≦8
* 0≦M≦N(N-1)/2
* 1≦a_i<b_i≦N
* The given graph contains neither self-loops nor double edges.

Input

The 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

Print the number of the different paths that start from vertex 1 and visit all the vertices exactly once.

Examples

Input

3 3
1 2
1 3
2 3

Output

2

Input

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

Output

1

### Response

```cpp
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N,M;cin>>N>>M;
  vector<vector<bool>>A(N,vector<bool>(N,0));
  for(int i=0;i<M;i++){
    int a,b;cin>>a>>b;A[a-1][b-1]=1;A[b-1][a-1]=1;
  }
  vector<int>v(N-1);for(int i=1;i<N;i++)v[i-1]=i;
  int ans=0;
  do{
    int s=0;
    for(int n:v){
      if(!A[s][n])break;
      s=n;
    }
    if(s==v[v.size()-1])ans++;
  }while(next_permutation(v.begin(),v.end()));
  cout<<ans;
}
```


### Prompt

Develop a solution in CPP to the problem described below:

Moriarty has trapped n people in n distinct rooms in a hotel. Some rooms are locked, others are unlocked. But, there is a condition that the people in the hotel can only escape when all the doors are unlocked at the same time. There are m switches. Each switch control doors of some rooms, but each door is controlled by exactly two switches.

You are given the initial configuration of the doors. Toggling any switch, that is, turning it ON when it is OFF, or turning it OFF when it is ON, toggles the condition of the doors that this switch controls. Say, we toggled switch 1, which was connected to room 1, 2 and 3 which were respectively locked, unlocked and unlocked. Then, after toggling the switch, they become unlocked, locked and locked.

You need to tell Sherlock, if there exists a way to unlock all doors at the same time.

Input

First line of input contains two integers n and m (2 ≤ n ≤ 105, 2 ≤ m ≤ 105) — the number of rooms and the number of switches.

Next line contains n space-separated integers r1, r2, ..., rn (0 ≤ ri ≤ 1) which tell the status of room doors. The i-th room is locked if ri = 0, otherwise it is unlocked.

The i-th of next m lines contains an integer xi (0 ≤ xi ≤ n) followed by xi distinct integers separated by space, denoting the number of rooms controlled by the i-th switch followed by the room numbers that this switch controls. It is guaranteed that the room numbers are in the range from 1 to n. It is guaranteed that each door is controlled by exactly two switches.

Output

Output "YES" without quotes, if it is possible to open all doors at the same time, otherwise output "NO" without quotes.

Examples

Input

3 3
1 0 1
2 1 3
2 1 2
2 2 3

Output

NO

Input

3 3
1 0 1
3 1 2 3
1 2
2 1 3

Output

YES

Input

3 3
1 0 1
3 1 2 3
2 1 2
1 3

Output

NO

Note

In the second example input, the initial statuses of the doors are [1, 0, 1] (0 means locked, 1 — unlocked).

After toggling switch 3, we get [0, 0, 0] that means all doors are locked.

Then, after toggling switch 1, we get [1, 1, 1] that means all doors are unlocked.

It can be seen that for the first and for the third example inputs it is not possible to make all doors unlocked.

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
const long double PI = acos(-1);
const int mod = 13313;
template <class T>
inline T bigmod(T a, T b, T M) {
  long long ret = 1;
  for (; b > 0; b >>= 1) {
    if (b & 1) ret = (ret * a) % M;
    a = (a * a) % M;
  }
  return (T)ret;
}
template <class T>
inline T gcd(T a, T b) {
  while (b) b ^= a ^= b ^= a %= b;
  return a;
}
template <class T>
inline T lcm(T a, T b) {
  return (a / gcd(a, b)) * b;
}
template <class T>
inline T poww(T a, T b) {
  long long ret = 1;
  for (; b > 0; b >>= 1) {
    if (b & 1) ret = ret * a;
    a = a * a;
  }
  return (T)ret;
}
pair<int, int> exEuclid(int a, int b) {
  if (b == 0)
    return pair<int, int>(1, 0);
  else {
    pair<int, int> r = exEuclid(b, a % b);
    return pair<int, int>(r.second, r.first - r.second * (a / b));
  }
}
int modInv(int a, int m) {
  pair<int, int> ret = exEuclid(a, m);
  return ((ret.first % m) + m) % m;
}
int Set(int N, int pos) { return N = N | (1 << pos); }
int reset(int N, int pos) { return N = N & ~(1 << pos); }
bool check(int N, int pos) { return (bool)(N & (1 << pos)); }
int door[2 * 100010];
vector<int> adj[2 * 100010];
vector<int> g1[4 * 100010], g2[4 * 100010];
int visited[4 * 100010], pos[4 * 100010];
stack<int> stk;
void dfs(int u) {
  visited[u] = 1;
  for (int i = (0); i < (g1[u].size()); i++) {
    int v = g1[u][i];
    if (!visited[v]) dfs(v);
  }
  stk.push(u);
}
void dfs2(int u, int com) {
  pos[u] = com;
  visited[u] = 1;
  for (int i = (0); i < (g2[u].size()); i++) {
    int v = g2[u][i];
    if (!visited[v]) dfs2(v, com);
  }
}
int main() {
  int n, m, x, y;
  cin >> n >> m;
  for (int i = (1); i <= (n); i++) {
    cin >> door[i];
  }
  for (int i = (1); i <= (m); i++) {
    cin >> x;
    for (int j = (1); j <= (x); j++) {
      cin >> y;
      adj[y].push_back(i);
    }
  }
  for (int i = (1); i <= (n); i++) {
    int a = adj[i][0], b = adj[i][1];
    if (door[i]) {
      g1[a].push_back(b);
      g1[b].push_back(a);
      g2[a].push_back(b);
      g2[b].push_back(a);
      g1[b + m].push_back(a + m);
      g1[a + m].push_back(b + m);
      g2[b + m].push_back(a + m);
      g2[a + m].push_back(b + m);
    } else {
      g1[a + m].push_back(b);
      g2[b].push_back(a + m);
      g1[b].push_back(a + m);
      g2[a + m].push_back(b);
      g1[b + m].push_back(a);
      g2[a].push_back(b + m);
      g1[a].push_back(b + m);
      g2[b + m].push_back(a);
    }
  }
  for (int i = (1); i <= (2 * m); i++) {
    if (!visited[i]) dfs(i);
  }
  memset(visited, 0, sizeof visited);
  int cmp = 0;
  while (!stk.empty()) {
    int u = stk.top();
    stk.pop();
    if (!visited[u]) {
      ++cmp;
      dfs2(u, cmp);
    }
  }
  bool flag = true;
  for (int i = (1); i <= (m); i++) {
    if (pos[i] == pos[i + m]) {
      flag = false;
      break;
    }
  }
  if (flag) {
    cout << "YES\n";
  } else
    cout << "NO\n";
  return 0;
}

```


### Prompt

Your challenge is to write a cpp solution to the following problem:

A team of students from the city S is sent to the All-Berland Olympiad in Informatics. Traditionally, they go on the train. All students have bought tickets in one carriage, consisting of n compartments (each compartment has exactly four people). We know that if one compartment contain one or two students, then they get bored, and if one compartment contain three or four students, then the compartment has fun throughout the entire trip.

The students want to swap with other people, so that no compartment with students had bored students. To swap places with another person, you need to convince him that it is really necessary. The students can not independently find the necessary arguments, so they asked a sympathetic conductor for help. The conductor can use her life experience to persuade any passenger to switch places with some student.

However, the conductor does not want to waste time persuading the wrong people, so she wants to know what is the minimum number of people necessary to persuade her to change places with the students. Your task is to find the number.

After all the swaps each compartment should either have no student left, or have a company of three or four students.

Input

The first line contains integer n (1 ≤ n ≤ 106) — the number of compartments in the carriage. The second line contains n integers a1, a2, ..., an showing how many students ride in each compartment (0 ≤ ai ≤ 4). It is guaranteed that at least one student is riding in the train.

Output

If no sequence of swapping seats with other people leads to the desired result, print number "-1" (without the quotes). In another case, print the smallest number of people you need to persuade to swap places.

Examples

Input

5
1 2 2 4 3

Output

2

Input

3
4 1 1

Output

2

Input

4
0 3 0 4

Output

0

### Response

```cpp
#include <bits/stdc++.h>
int a[5];
int main() {
  int n, x;
  while (~scanf("%d", &n)) {
    memset(a, 0, sizeof(a));
    for (int i = 1; i <= n; ++i) {
      scanf("%d", &x);
      ++a[x];
    }
    int ans = 0;
    if (a[1] <= a[2]) {
      a[2] -= a[1];
      a[3] += a[1];
      ans += a[1];
      int t = a[2] / 3;
      a[2] %= 3;
      a[3] += t * 2;
      ans += t * 2;
      if (a[2] == 1) {
        if (a[4]) {
          ++ans;
        } else if (a[3] >= 2) {
          ans += 2;
        } else {
          ans = -1;
        }
      } else if (a[2] == 2) {
        ans += 2;
      }
    } else {
      a[1] -= a[2];
      a[3] += a[2];
      ans += a[2];
      int t = a[1] / 3;
      a[1] %= 3;
      a[3] += t;
      ans += t * 2;
      if (a[1] == 1) {
        if (a[3]) {
          ++ans;
        } else if (a[4] >= 2) {
          ans += 2;
        } else {
          ans = -1;
        }
      } else if (a[1] == 2) {
        if (a[4]) {
          ans += 2;
        } else if (a[3] >= 2) {
          ans += 2;
        } else {
          ans = -1;
        }
      }
    }
    printf("%d\n", ans);
  }
  return 0;
}

```


### Prompt

Create a solution in CPP for the following problem:

problem

For the integer n (1 ≤ n), let Pn be a string of n + 1 I's and n O's starting with I and alternating, where I and O are the uppercase Ai and O, respectively. is there.

P1 | IOI
--- | ---
P2 | IOIOI
P3 | IOIOIOI
|. |
|. |
|. |
Pn | IOIOIO ... OI (n O)

Figure 1-1 Character string considered in this question Pn

Given the integer n and the string s consisting only of I and O, write a program that outputs how many Pn's are contained in s.

input

The input consists of multiple datasets. Each dataset is given in the following format.

The integer n (1 ≤ n ≤ 1000000) is written on the first line.
The second line contains the integer m (1 ≤ m ≤ 1000000). M represents the number of characters in s.
The string s is written on the third line. S consists of only I and O.

For all scoring data, 2n + 1 ≤ m. Of the scoring data, 50% of the scoring data satisfies n ≤ 100 and m ≤ 10000.

When n is 0, it indicates the end of input. The number of datasets does not exceed 10.

output

For each dataset, print one integer on one line that indicates how many strings Pn are contained in the string s. If s does not contain Pn, print 0 as an integer.

Examples

Input

1
13
OOIOIOIOIIOII
2
13
OOIOIOIOIIOII
0

Output

4
2

Input

None

Output

None

### Response

```cpp
#include<cstdio>
#include<algorithm>
#include<cstring>
using namespace std;
char s[1000001];
int main(void)
{
	int n,k,i,j,w,x,m,cnt,cnt2;
	while(1)	{
		scanf("%d",&n);
		if(n==0)	break;
		scanf("%d",&m);
		scanf("%s",s);
		cnt2=0;
		for(i=0;i<m;i++)	{
			if(s[i]=='I')	{
				cnt=0;
				for(j=i+1;j<m;j+=2)	{
					if(s[j]=='O' && s[j+1]=='I')	{
						cnt++;
						if(cnt>=n)	cnt2++;
					}
					else {
						break;
					}
				}
				i=j-1;
			}
		}
		printf("%d\n",cnt2);
	}
	return 0;
}

```


### Prompt

Please create a solution in CPP to the following problem:

In order to make the "Sea Battle" game more interesting, Boris decided to add a new ship type to it. The ship consists of two rectangles. The first rectangle has a width of w_1 and a height of h_1, while the second rectangle has a width of w_2 and a height of h_2, where w_1 ≥ w_2. In this game, exactly one ship is used, made up of two rectangles. There are no other ships on the field.

The rectangles are placed on field in the following way:

  * the second rectangle is on top the first rectangle;
  * they are aligned to the left, i.e. their left sides are on the same line;
  * the rectangles are adjacent to each other without a gap.

See the pictures in the notes: the first rectangle is colored red, the second rectangle is colored blue.

Formally, let's introduce a coordinate system. Then, the leftmost bottom cell of the first rectangle has coordinates (1, 1), the rightmost top cell of the first rectangle has coordinates (w_1, h_1), the leftmost bottom cell of the second rectangle has coordinates (1, h_1 + 1) and the rightmost top cell of the second rectangle has coordinates (w_2, h_1 + h_2).

After the ship is completely destroyed, all cells neighboring by side or a corner with the ship are marked. Of course, only cells, which don't belong to the ship are marked. On the pictures in the notes such cells are colored green.

Find out how many cells should be marked after the ship is destroyed. The field of the game is infinite in any direction.

Input

Four lines contain integers w_1, h_1, w_2 and h_2 (1 ≤ w_1, h_1, w_2, h_2 ≤ 10^8, w_1 ≥ w_2) — the width of the first rectangle, the height of the first rectangle, the width of the second rectangle and the height of the second rectangle. You can't rotate the rectangles.

Output

Print exactly one integer — the number of cells, which should be marked after the ship is destroyed.

Examples

Input

2 1 2 1

Output

12

Input

2 2 1 2

Output

16

Note

In the first example the field looks as follows (the first rectangle is red, the second rectangle is blue, green shows the marked squares):

<image>

In the second example the field looks as:

<image>

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ;
  int w1, h1, w2, h2;
  cin >> w1 >> h1 >> w2 >> h2;
  long int ans = 2 * (h1 + h2 + 2) + (w1 + w2) + abs(w1 - w2);
  cout << ans << '\n';
  return 0;
}

```


### Prompt

Please create a solution in CPP to the following problem:

You are given a long decimal number a consisting of n digits from 1 to 9. You also have a function f that maps every digit from 1 to 9 to some (possibly the same) digit from 1 to 9.

You can perform the following operation no more than once: choose a non-empty contiguous subsegment of digits in a, and replace each digit x from this segment with f(x). For example, if a = 1337, f(1) = 1, f(3) = 5, f(7) = 3, and you choose the segment consisting of three rightmost digits, you get 1553 as the result.

What is the maximum possible number you can obtain applying this operation no more than once?

Input

The first line contains one integer n (1 ≤ n ≤ 2 ⋅ 10^5) — the number of digits in a.

The second line contains a string of n characters, denoting the number a. Each character is a decimal digit from 1 to 9.

The third line contains exactly 9 integers f(1), f(2), ..., f(9) (1 ≤ f(i) ≤ 9).

Output

Print the maximum number you can get after applying the operation described in the statement no more than once.

Examples

Input

4
1337
1 2 5 4 6 6 3 1 9

Output

1557

Input

5
11111
9 8 7 6 5 4 3 2 1

Output

99999

Input

2
33
1 1 1 1 1 1 1 1 1

Output

33

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
long long int i, j, t;
int main() {
  long long int m, n, l, c = 0;
  cin >> n;
  string x;
  cin >> x;
  long long int f[10] = {0};
  for (i = 1; i < 10; i++) cin >> f[i];
  long long int s[n];
  for (i = n - 1; i >= 0; i--) {
    s[i] = x[i] - '0';
  }
  for (i = 0; i < n; i++) {
    if (s[i] < f[s[i]]) {
      c = 1;
      s[i] = f[s[i]];
    } else if (s[i] == f[s[i]]) {
      continue;
    } else {
      if (c == 1) {
        break;
      }
    }
  }
  for (i = 0; i < n; i++) cout << s[i];
}

```


### Prompt

Create a solution in cpp for the following problem:

You are given n points on a line with their coordinates xi. Find the point x so the sum of distances to the given points is minimal.

Input

The first line contains integer n (1 ≤ n ≤ 3·105) — the number of points on the line.

The second line contains n integers xi ( - 109 ≤ xi ≤ 109) — the coordinates of the given n points.

Output

Print the only integer x — the position of the optimal point on the line. If there are several optimal points print the position of the leftmost one. It is guaranteed that the answer is always the integer.

Example

Input

4
1 2 3 4

Output

2

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 10;
const long long MOD = 1e9 + 7;
long long n, a[N], l, r, mn = 1e18, t1, t2, ans;
long long check(long long x) {
  long long len = 0;
  for (int i = 1; i <= n; i++) {
    len += abs(x - a[i] + 1);
  }
  return len;
}
int main() {
  scanf("%I64d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%I64d", &a[i]);
  }
  sort(a + 1, a + n + 1);
  printf("%I64d", a[(n + 1) / 2]);
  return 0;
}

```


### Prompt

Please provide a CPP coded solution to the problem described below:

We have N bulbs arranged on a number line, numbered 1 to N from left to right. Bulb i is at coordinate i.

Each bulb has a non-negative integer parameter called intensity. When there is a bulb of intensity d at coordinate x, the bulb illuminates the segment from coordinate x-d-0.5 to x+d+0.5. Initially, the intensity of Bulb i is A_i. We will now do the following operation K times in a row:

* For each integer i between 1 and N (inclusive), let B_i be the number of bulbs illuminating coordinate i. Then, change the intensity of each bulb i to B_i.

Find the intensity of each bulb after the K operations.

Constraints

* 1 \leq N \leq 2 \times 10^5
* 1 \leq K \leq 2 \times 10^5
* 0 \leq A_i \leq N

Input

Input is given from Standard Input in the following format:

N K
A_1 A_2 \ldots A_N

Output

Print the intensity A{'}_i of each bulb i after the K operations to Standard Output in the following format:

A{'}_1 A{'}_2 \ldots A{'}_N

Output

Print the intensity A{'}_i of each bulb i after the K operations to Standard Output in the following format:

A{'}_1 A{'}_2 \ldots A{'}_N

Examples

Input

5 1
1 0 0 1 0

Output

1 2 2 1 2

Input

5 2
1 0 0 1 0

Output

3 3 4 4 3

### Response

```cpp
#include<bits/stdc++.h>
using namespace std;
using p=pair<int,int>;
#define rep(i,N) for(int i=0;i<N;i++)

signed main(){
  int N,K;
  cin>>N>>K;
  vector<int> A(N);
  rep(i,N)cin>>A[i];
  rep(j,K){
    vector<int> B(N+1);
    rep(i,N){
      int L=max(0,i-A[i]);
      int R=min(i+A[i]+1,N);
      B[L]++;
      B[R]--;
    }
    rep(i,N)B[i+1]+=B[i];
    B.pop_back();
    if(A==B) break;
    A=B;
  }
  rep(i,N)cout<<A[i]<<endl;
  return 0;
}
```


### Prompt

Your task is to create a Cpp solution to the following problem:

The only king stands on the standard chess board. You are given his position in format "cd", where c is the column from 'a' to 'h' and d is the row from '1' to '8'. Find the number of moves permitted for the king.

Check the king's moves here https://en.wikipedia.org/wiki/King_(chess).

<image> King moves from the position e4

Input

The only line contains the king's position in the format "cd", where 'c' is the column from 'a' to 'h' and 'd' is the row from '1' to '8'.

Output

Print the only integer x — the number of moves permitted for the king.

Example

Input

e4

Output

8

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
int break_point() {
  char c;
  while ((c = getchar()) != '\n')
    ;
  return 0;
}
template <typename T>
void read_integer(T &r) {
  bool sign = 0;
  r = 0;
  char c;
  while (1) {
    c = getchar();
    if (c == '-') {
      sign = 1;
      break;
    }
    if (c != ' ' && c != '\n') {
      r = c - '0';
      break;
    }
  }
  while (1) {
    c = getchar();
    if (c == ' ' || c == '\n') break;
    r = r * 10 + (c - '0');
  }
  if (sign) r = -r;
}
long long binpowmod(long long a, long long b, long long mod) {
  if (b == 0) return 1;
  long long c = binpowmod(a, b >> 1, mod);
  return (((c * c) % mod) * (b & 1 ? a : 1)) % mod;
}
long long binpow(long long a, long long b) {
  if (b == 0) return 1;
  long long c = binpow(a, b >> 1);
  return c * c * (b & 1 ? a : 1);
}
inline int getbit(int x, int b) { return (x >> b) & 1; }
inline int setbit(int x, int b) { return x | (1 << b); }
inline void _setbit(int &x, int b) { x = setbit(x, b); }
inline long long setbit(long long x, int b) { return x | (1ll << b); }
inline void _setbit(long long &x, int b) { x = setbit(x, b); }
inline int unsetbit(int x, int b) { return x & (INT_MAX - (1 << b)); }
inline void _unsetbit(int &x, int b) { x = unsetbit(x, b); }
inline int countbit(int x) {
  x = x - ((x >> 1) & 0x55555555);
  x = (x & 0x33333333) + ((x >> 2) & 0x33333333);
  return ((x + (x >> 4) & 0xF0F0F0F) * 0x1010101) >> 24;
}
inline long long countbit(long long x) {
  return countbit(int(x & INT_MAX)) + countbit(int(x >> 32) & INT_MAX);
}
inline void printbit(int x, int len) {
  for (int i = len - 1; i >= 0; i--) printf("%d", getbit(x, i));
}
int gcd(int a, int b) { return b == 0 ? a : gcd(b, a % b); }
long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); }
template <typename A, typename B>
ostream &operator<<(ostream &stream, const pair<A, B> &p) {
  stream << "{" << p.first << "," << p.second << "}";
  return stream;
}
template <typename A>
ostream &operator<<(ostream &stream, const vector<A> &v) {
  stream << "[";
  for (auto itr = v.begin(); itr != v.end(); itr++) stream << *itr << " ";
  stream << "]";
  return stream;
}
template <typename A, typename B>
ostream &operator<<(ostream &stream, const map<A, B> &v) {
  stream << "[";
  for (auto itr = v.begin(); itr != v.end(); itr++) stream << *itr << " ";
  stream << "]";
  return stream;
}
template <typename A>
ostream &operator<<(ostream &stream, const set<A> &v) {
  stream << "[";
  for (auto itr = v.begin(); itr != v.end(); itr++) stream << *itr << " ";
  stream << "]";
  return stream;
}
template <typename A>
ostream &operator<<(ostream &stream, const stack<A> &v) {
  stack<A> st = v;
  stream << "[";
  while (!st.empty()) {
    stream << st.top() << " ";
    st.pop();
  }
  stream << "]";
  return stream;
}
template <typename A>
ostream &operator<<(ostream &stream, const priority_queue<A> &v) {
  priority_queue<A> q = v;
  stream << "[";
  while (!q.empty()) {
    stream << q.top() << " ";
    q.pop();
  }
  stream << "]";
  return stream;
}
template <typename A>
ostream &operator<<(ostream &stream, const queue<A> &v) {
  queue<A> q = v;
  stream << "[";
  while (!q.empty()) {
    stream << q.front() << " ";
    q.pop();
  }
  stream << "]";
  return stream;
}
template <typename A>
ostream &operator<<(ostream &stream, const deque<A> &v) {
  deque<A> q = v;
  stream << "[";
  while (!q.empty()) {
    stream << q.front() << " ";
    q.pop_front();
  }
  stream << "]";
  return stream;
}
void run();
int main() {
  srand(time(NULL));
  run();
  return 0;
}
const int mod = 1e9 + 7;
const int N = 102;
char s[10];
void run() {
  scanf("%s", s);
  int x = s[1] - '0';
  int y = s[0] - 'a' + 1;
  int to = 9;
  int res = 0;
  0 ? (cout << "x"
            << " = " << (x) << ","
            << "y"
            << " = " << (y) << "\n")
    : cout;
  for (int i = 1; i <= to; ++i) {
    int dx = i % 3;
    dx--;
    int dy = (i / 3) % 3;
    dy--;
    if (dx == 0 && dy == 0) continue;
    0 ? (cout << "dx"
              << " = " << (dx) << ","
              << "dy"
              << " = " << (dy) << "\n")
      : cout;
    if (x + dx > 0 && x + dx < 9 && y + dy > 0 && y + dy < 9) res++;
  }
  printf("%d", res);
  putchar('\n');
}

```


### Prompt

Develop a solution in CPP to the problem described below:

The nation of Panel holds an annual show called The Number Games, where each district in the nation will be represented by one contestant.

The nation has n districts numbered from 1 to n, each district has exactly one path connecting it to every other district. The number of fans of a contestant from district i is equal to 2^i.

This year, the president decided to reduce the costs. He wants to remove k contestants from the games. However, the districts of the removed contestants will be furious and will not allow anyone to cross through their districts.

The president wants to ensure that all remaining contestants are from districts that can be reached from one another. He also wishes to maximize the total number of fans of the participating contestants.

Which contestants should the president remove?

Input

The first line of input contains two integers n and k (1 ≤ k < n ≤ 10^6) — the number of districts in Panel, and the number of contestants the president wishes to remove, respectively.

The next n-1 lines each contains two integers a and b (1 ≤ a, b ≤ n, a ≠ b), that describe a road that connects two different districts a and b in the nation. It is guaranteed that there is exactly one path between every two districts.

Output

Print k space-separated integers: the numbers of the districts of which the contestants should be removed, in increasing order of district number.

Examples

Input

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

Output

1 3 4

Input

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

Output

1 3 4 5

Note

In the first sample, the maximum possible total number of fans is 2^2 + 2^5 + 2^6 = 100. We can achieve it by removing the contestants of the districts 1, 3, and 4.

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll INF = static_cast<ll>(1e9) + 7;
const int MAXN = static_cast<int>(1e6) + 17;
int n, k;
vector<int> g[MAXN];
int pr[MAXN][21];
int H[MAXN], used[MAXN];
bool read() {
  if (!(cin >> n >> k)) return false;
  for (ll i = 0; i < (ll)(n - 1); ++i) {
    int u, v;
    cin >> u >> v;
    g[u - 1].push_back(v - 1);
    g[v - 1].push_back(u - 1);
  }
  return true;
}
void dfs(int v, int p) {
  H[v] = H[p] + 1;
  pr[v][0] = p;
  for (int j = 1; j < 21; ++j) pr[v][j] = pr[pr[v][j - 1]][j - 1];
  for (auto to : g[v])
    if (to != p) dfs(to, v);
}
void solve() {
  dfs(n - 1, n - 1);
  k = n - k - 1;
  used[n - 1] = 1;
  for (int i = n - 1; i >= 0; --i) {
    if (used[i]) continue;
    int v = i;
    for (int j = 20; j >= 0; --j)
      if (!used[pr[v][j]]) v = pr[v][j];
    v = pr[v][0];
    if (H[i] - H[v] <= k) {
      k -= H[i] - H[v];
      for (v = i; !used[v]; v = pr[v][0]) used[v] = true;
    }
  }
  for (ll i = 0; i < (ll)(n); ++i)
    if (!used[i]) cout << i + 1 << ' ';
  cout << '\n';
}
int main() {
  cin.tie(nullptr);
  std::ios_base::sync_with_stdio(false);
  std::mt19937 rand('S' + 'E' + 'R' + 'E' + 'Z' + 'H' + 'K' + 'A');
  while (read()) solve();
  return 0;
}

```


### Prompt

Please provide a CPP coded solution to the problem described below:

You are given two rectangles on a plane. The centers of both rectangles are located in the origin of coordinates (meaning the center of the rectangle's symmetry). The first rectangle's sides are parallel to the coordinate axes: the length of the side that is parallel to the Ox axis, equals w, the length of the side that is parallel to the Oy axis, equals h. The second rectangle can be obtained by rotating the first rectangle relative to the origin of coordinates by angle α.

<image>

Your task is to find the area of the region which belongs to both given rectangles. This region is shaded in the picture.

Input

The first line contains three integers w, h, α (1 ≤ w, h ≤ 106; 0 ≤ α ≤ 180). Angle α is given in degrees.

Output

In a single line print a real number — the area of the region which belongs to both given rectangles.

The answer will be considered correct if its relative or absolute error doesn't exceed 10 - 6.

Examples

Input

1 1 45

Output

0.828427125

Input

6 4 30

Output

19.668384925

Note

The second sample has been drawn on the picture above.

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
const double eps = 1e-8;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  double w, h, alpha;
  cin >> w >> h >> alpha;
  if (alpha > 90) {
    alpha = 180 - alpha;
  }
  cout << fixed;
  cout << setprecision(10);
  if (alpha < eps) {
    cout << w * h;
    exit(0);
  }
  alpha /= 180.0;
  alpha *= 3.141592653589793238462643383279;
  double f = (1 + cos(alpha)) / sin(alpha);
  double x = (h * f - w) / (f * f - 1);
  double y = h - x * f;
  if (x >= 0 && y >= 0 && y <= h + eps && x <= w + eps) {
    double ans = w * h;
    ans -= x * x / tan(alpha);
    ans -= y * y / tan(alpha);
    cout << ans;
  } else {
    if (w < h) swap(w, h);
    cout << h * h / sin(alpha);
  }
  return 0;
}

```


### Prompt

Develop a solution in Cpp to the problem described below:

Manao is trying to open a rather challenging lock. The lock has n buttons on it and to open it, you should press the buttons in a certain order to open the lock. When you push some button, it either stays pressed into the lock (that means that you've guessed correctly and pushed the button that goes next in the sequence), or all pressed buttons return to the initial position. When all buttons are pressed into the lock at once, the lock opens.

Consider an example with three buttons. Let's say that the opening sequence is: {2, 3, 1}. If you first press buttons 1 or 3, the buttons unpress immediately. If you first press button 2, it stays pressed. If you press 1 after 2, all buttons unpress. If you press 3 after 2, buttons 3 and 2 stay pressed. As soon as you've got two pressed buttons, you only need to press button 1 to open the lock.

Manao doesn't know the opening sequence. But he is really smart and he is going to act in the optimal way. Calculate the number of times he's got to push a button in order to open the lock in the worst-case scenario.

Input

A single line contains integer n (1 ≤ n ≤ 2000) — the number of buttons the lock has.

Output

In a single line print the number of times Manao has to push a button in the worst-case scenario.

Examples

Input

2

Output

3

Input

3

Output

7

Note

Consider the first test sample. Manao can fail his first push and push the wrong button. In this case he will already be able to guess the right one with his second push. And his third push will push the second right button. Thus, in the worst-case scenario he will only need 3 pushes.

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  scanf("%d", &n);
  long long tot = 0;
  for (int i = 1; i <= n; i++) {
    tot += (long long)(n - i) * i + 1ll;
  }
  printf("%I64d\n", tot);
  return 0;
}

```


### Prompt

Construct a CPP code solution to the problem outlined:

A boy Petya loves chess very much. He even came up with a chess piece of his own, a semiknight. The semiknight can move in any of these four directions: 2 squares forward and 2 squares to the right, 2 squares forward and 2 squares to the left, 2 squares backward and 2 to the right and 2 squares backward and 2 to the left. Naturally, the semiknight cannot move beyond the limits of the chessboard.

Petya put two semiknights on a standard chessboard. Petya simultaneously moves with both semiknights. The squares are rather large, so after some move the semiknights can meet, that is, they can end up in the same square. After the meeting the semiknights can move on, so it is possible that they meet again. Petya wonders if there is such sequence of moves when the semiknights meet. Petya considers some squares bad. That is, they do not suit for the meeting. The semiknights can move through these squares but their meetings in these squares don't count.

Petya prepared multiple chess boards. Help Petya find out whether the semiknights can meet on some good square for each board.

Please see the test case analysis.

Input

The first line contains number t (1 ≤ t ≤ 50) — the number of boards. Each board is described by a matrix of characters, consisting of 8 rows and 8 columns. The matrix consists of characters ".", "#", "K", representing an empty good square, a bad square and the semiknight's position, correspondingly. It is guaranteed that matrix contains exactly 2 semiknights. The semiknight's squares are considered good for the meeting. The tests are separated by empty line.

Output

For each test, print on a single line the answer to the problem: "YES", if the semiknights can meet and "NO" otherwise.

Examples

Input

2
........
........
......#.
K..##..#
.......#
...##..#
......#.
K.......

........
........
..#.....
..#..#..
..####..
...##...
........
....K#K#

Output

YES
NO

Note

Consider the first board from the sample. We will assume the rows and columns of the matrix to be numbered 1 through 8 from top to bottom and from left to right, correspondingly. The knights can meet, for example, in square (2, 7). The semiknight from square (4, 1) goes to square (2, 3) and the semiknight goes from square (8, 1) to square (6, 3). Then both semiknights go to (4, 5) but this square is bad, so they move together to square (2, 7).

On the second board the semiknights will never meet.

### Response

```cpp
#include <bits/stdc++.h>
char board[8][8];
int target[2];
int start[2];
int found;
void test() {
  if ((target[0] - start[0]) % 4) {
    found = 0;
    return;
  }
  if ((target[1] - start[1]) % 4) {
    found = 0;
    return;
  }
  for (int i = 0; i < 8; i++)
    for (int j = 0; j < 8; j++) {
      if ((i - target[0]) % 4) continue;
      if ((j - target[1]) % 4) continue;
      if (board[i][j] != '#') {
        found = 1;
        break;
      }
    }
}
int main() {
  int already;
  int q;
  scanf("%d\n", &q);
  char temp;
  while (q-- > 0) {
    already = 0;
    memset(board, 0, sizeof(board));
    for (int i = 0; i < 8; i++)
      for (int j = 0; j < 8; j++) {
        scanf("%1c", &temp);
        while (temp == '\n') {
          scanf("%1c", &temp);
        }
        board[i][j] = temp;
        if (!already && board[i][j] == 'K') {
          start[0] = i;
          start[1] = j;
          already = 1;
        }
        if (already && board[i][j] == 'K') {
          target[0] = i;
          target[1] = j;
        }
      }
    found = 0;
    test();
    if (found)
      printf("YES\n", found);
    else
      printf("NO\n", found);
  }
  return 0;
}

```


### Prompt

Your task is to create a Cpp solution to the following problem:

Today Tavas got his test result as an integer score and he wants to share it with his girlfriend, Nafas.

His phone operating system is Tavdroid, and its keyboard doesn't have any digits! He wants to share his score with Nafas via text, so he has no choice but to send this number using words.

<image>

He ate coffee mix without water again, so right now he's really messed up and can't think.

Your task is to help him by telling him what to type.

Input

The first and only line of input contains an integer s (0 ≤ s ≤ 99), Tavas's score.

Output

In the first and only line of output, print a single string consisting only from English lowercase letters and hyphens ('-'). Do not use spaces.

Examples

Input

6

Output

six

Input

99

Output

ninety-nine

Input

20

Output

twenty

Note

You can find all you need to know about English numerals in <http://en.wikipedia.org/wiki/English_numerals> .

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
int main() {
  char s[3];
  while (cin >> s) {
    int l = strlen(s);
    string a[] = {"twenty", "thirty",  "forty",  "fifty",
                  "sixty",  "seventy", "eighty", "ninety"};
    string b[] = {"zero", "one", "two",   "three", "four",
                  "five", "six", "seven", "eight", "nine"};
    if (l == 1) {
      for (int i = 0; i < 10; i++)
        if ((s[0] - 48) == i) cout << b[i] << endl;
    } else if (l == 2) {
      if (s[0] != '1') {
        for (int i = 2; i <= 9; i++) {
          if ((s[0] - 48) == i) {
            for (int j = 1; j < 10; j++) {
              if ((s[1] - 48) == j) cout << a[i - 2] << "-" << b[j] << endl;
            }
            if ((s[1] - 48) == 0) cout << a[i - 2] << endl;
          }
        }
      } else if (s[0] == '1') {
        if (s[1] == '0') cout << "ten" << endl;
        if (s[1] == '1') cout << "eleven" << endl;
        if (s[1] == '2') cout << "twelve" << endl;
        if (s[1] == '3') cout << "thirteen" << endl;
        if (s[1] == '4') cout << "fourteen" << endl;
        if (s[1] == '5') cout << "fifteen" << endl;
        if (s[1] == '6') cout << "sixteen" << endl;
        if (s[1] == '7') cout << "seventeen" << endl;
        if (s[1] == '8') cout << "eighteen" << endl;
        if (s[1] == '9') cout << "nineteen" << endl;
      }
    }
  }
  return 0;
}

```


### Prompt

Please formulate a CPP solution to the following problem:

Given is a positive integer N.
Find the number of pairs (A, B) of positive integers not greater than N that satisfy the following condition:

* When A and B are written in base ten without leading zeros, the last digit of A is equal to the first digit of B, and the first digit of A is equal to the last digit of B.

Constraints

* 1 \leq N \leq 2 \times 10^5
* All values in input are integers.

Input

Input is given from Standard Input in the following format:

N

Output

Print the answer.

Examples

Input

25

Output

17

Input

1

Output

1

Input

100

Output

108

Input

2020

Output

40812

Input

200000

Output

400000008

### Response

```cpp
#include <bits/stdc++.h>

using namespace std;

long long int sum[10][10];

int main(){
    long long int N,ans=0;
    cin >> N;
    for(int i=1;i<=N;i++){
        string S = to_string(i);
        sum[S[0]-'0'][S.back()-'0']++;
    }

    for(int i=0;i<10;i++){
        for(int j=0;j<10;j++){
            ans += sum[i][j]*sum[j][i];
        }
    }

    cout << ans << endl;
}
```


### Prompt

Create a solution in CPP for the following problem:

Of course, many of you can calculate φ(n) — the number of positive integers that are less than or equal to n, that are coprime with n. But what if we need to calculate φ(φ(...φ(n))), where function φ is taken k times and n is given in the canonical decomposition into prime factors?

You are given n and k, calculate the value of φ(φ(...φ(n))). Print the result in the canonical decomposition into prime factors.

Input

The first line contains integer m (1 ≤ m ≤ 105) — the number of distinct prime divisors in the canonical representaion of n.

Each of the next m lines contains a pair of space-separated integers pi, ai (2 ≤ pi ≤ 106; 1 ≤ ai ≤ 1017) — another prime divisor of number n and its power in the canonical representation. The sum of all ai doesn't exceed 1017. Prime divisors in the input follow in the strictly increasing order.

The last line contains integer k (1 ≤ k ≤ 1018).

Output

In the first line, print integer w — the number of distinct prime divisors of number φ(φ(...φ(n))), where function φ is taken k times.

Each of the next w lines must contain two space-separated integers qi, bi (bi ≥ 1) — another prime divisor and its power in the canonical representaion of the result. Numbers qi must go in the strictly increasing order.

Examples

Input

1
7 1
1

Output

2
2 1
3 1

Input

1
7 1
2

Output

1
2 1

Input

1
2 100000000000000000
10000000000000000

Output

1
2 90000000000000000

Note

You can read about canonical representation of a positive integer here: http://en.wikipedia.org/wiki/Fundamental_theorem_of_arithmetic.

You can read about function φ(n) here: http://en.wikipedia.org/wiki/Euler's_totient_function.

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
const int maxn = 1000006;
const int T = 1000000;
int n, m, x, cnt, num;
int p[maxn], com[maxn], id[maxn];
long long t;
long long a[maxn], k[maxn], sos[maxn];
bool flag;
void ols(int n) {
  for (register int i = 2; i <= n; ++i) {
    if (!com[i]) p[++cnt] = com[i] = i, id[i] = cnt;
    for (register int j = 1; j <= cnt && i * p[j] <= n; ++j) {
      com[i * p[j]] = p[j];
      if (i % p[j] == 0) break;
    }
  }
}
int main() {
  ols(T);
  scanf("%d", &m);
  while (m--) scanf("%d", &x), scanf("%I64d", &a[id[x]]);
  scanf("%I64d", &t);
  for (register int i = 1; i <= cnt; ++i) k[i] = t;
  flag = true;
  while (flag) {
    flag = false;
    for (register int i = 1; i <= cnt; ++i)
      if (a[i]) {
        if (!k[i]) continue;
        t = min(a[i], k[i]);
        a[i] -= t, k[i] -= t;
        sos[i] += t - 1, flag = true;
        int tmp = p[i] - 1;
        while (tmp != 1) {
          int cur = id[com[tmp]];
          a[cur] += t;
          tmp /= com[tmp];
        }
      } else if (sos[i])
        --sos[i];
      else if (k[i])
        --k[i];
  }
  for (register int i = 1; i <= cnt; ++i) num += (bool)a[i];
  printf("%d\n", num);
  for (register int i = 1; i <= cnt; ++i)
    if (a[i]) printf("%d %I64d\n", p[i], a[i]);
  return 0;
}

```


### Prompt

Please provide a CPP coded solution to the problem described below:

zscoder loves simple strings! A string t is called simple if every pair of adjacent characters are distinct. For example ab, aba, zscoder are simple whereas aa, add are not simple.

zscoder is given a string s. He wants to change a minimum number of characters so that the string s becomes simple. Help him with this task!

Input

The only line contains the string s (1 ≤ |s| ≤ 2·105) — the string given to zscoder. The string s consists of only lowercase English letters.

Output

Print the simple string s' — the string s after the minimal number of changes. If there are multiple solutions, you may output any of them.

Note that the string s' should also consist of only lowercase English letters.

Examples

Input

aab

Output

bab

Input

caaab

Output

cabab

Input

zscoder

Output

zscoder

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  s = s + '.';
  for (int i = 0; i < s.size() - 1; i++)
    if (s[i] == s[i + 1]) {
      if (s[i] != 'a' && s[i + 2] != 'a')
        s[i + 1] = 'a';
      else if (s[i] != 'b' && s[i + 2] != 'b')
        s[i + 1] = 'b';
      else if (s[i] != 'c' && s[i + 2] != 'c')
        s[i + 1] = 'c';
    }
  s.resize(s.size() - 1);
  cout << s << endl;
  return 0;
}

```


### Prompt

Construct a cpp code solution to the problem outlined:

Vera adores poems. All the poems Vera knows are divided into quatrains (groups of four lines) and in each quatrain some lines contain rhymes.

Let's consider that all lines in the poems consist of lowercase Latin letters (without spaces). Letters "a", "e", "i", "o", "u" are considered vowels.

Two lines rhyme if their suffixes that start from the k-th vowels (counting from the end) match. If a line has less than k vowels, then such line can't rhyme with any other line. For example, if k = 1, lines commit and hermit rhyme (the corresponding suffixes equal it), and if k = 2, they do not rhyme (ommit ≠ ermit).

Today on a literature lesson Vera learned that quatrains can contain four different schemes of rhymes, namely the following ones (the same letters stand for rhyming lines):

  * Clerihew (aabb);
  * Alternating (abab);
  * Enclosed (abba).

If all lines of a quatrain pairwise rhyme, then the quatrain can belong to any rhyme scheme (this situation is represented by aaaa).

If all quatrains of a poem belong to the same rhyme scheme, then we can assume that the whole poem belongs to this rhyme scheme. If in each quatrain all lines pairwise rhyme, then the rhyme scheme of the poem is aaaa. Let us note that it doesn't matter whether lines from different quatrains rhyme with each other or not. In other words, it is possible that different quatrains aren't connected by a rhyme.

Vera got a long poem as a home task. The girl has to analyse it and find the poem rhyme scheme. Help Vera cope with the task.

Input

The first line contains two integers n and k (1 ≤ n ≤ 2500, 1 ≤ k ≤ 5) — the number of quatrains in the poem and the vowel's number, correspondingly. Next 4n lines contain the poem. Each line is not empty and only consists of small Latin letters. The total length of the lines does not exceed 104.

If we assume that the lines are numbered starting from 1, then the first quatrain contains lines number 1, 2, 3, 4; the second one contains lines number 5, 6, 7, 8; and so on.

Output

Print the rhyme scheme of the poem as "aabb", "abab", "abba", "aaaa"; or "NO" if the poem does not belong to any of the above mentioned schemes.

Examples

Input

1 1
day
may
sun
fun

Output

aabb

Input

1 1
day
may
gray
way

Output

aaaa

Input

2 1
a
a
a
a
a
a
e
e

Output

aabb

Input

2 1
day
may
sun
fun
test
hill
fest
thrill

Output

NO

Note

In the last sample both quatrains have rhymes but finding the common scheme is impossible, so the answer is "NO".

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
bool vwl(char c) {
  return (c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u');
}
string cnst(string a, string b, string c, string d) {
  if (a == b && b == c && c == d) return "aaaa";
  if (a == b && c == d && b != c) return "aabb";
  if (b == c && a == d && b != a) return "abba";
  if (a == c && b == d && a != b) return "abab";
  return "NO";
}
void solve() {
  int n, k;
  cin >> n >> k;
  vector<string> v(4 * n);
  for (auto &x : v) cin >> x;
  string p1, p2, p3, p4;
  p1 = p2 = p3 = p4 = "b";
  int ln = v[0].size(), now = 0;
  for (int i = ln - 1; i >= 0; i--) {
    if (vwl(v[0][i])) now++;
    if (now == k) {
      p1 = v[0].substr(i);
      break;
    }
  }
  if (p1 == "b") {
    cout << "NO\n";
    return;
  }
  ln = v[1].size(), now = 0;
  for (int i = ln - 1; i >= 0; i--) {
    if (vwl(v[1][i])) now++;
    if (now == k) {
      p2 = v[1].substr(i);
      break;
    }
  }
  if (p2 == "b") {
    cout << "NO\n";
    return;
  }
  ln = v[2].size(), now = 0;
  for (int i = ln - 1; i >= 0; i--) {
    if (vwl(v[2][i])) now++;
    if (now == k) {
      p3 = v[2].substr(i);
      break;
    }
  }
  if (p3 == "b") {
    cout << "NO\n";
    return;
  }
  ln = v[3].size(), now = 0;
  for (int i = ln - 1; i >= 0; i--) {
    if (vwl(v[3][i])) now++;
    if (now == k) {
      p4 = v[3].substr(i);
      break;
    }
  }
  if (p4 == "b") {
    cout << "NO\n";
    return;
  }
  string res = cnst(p1, p2, p3, p4);
  if (res == "NO") {
    cout << res + '\n';
    return;
  }
  for (int i = 4; i < 4 * n; i += 4) {
    string s1, s2, s3, s4;
    s1 = s2 = s3 = s4 = "b";
    now = 0, ln = v[i].size();
    for (int j = ln - 1; j >= 0; j--) {
      if (vwl(v[i][j])) now++;
      if (now == k) {
        s1 = v[i].substr(j);
        break;
      }
    }
    if (s1 == "b") {
      cout << "NO\n";
      return;
    }
    now = 0, ln = v[i + 1].size();
    for (int j = ln - 1; j >= 0; j--) {
      if (vwl(v[i + 1][j])) now++;
      if (now == k) {
        s2 = v[i + 1].substr(j);
        break;
      }
    }
    if (s2 == "b") {
      cout << "NO\n";
      return;
    }
    now = 0, ln = v[i + 2].size();
    for (int j = ln - 1; j >= 0; j--) {
      if (vwl(v[i + 2][j])) now++;
      if (now == k) {
        s3 = v[i + 2].substr(j);
        break;
      }
    }
    if (s3 == "b") {
      cout << "NO\n";
      return;
    }
    now = 0, ln = v[i + 3].size();
    for (int j = ln - 1; j >= 0; j--) {
      if (vwl(v[i + 3][j])) now++;
      if (now == k) {
        s4 = v[i + 3].substr(j);
        break;
      }
    }
    if (s4 == "b") {
      cout << "NO\n";
      return;
    }
    string cres = cnst(s1, s2, s3, s4);
    if (res == "aaaa" && cres != "aaaa") {
      res = cres;
      continue;
    }
    if (cres == "aaaa") continue;
    if (cres == "NO" || cres != res) {
      cout << "NO\n";
      return;
    }
  }
  cout << res + '\n';
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  long long t = 1;
  while (t--) solve();
  return 0;
}

```


### Prompt

Please provide a CPP coded solution to the problem described below:

Little Vasya likes very much to play with sets consisting of positive integers. To make the game more interesting, Vasya chose n non-empty sets in such a way, that no two of them have common elements.

One day he wanted to show his friends just how interesting playing with numbers is. For that he wrote out all possible unions of two different sets on n·(n - 1) / 2 pieces of paper. Then he shuffled the pieces of paper. He had written out the numbers in the unions in an arbitrary order.

For example, if n = 4, and the actual sets have the following form {1, 3}, {5}, {2, 4}, {7}, then the number of set pairs equals to six. The six pieces of paper can contain the following numbers:

  * 2, 7, 4.
  * 1, 7, 3;
  * 5, 4, 2;
  * 1, 3, 5;
  * 3, 1, 2, 4;
  * 5, 7.

Then Vasya showed the pieces of paper to his friends, but kept the n sets secret from them. His friends managed to calculate which sets Vasya had thought of in the first place. And how about you, can you restore the sets by the given pieces of paper?

Input

The first input file line contains a number n (2 ≤ n ≤ 200), n is the number of sets at Vasya's disposal. Then follow sets of numbers from the pieces of paper written on n·(n - 1) / 2 lines. Each set starts with the number ki (2 ≤ ki ≤ 200), which is the number of numbers written of the i-th piece of paper, and then follow ki numbers aij (1 ≤ aij ≤ 200). All the numbers on the lines are separated by exactly one space. It is guaranteed that the input data is constructed according to the above given rules from n non-intersecting sets.

Output

Print on n lines Vasya's sets' description. The first number on the line shows how many numbers the current set has. Then the set should be recorded by listing its elements. Separate the numbers by spaces. Each number and each set should be printed exactly once. Print the sets and the numbers in the sets in any order. If there are several answers to that problem, print any of them.

It is guaranteed that there is a solution.

Examples

Input

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

Output

1 7
2 2 4
2 1 3
1 5

Input

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

Output

3 7 8 9
2 6 100
1 1
1 2

Input

3
2 1 2
2 1 3
2 2 3

Output

1 1
1 2
1 3

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
int parent[205];
void init() {
  for (long long i = 0; i < ((long long)205); i++) parent[i] = i;
}
int find(int a) {
  if (parent[a] == a) return a;
  return parent[a] = find(parent[a]);
}
void uni(int a, int b) {
  parent[find(a)] = find(b);
  return;
}
bool exist[205];
int cnt[205][205];
int n, m, a[205];
int main() {
  for (long long i = 0; i < ((long long)205); i++) exist[i] = false;
  for (long long i = 0; i < ((long long)205); i++)
    for (long long j = 0; j < ((long long)205); j++) cnt[i][j] = 0;
  init();
  scanf("%d", &n);
  for (long long i = 0; i < ((long long)n * (n - 1) / 2); i++) {
    scanf("%d", &m);
    for (long long j = 0; j < ((long long)m); j++) scanf("%d", &a[j]);
    for (long long j = 0; j < ((long long)m); j++) exist[a[j]] = true;
    for (long long j = 0; j < ((long long)m); j++)
      for (long long k = 0; k < ((long long)m); k++) cnt[a[j]][a[k]]++;
  }
  for (long long i = 0; i < ((long long)205); i++)
    for (long long j = 0; j < ((long long)i); j++)
      if (cnt[i][j] == n - 1) uni(i, j);
  vector<int> res[205];
  for (long long i = 0; i < ((long long)205); i++)
    if (exist[i]) res[find(i)].push_back(i);
  if (n != 2) {
    for (long long i = 0; i < ((long long)205); i++)
      if (((long long)res[i].size())) {
        cout << ((long long)res[i].size()) << " ";
        for (long long j = 0; j < ((long long)((long long)res[i].size())); j++)
          cout << res[i][j] << " ";
        cout << endl;
      }
  } else {
    cout << "1 " << a[0] << endl;
    cout << m - 1 << " ";
    for (long long i = 0; i < ((long long)m - 1); i++) cout << a[i + 1] << " ";
    cout << endl;
  }
}

```


### Prompt

In Cpp, your task is to solve the following problem:

The Fire Lord attacked the Frost Kingdom. He has already got to the Ice Fortress, where the Snow Queen dwells. He arranged his army on a segment n in length not far from the city walls. And only the frost magician Solomon can save the Frost Kingdom.

<image>

The n-long segment is located at a distance equal exactly to 1 from the castle walls. It can be imaginarily divided into unit segments. On some of the unit segments fire demons are located — no more than one demon per position. Each demon is characterised by his strength - by some positive integer. We can regard the fire demons being idle.

Initially Solomon is positioned on the fortress wall. He can perform the following actions several times in a row:

  * "L" — Solomon shifts one unit to the left. This movement cannot be performed on the castle wall.
  * "R" — Solomon shifts one unit to the left. This movement cannot be performed if there's no ice block to the right.
  * "A" — If there's nothing to the right of Solomon, then Solomon creates an ice block that immediately freezes to the block that Solomon is currently standing on. If there already is an ice block, then Solomon destroys it. At that the ice blocks to the right of the destroyed one can remain but they are left unsupported. Those ice blocks fall down.

Solomon spends exactly a second on each of these actions.

As the result of Solomon's actions, ice blocks' segments fall down. When an ice block falls on a fire demon, the block evaporates and the demon's strength is reduced by 1. When the demons' strength is equal to 0, the fire demon vanishes. The picture below shows how it happens. The ice block that falls on the position with no demon, breaks into lots of tiny pieces and vanishes without hurting anybody.

<image>

Help Solomon destroy all the Fire Lord's army in minimum time.

Input

The first line contains an integer n (1 ≤ n ≤ 1000). The next line contains n numbers, the i-th of them represents the strength of the fire demon standing of the i-th position, an integer from 1 to 100. If there's no demon on the i-th position, then the i-th number equals to 0. It is guaranteed that the input data have at least one fire demon.

Output

Print a string of minimum length, containing characters "L", "R" and "A" — the succession of actions leading to the required result.

If there are several possible answers, print any of them.

Examples

Input

3
1 0 1

Output

ARARARALLLA

Input

3
0 2 0

Output

ARARALAARALA

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
const double eps = 1e-9;
int v[1024];
int vv[1024];
int N;
int try_it(int last) {
  for (int i = (0); i < (N); i++) vv[i] = v[i];
  for (int i = (last); i < (N); i++) vv[i] = max(0, vv[i] - 1);
  vv[N] = 0;
  int NN = N;
  while (NN > 0 && vv[NN - 1] == 0) --NN;
  int moves = 0, p = -1;
  while (vv[NN - 1] > 0) {
    moves += 3;
    ++p;
    while (vv[p + 1] >= vv[p]) {
      moves += 2;
      ++p;
    }
    ++moves;
    --vv[p];
    --p;
    while (p >= 0 && vv[p] == vv[p + 1] + 1) {
      --vv[p];
      --p;
      moves++;
    }
    moves++;
  }
  return moves + N * 3 - 2 * p - last;
}
void do_it(int last) {
  for (int i = (0); i < (N); i++) vv[i] = v[i];
  for (int i = (last); i < (N); i++) vv[i] = max(0, vv[i] - 1);
  vv[N] = 0;
  int NN = N;
  while (NN > 0 && vv[NN - 1] == 0) --NN;
  int p = -1;
  while (vv[NN - 1] > 0) {
    cout << "ARA";
    ++p;
    while (vv[p + 1] >= vv[p]) {
      cout << "RA";
      ++p;
    }
    cout << "L";
    --vv[p];
    --p;
    while (p >= 0 && vv[p] == vv[p + 1] + 1) {
      --vv[p];
      --p;
      cout << "L";
    }
    cout << "A";
  }
  while (p++ < N - 1) cout << "AR";
  cout << "A";
  while (p-- > last) cout << "L";
  cout << "A\n";
}
int main() {
  ios::sync_with_stdio(false);
  cin >> N;
  for (int i = (0); i < (N); i++) cin >> v[i];
  v[N] = 0;
  while (N > 0 && v[N - 1] == 0) --N;
  int best = try_it(0);
  int last = 0;
  for (int i = (1); i < (N); i++) {
    int c = try_it(i);
    if (c < best) {
      best = c;
      last = i;
    }
  }
  do_it(last);
  return 0;
  int p = -1;
  int K = 0;
  while (v[N - 1] > 0 && K++ < 10) {
    cout << "ARA";
    ++p;
    while (v[p + 1] >= v[p]) {
      cout << "RA";
      ++p;
    }
    cout << "L";
    --v[p];
    --p;
    while (p >= 0 && v[p] == v[p + 1] + 1) {
      --v[p];
      --p;
      cout << "L";
    }
    cout << "A";
    cout << endl;
    cout << p << endl;
    for (int i = (0); i < (N); i++) cout << v[i] << " ";
    cout << endl;
  }
  return 0;
}

```


### Prompt

Your task is to create a CPP solution to the following problem:

The map of the capital of Berland can be viewed on the infinite coordinate plane. Each point with integer coordinates contains a building, and there are streets connecting every building to four neighbouring buildings. All streets are parallel to the coordinate axes.

The main school of the capital is located in (s_x, s_y). There are n students attending this school, the i-th of them lives in the house located in (x_i, y_i). It is possible that some students live in the same house, but no student lives in (s_x, s_y).

After classes end, each student walks from the school to his house along one of the shortest paths. So the distance the i-th student goes from the school to his house is |s_x - x_i| + |s_y - y_i|.

The Provision Department of Berland has decided to open a shawarma tent somewhere in the capital (at some point with integer coordinates). It is considered that the i-th student will buy a shawarma if at least one of the shortest paths from the school to the i-th student's house goes through the point where the shawarma tent is located. It is forbidden to place the shawarma tent at the point where the school is located, but the coordinates of the shawarma tent may coincide with the coordinates of the house of some student (or even multiple students).

You want to find the maximum possible number of students buying shawarma and the optimal location for the tent itself.

Input

The first line contains three integers n, s_x, s_y (1 ≤ n ≤ 200 000, 0 ≤ s_x, s_y ≤ 10^{9}) — the number of students and the coordinates of the school, respectively.

Then n lines follow. The i-th of them contains two integers x_i, y_i (0 ≤ x_i, y_i ≤ 10^{9}) — the location of the house where the i-th student lives. Some locations of houses may coincide, but no student lives in the same location where the school is situated.

Output

The output should consist of two lines. The first of them should contain one integer c — the maximum number of students that will buy shawarmas at the tent.

The second line should contain two integers p_x and p_y — the coordinates where the tent should be located. If there are multiple answers, print any of them. Note that each of p_x and p_y should be not less than 0 and not greater than 10^{9}.

Examples

Input

4 3 2
1 3
4 2
5 1
4 1

Output

3
4 2

Input

3 100 100
0 0
0 0
100 200

Output

2
99 100

Input

7 10 12
5 6
20 23
15 4
16 5
4 54
12 1
4 15

Output

4
10 11

Note

In the first example, If we build the shawarma tent in (4, 2), then the students living in (4, 2), (4, 1) and (5, 1) will visit it.

In the second example, it is possible to build the shawarma tent in (1, 1), then both students living in (0, 0) will visit it.

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, sx, sy, x, y, countsx_ = 0, countsy_ = 0, countsx = 0,
                             countsy = 0;
  cin >> n >> sx >> sy;
  for (int i = 0; i < n; i++) {
    cin >> x >> y;
    if ((min(x, sx) <= sx - 1 && sx - 1 <= max(x, sx)) &&
        (min(y, sy) <= sy && sy <= max(y, sy)))
      countsx_++;
    if ((min(x, sx) <= sx && sx <= max(x, sx)) &&
        (min(y, sy) <= sy - 1 && sy - 1 <= max(y, sy)))
      countsy_++;
    if ((min(x, sx) <= sx + 1 && sx + 1 <= max(x, sx)) &&
        (min(y, sy) <= sy && sy <= max(y, sy)))
      countsx++;
    if ((min(x, sx) <= sx && sx <= max(x, sx)) &&
        (min(y, sy) <= sy + 1 && sy + 1 <= max(y, sy)))
      countsy++;
  }
  long long m = max(countsx, max(countsx_, max(countsy, countsy_)));
  if (countsx == m)
    cout << countsx << '\n' << sx + 1 << ' ' << sy;
  else if (countsx_ == m)
    cout << countsx_ << '\n' << sx - 1 << ' ' << sy;
  else if (countsy == m)
    cout << countsy << '\n' << sx << ' ' << sy + 1;
  else if (countsy_ == m)
    cout << countsy_ << '\n' << sx << ' ' << sy - 1;
  return 0;
}

```


### Prompt

Please formulate a CPP solution to the following problem:

problem

Play by arranging white and black stones on the table. First, place the stones on the left edge of the table. Then place the stones in the second place from the left. Repeat this n times to arrange n stones in a horizontal row. However, when placing a new i-th go stone, replace the go stone on the table according to the following rules.

* If i is odd: Do not replace the stones that were on the table, but place the new stones i-th from the left.
* If i is even: If the color of the new go stone placed i-th from the left and the color of the rightmost go stone on the table are the same, the go stone on the table is not replaced and the new go stone is placed i-th from the left. If this is not the case, that is, if the color of the new i-th go stone from the left is different from the color of the right-most go stone on the table, first remove all the consecutive right-end go stones of the same color on the table, and then use the i-th go stone. Replace with a go stone of the same color, and place the i-th go stone on the right edge of the table.

For example, when the first 7 go stones are placed,

○○ ●● ○○○

(○ represents white go stones, ● represents black go stones.)

* If the 8th go stone is white (○), it is the same color as the rightmost go stone, so leave it as it is. Therefore, the go stone on the table is

○○ ●● ○○○○

Will be.
* If the 8th go stone is black (●), the color is different from the rightmost go stone (○), so first remove the 3 consecutive white go stones (○) on the right end of the table, and then remove the black go stone (●). And put the eighth go stone on the far right. Therefore, the go stone on the table

○○ ●●●●●●

Will be.

Given the order of the stones to be placed as input, create a program to find the number of white stones placed on the table after arranging n stones.

input

The input consists of multiple datasets. Each dataset is given in the following format.

A positive integer n (1 ≤ n ≤ 100000) is written on the first line. In the second and subsequent lines i + 1 (1 ≤ i ≤ n), the color of the go stone placed in the i-th position is written. The integer ci is written, and if ci is 0, it means that the color of the i-th go stone is white, and if it is 1, it means that the color of the i-th go stone is black.

Of the scoring data, 50% of the points are given by satisfying n ≤ 10000.

When n is 0, it indicates the end of input. The number of datasets does not exceed 10.

output

For each dataset, output the number of white stones placed on the table after arranging n stones in one line.

Examples

Input

8
1
0
1
1
0
0
0
0
8
1
0
1
1
0
0
0
1
0

Output

6
2

Input

None

Output

None

### Response

```cpp
#include<iostream>
using namespace std;

int main(){
while(1){
	int n,c,a[100000+2],b[100000+2],k=0,ans=0;
	scanf("%d",&n);
	if(n==0)break;
	scanf("%d",&a[0]);
	b[0]=1;
	for(int i=2;i<=n;i++){
		scanf("%d",&c);
		if(i%2!=0){
			if(c==a[k])b[k]++;
			else {a[k+1]=c; b[k+1]=1; k++;}
		}
		else {
			if(c==a[k])b[k]++;
			else {
				if(k==0){a[0]=c; b[0]+=1;}
				else {b[k-1]+=b[k]+1; k--;}
			}
		}
	}
	for(int i=0;i<=k;i++){
		if(a[i]==0)ans+=b[i];
	}
	printf("%d\n",ans);
}
}
```


### Prompt

Please provide a cpp coded solution to the problem described below:

The tablet interface technology, which can be operated by touching the screen with a finger, has also been applied in the field of games, and various types of games with new operability have been created. The game currently being developed by AZ is one of them.

The requirements for this software (game) are as follows.

* The screen has a 2D grid of X columns x Y rows.
* The cells of the grid are painted in one of three colors: red (R), green (G), and brown (B).
* There are buttons R, G, B to change the color of the cell, and when this button is pressed, the upper left (0,0) cell will be changed to that color.
* When the color of the top left cell is changed, all adjacent cells painted in the same color as the original color of that cell will change to the specified color. That is, all cells that are connected by cells with the same original color will be changed to the specified color.

It is a game that fills the grid in this way and finally makes the entire grid one color. A high score will be given if you solve it with a few steps.

As a programmer at AZ, you have decided to develop a part of the logic of this game. First of all, in order to calculate this maximum score, I decided to make a program to find out how many times the selection button should be operated to make the grid one color if the game is solved in the shortest time.

<image>

input

Given multiple datasets. The end of the input is indicated by two zeros. Each dataset is given in the following format:

X Y
c1,1 c2,1 ... cX,1
c1,2 c2,2 ... cX,2
::
c1, Y c2, Y ... cX, Y

The first row gives the grid columns and row sizes X, Y (2 ≤ X, Y ≤ 10). The following Y-row is given the letters ci, j, which represent the color of the cells in the i-th and j-th rows, separated by blanks.

output

Outputs the minimum number of button operations on one line for each dataset.

Example

Input

3 3
R G B
G G G
G B B
2 4
R G
G G
R B
B R
4 3
G G B R
G R R G
B G G R
0 0

Output

2
4
4

### Response

```cpp
#include<cstdio>
#include<cstdlib>
#include<ctime>
#include<cmath>
#include<cstring>
#include<cctype>
#include<complex>
#include<iostream>
#include<sstream>
#include<algorithm>
#include<functional>
#include<vector>
#include<string>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<bitset>
using namespace std;
const int dx[] = {1,0,-1,0};
const int dy[] = {0,1,0,-1};
#define INF 1e+8
#define EPS 1e-10
#define PB push_back
#define fi first
#define se second
#define ll long long
#define reps(i,j,k) for(int i = (j); i < (k); i++)
#define rep(i,j) reps(i,0,j)
typedef pair<int,int> Pii;
typedef vector<int> vi;
class Data{
	public:
	char field[10][10];
	int cnt;
	Data(){}
	Data(char _field[10][10],int _cnt){
		cnt = _cnt;
		rep(i,10){
			rep(j,10){
				field[i][j] = _field[i][j];
			}
		}
	}
};
bool check(char stage[10][10],int w,int h){
	int top = stage[0][0];
	rep(i,h){
		rep(j,w){
			if(top != stage[i][j])return false;
		}
	}
	return true;
}
void copy(char sub[2][10][10],char stage[10][10],int w,int h){
	rep(i,h){
		rep(j,w){
			sub[0][i][j] = stage[i][j];
			sub[1][i][j] = stage[i][j];
		}
	}
	return ;
}
void dfs(int y,int x,bool memo[10][10],int w,int h,char stage[2][10][10],int col){
	rep(i,4){
		int nx = x + dx[i];
		int ny = y + dy[i];
		if(nx < 0 || nx > w-1 || ny < 0 || ny > h-1 || memo[ny][nx]==1 )continue;
		if(col == stage[0][ny][nx] || col == stage[1][ny][nx]){
			stage[0][ny][nx] = (col+1)%3;
			stage[1][ny][nx] = (col+2)%3;
			memo[ny][nx] = 1;
			dfs(ny,nx,memo,w,h,stage,col);
		}
	}
	return ;
}
int bfs(char stage[10][10],int w,int h){
	int ans = -1;
	queue < Data > Q;
	Q.push(Data(stage,0));
	while( !Q.empty() ){
		Data d = Q.front();Q.pop();
		if(check(d.field,w,h)){
			ans = d.cnt;
			break;
		}
		bool memo[10][10]={{0}};
		char sub[2][10][10]={{0}};
		copy(sub,d.field,w,h);
		memo[0][0] = 1;
		sub[0][0][0] = (d.field[0][0]+1)%3;
		sub[1][0][0] = (d.field[0][0]+2)%3;
		dfs(0,0,memo,w,h,sub,d.field[0][0]);
		Q.push(Data(sub[0],d.cnt+1));
		Q.push(Data(sub[1],d.cnt+1));
	}
	return ans;
}
int main(){
	int w,h;
	while(scanf("%d%d",&w,&h),w){
		char stage[10][10];
		rep(i,h){
			rep(j,w){
				char tmp;
				scanf(" %c",&tmp);
				stage[i][j] = ((tmp == 'R')? 0 : (tmp == 'G') ? 1 : 2);
			}
		}
		int ans = bfs(stage,w,h);
		printf("%d\n",ans);
	}
	return 0;
}
```


### Prompt

Your task is to create a cpp solution to the following problem:

Making Lunch Boxes

Taro has been hooked on making lunch boxes recently. Taro has obtained a new lunch box recipe book today, and wants to try as many of the recipes listed in the book as possible.

Enough of the ingredients for all the recipes are at hand, but they all are in vacuum packs of two. If only one of them is used leaving the other, the leftover will be rotten easily, but making two of the same recipe is not interesting. Thus he decided to make a set of lunch boxes, each with different recipe, that wouldn't leave any unused ingredients.

Note that the book may include recipes for different lunch boxes made of the same set of ingredients.

How many lunch box recipes can Taro try today at most following his dogma?

Input

The input consists of at most 50 datasets, each in the following format.

n m
b1,1...b1,m
...
bn,1...bn,m

The first line contains n, which is the number of recipes listed in the book, and m, which is the number of ingredients. Both n and m are positive integers and satisfy 1 ≤ n ≤ 500, 1 ≤ m ≤ 500 and 1 ≤ n × m ≤ 500. The following n lines contain the information for each recipe with the string of length m consisting of 0 or 1. bi,j implies whether the i-th recipe needs the j-th ingredient. 1 means the ingredient is needed for the recipe and 0 means not. Each line contains at least one 1.

The end of the input is indicated by a line containing two zeros.

Output

For each dataset, output the maximum number of recipes Taro can try.

Sample Input

4 3
110
101
011
110
7 1
1
1
1
1
1
1
1
4 5
10000
01000
00100
00010
6 6
111111
011000
100000
000010
100001
100100
0 0

Output for the Sample Input

3
6
0
6

Example

Input

4 3
110
101
011
110
7 1
1
1
1
1
1
1
1
4 5
10000
01000
00100
00010
6 6
111111
011000
100000
000010
100001
100100
0 0

Output

3
6
0
6

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define REP(i, n) for (long long i = 0, max_i = (n); i < max_i; i++)
#define REPI(i, a, b) for (long long i = (a), max_i = (b); i < max_i; i++)
#define ALL(obj) begin(obj), end(obj)
#define RALL(obj) rbegin(obj), rend(obj)
#define fi first
#define se second
using ii = pair<int, int>;
vector<ii> dirs = {
  {1, 0}, {0, 1}, {-1, 0}, {0, -1},  // 4方向
  {1, 1}, {-1, 1}, {-1, -1}, {1, -1},  // 斜め
  {0, 0},  // 自身
};
template <class T> inline bool chmax(T& a, const T& b) { if (a < b) { a = b; return true; } return false; }
template <class T> inline bool chmin(T& a, const T& b) { if (a > b) { a = b; return true; } return false; }

// debug
template <class T> ostream& operator<<(ostream& s, vector<T>& d) { REP (i, d.size()) s << d[i] << (i == d.size() - 1 ? "" : " "); return s; }
template <class T> ostream& operator<<(ostream& s, vector<vector<T>>& d) { REP (i, d.size()) s << d[i] << (i == d.size() - 1 ? "" : "\n"); return s; }
template <class T, class S> ostream& operator<<(ostream& s, pair<T, S>& p) { s << "{" << p.first << ", " << p.second << "}"; return s; }
template <class T, class S> ostream& operator<<(ostream& s, map<T, S> m) { for (auto it = m.begin(); it != m.end(); it++) { s << *it << (next(it) == m.end() ? "" : "\n"); } return s; }
#ifdef _MY_DEBUG
  #define dump(...) cerr << "/* " << #__VA_ARGS__ << " :[" << __LINE__ << ":" << __FUNCTION__ << "]" << endl, dump_func(__VA_ARGS__), cerr << "*/\n\n";
#else
  #define dump(...)
  #define endl "\n"
#endif
void dump_func() { cerr << endl; }
template <class Head, class... Tail> void dump_func(Head&& h, Tail&&... t) { cerr << h << (sizeof...(Tail) == 0 ? "" : ", "), dump_func(forward<Tail>(t)...); }

struct Fast { Fast() { cin.tie(0); ios::sync_with_stdio(false); } } fast;
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
constexpr int MOD = 1000000007;
// *************** TEMPLATE END ***************

using S = bitset<500>;
const S ZERO;

void solve() {
  int n, m; cin >> n >> m;
  if (n == 0) exit(0);

  vector<unordered_map<S, int>> dp(2);
  dp[0][ZERO] = 0;
  REP (i, n) {
    string s; cin >> s;
    S b(s);
    for (auto& p: dp[0]) {
      chmax(dp[1][p.fi], p.se);
      chmax(dp[1][p.fi ^ b], p.se + 1);
    }
    swap(dp[0], dp[1]);
  }
  cout << dp[0][ZERO] << endl;
}

signed main() {
  while (1) solve();
}

```


### Prompt

Your challenge is to write a cpp solution to the following problem:

You have r red, g green and b blue balloons. To decorate a single table for the banquet you need exactly three balloons. Three balloons attached to some table shouldn't have the same color. What maximum number t of tables can be decorated if we know number of balloons of each color?

Your task is to write a program that for given values r, g and b will find the maximum number t of tables, that can be decorated in the required manner.

Input

The single line contains three integers r, g and b (0 ≤ r, g, b ≤ 2·109) — the number of red, green and blue baloons respectively. The numbers are separated by exactly one space.

Output

Print a single integer t — the maximum number of tables that can be decorated in the required manner.

Examples

Input

5 4 3

Output

4

Input

1 1 1

Output

1

Input

2 3 3

Output

2

Note

In the first sample you can decorate the tables with the following balloon sets: "rgg", "gbb", "brr", "rrg", where "r", "g" and "b" represent the red, green and blue balls, respectively.

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
const int N = 4e5 + 100;
long long int inf = 1e17 + 100;
int main() {
  ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  long long int r, b, g;
  cin >> r >> b >> g;
  long long int sum = r + b + g, mx = max({r, b, g});
  cout << min(sum / 3, sum - mx) << endl;
  return 0;
}

```


### Prompt

Please create a solution in cpp to the following problem:

Tavas is a cheerleader in the new sports competition named "Pashmaks".

<image>

This competition consists of two part: swimming and then running. People will immediately start running R meters after they finished swimming exactly S meters. A winner is a such person that nobody else finishes running before him/her (there may be more than one winner).

Before the match starts, Tavas knows that there are n competitors registered for the match. Also, he knows that i-th person's swimming speed is si meters per second and his/her running speed is ri meters per second. Unfortunately, he doesn't know the values of R and S, but he knows that they are real numbers greater than 0.

As a cheerleader, Tavas wants to know who to cheer up. So, he wants to know all people that might win. We consider a competitor might win if and only if there are some values of R and S such that with these values, (s)he will be a winner.

Tavas isn't really familiar with programming, so he asked you to help him.

Input

The first line of input contains a single integer n (1 ≤ n ≤ 2 × 105).

The next n lines contain the details of competitors. i-th line contains two integers si and ri (1 ≤ si, ri ≤ 104).

Output

In the first and the only line of output, print a sequence of numbers of possible winners in increasing order.

Examples

Input

3
1 3
2 2
3 1

Output

1 2 3

Input

3
1 2
1 1
2 1

Output

1 3

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
const int INF = 1000000003;
int m;
int n;
int x[200001];
int y[200002];
int p[200002];
int l;
int s[200002];
vector<int> v[200002];
bool cmp(int i, int j) { return x[i] > x[j] || (x[i] == x[j] && y[i] > y[j]); }
bool cross(int a, int b, int c) {
  return (long long)(x[a] - x[c]) * (y[a] - y[b]) * x[b] * y[c] >
         (long long)(y[a] - y[c]) * (x[a] - x[b]) * x[c] * y[b];
}
int main(int argc, char *argv[]) {
  cin >> n;
  for (int i = 0; i < n; ++i) scanf("%d %d", x + i, y + i);
  for (int i = 0; i < n; ++i) p[i] = i;
  sort(p, p + n, cmp);
  m = 1;
  s[0] = p[0];
  for (int i = 1; i < n; ++i) {
    int j = p[i];
    if (x[s[m - 1]] == x[j] && y[s[m - 1]] == y[j]) {
      v[s[m - 1]].push_back(j);
      continue;
    }
    if (y[j] <= y[s[m - 1]]) continue;
    while (m > 1 && cross(s[m - 2], s[m - 1], j)) --m;
    s[m++] = j;
  }
  for (int i = 0; i < m; ++i) {
    for (int j : v[s[i]]) s[m++] = j;
  }
  sort(s, s + m);
  for (int i = 0; i < m; ++i) printf("%d ", s[i] + 1);
  cout << endl;
}

```