### Prompt

Create a solution in cpp for the following problem:

Earlier, when there was no Internet, each bank had a lot of offices all around Bankopolis, and it caused a lot of problems. Namely, each day the bank had to collect cash from all the offices.

Once Oleg the bank client heard a dialogue of two cash collectors. Each day they traveled through all the departments and offices of the bank following the same route every day. The collectors started from the central department and moved between some departments or between some department and some office using special roads. Finally, they returned to the central department. The total number of departments and offices was n, the total number of roads was n - 1. In other words, the special roads system was a rooted tree in which the root was the central department, the leaves were offices, the internal vertices were departments. The collectors always followed the same route in which the number of roads was minimum possible, that is 2n - 2.

One of the collectors said that the number of offices they visited between their visits to offices a and then b (in the given order) is equal to the number of offices they visited between their visits to offices b and then a (in this order). The other collector said that the number of offices they visited between their visits to offices c and then d (in this order) is equal to the number of offices they visited between their visits to offices d and then c (in this order). The interesting part in this talk was that the shortest path (using special roads only) between any pair of offices among a, b, c and d passed through the central department.

Given the special roads map and the indexes of offices a, b, c and d, determine if the situation described by the collectors was possible, or not.

Input

The first line contains single integer n (5 ≤ n ≤ 5000) — the total number of offices and departments. The departments and offices are numbered from 1 to n, the central office has index 1.

The second line contains four integers a, b, c and d (2 ≤ a, b, c, d ≤ n) — the indexes of the departments mentioned in collector's dialogue. It is guaranteed that these indexes are offices (i.e. leaves of the tree), not departments. It is guaranteed that the shortest path between any pair of these offices passes through the central department.

On the third line n - 1 integers follow: p2, p3, ..., pn (1 ≤ pi < i), where pi denotes that there is a special road between the i-th office or department and the pi-th department.

Please note the joint enumeration of departments and offices.

It is guaranteed that the given graph is a tree. The offices are the leaves, the departments are the internal vertices.

Output

If the situation described by the cash collectors was possible, print "YES". Otherwise, print "NO".

Examples

Input

5
2 3 4 5
1 1 1 1

Output

YES

Input

10
3 8 9 10
1 2 2 2 2 2 1 1 1

Output

NO

Input

13
13 12 9 7
1 1 1 1 5 5 2 2 2 3 3 4

Output

YES

Note

In the first example the following collector's route was possible: <image>. We can note that between their visits to offices a and b the collectors visited the same number of offices as between visits to offices b and a; the same holds for c and d (the collectors' route is infinite as they follow it each day).

In the second example there is no route such that between their visits to offices c and d the collectors visited the same number of offices as between visits to offices d and c. Thus, there situation is impossible.

In the third example one of the following routes is: <image>.

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); }
const int MAXN = 5000;
typedef struct Knap {
  int opt[MAXN], nopt;
  bool dp[MAXN + 1];
  void clear() { nopt = 0; }
  void add(int x) { opt[nopt++] = x; }
  bool can(int want) {
    for (int j = (0); j <= (want); ++j) dp[j] = false;
    dp[0] = true;
    for (int i = (0); i < (nopt); ++i)
      for (int j = want; j >= opt[i]; --j)
        if (dp[j - opt[i]]) dp[j] = true;
    return dp[want];
  }
} Knap;
Knap knap;
int n;
int A, B, C, D;
int par[MAXN];
int chead[MAXN], cnxt[MAXN];
int sz[MAXN];
int mask[MAXN];
void dfs(int at) {
  sz[at] = chead[at] == -1 ? 1 : 0;
  mask[at] = 0;
  if (at == A) mask[at] |= 1;
  if (at == B) mask[at] |= 2;
  if (at == C) mask[at] |= 4;
  if (at == D) mask[at] |= 8;
  for (int to = chead[at]; to != -1; to = cnxt[to]) {
    dfs(to);
    sz[at] += sz[to];
    mask[at] |= mask[to];
  }
}
void run() {
  scanf("%d", &n);
  scanf("%d%d%d%d", &A, &B, &C, &D);
  --A, --B, --C, --D;
  par[0] = -1;
  for (int i = (1); i < (n); ++i) {
    scanf("%d", &par[i]);
    --par[i];
  }
  for (int i = (0); i < (n); ++i) chead[i] = -1;
  for (int i = (1); i < (n); ++i) cnxt[i] = chead[par[i]], chead[par[i]] = i;
  dfs(0);
  int nleaf = 0;
  for (int i = (0); i < (n); ++i)
    if (chead[i] == -1) ++nleaf;
  if (nleaf % 2 == 1) {
    printf("NO\n");
    return;
  }
  for (int x = (0); x < (2); ++x) {
    knap.clear();
    int want = nleaf / 2 - 1;
    for (int i = (1); i < (n); ++i)
      if (par[i] == 0 && mask[i] == 0) knap.add(sz[i]);
    for (int i = (1); i < (n); ++i)
      if (mask[i] == 0 && (mask[par[i]] == (1 << (0 + 2 * x)) ||
                           mask[par[i]] == (1 << (1 + 2 * x))))
        knap.add(sz[i]);
    for (int i = (1); i < (n); ++i)
      if (par[i] == 0 && mask[i] == (1 << (2 - x))) want -= sz[i];
    if (!knap.can(want)) {
      printf("NO\n");
      return;
    }
  }
  printf("YES\n");
}
int main() {
  run();
  return 0;
}

```


### Prompt

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

A permutation of size n is an array of size n such that each integer from 1 to n occurs exactly once in this array. An inversion in a permutation p is a pair of indices (i, j) such that i > j and ai < aj. For example, a permutation [4, 1, 3, 2] contains 4 inversions: (2, 1), (3, 1), (4, 1), (4, 3).

You are given a permutation a of size n and m queries to it. Each query is represented by two indices l and r denoting that you have to reverse the segment [l, r] of the permutation. For example, if a = [1, 2, 3, 4] and a query l = 2, r = 4 is applied, then the resulting permutation is [1, 4, 3, 2].

After each query you have to determine whether the number of inversions is odd or even.

Input

The first line contains one integer n (1 ≤ n ≤ 1500) — the size of the permutation.

The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ n) — the elements of the permutation. These integers are pairwise distinct.

The third line contains one integer m (1 ≤ m ≤ 2·105) — the number of queries to process.

Then m lines follow, i-th line containing two integers li, ri (1 ≤ li ≤ ri ≤ n) denoting that i-th query is to reverse a segment [li, ri] of the permutation. All queries are performed one after another.

Output

Print m lines. i-th of them must be equal to odd if the number of inversions in the permutation after i-th query is odd, and even otherwise.

Examples

Input

3
1 2 3
2
1 2
2 3

Output

odd
even

Input

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

Output

odd
odd
odd
even

Note

The first example:

  1. after the first query a = [2, 1, 3], inversion: (2, 1);
  2. after the second query a = [2, 3, 1], inversions: (3, 1), (3, 2).

The second example:

  1. a = [1, 2, 4, 3], inversion: (4, 3);
  2. a = [3, 4, 2, 1], inversions: (3, 1), (4, 1), (3, 2), (4, 2), (4, 3);
  3. a = [1, 2, 4, 3], inversion: (4, 3);
  4. a = [1, 4, 2, 3], inversions: (3, 2), (4, 2).

### Response

```cpp
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,fma")
#pragma GCC optimize("unroll-loops")
using namespace std;
using ll = long long;
using pii = pair<int, int>;
template <class T = int>
struct Fenwick {
  vector<T> t;
  T tn;
  Fenwick(int _n) {
    assert(_n > 0);
    tn = _n;
    t = vector<T>(tn + 1, 0);
  }
  void update(int x, T val) {
    x++;
    while (x <= tn) {
      t[x] += val;
      x += (x & -x);
    }
  }
  T query(int x) {
    assert(x < tn);
    x++;
    int res = 0;
    while (x > 0) {
      res += t[x];
      x -= (x & -x);
    }
    return res;
  }
  T query(int l, int r) {
    assert(l <= r);
    if (l == 0) return query(r);
    return query(r) - query(l - 1);
  }
  int find_last_prefix(T sum) {
    if (sum < 0) return -1;
    int pref = 0;
    for (int k = 31 - __builtin_clz(tn); k >= 0; k--) {
      if (pref + (1 << k) <= tn && t[pref + (1 << k)] <= sum) {
        pref += 1 << k;
        sum -= t[pref];
      }
    }
    return pref;
  }
};
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n, m;
  cin >> n;
  vector<int> p(n);
  for (auto& x : p) cin >> x;
  int isodd = 0;
  for (int i = 0; i < n; i++)
    for (int j = i + 1; j < n; j++)
      if (p[i] > p[j]) isodd ^= 1;
  cin >> m;
  while (m--) {
    int l, r;
    cin >> l >> r;
    int swaps = (r - l + 1);
    swaps = swaps * (swaps - 1) / 2;
    isodd ^= (swaps & 1);
    if (isodd)
      cout << "odd\n";
    else
      cout << "even\n";
  }
}

```


### Prompt

Generate a Cpp solution to the following problem:

In the Isle of Guernsey there are n different types of coins. For each i (1 ≤ i ≤ n), coin of type i is worth ai cents. It is possible that ai = aj for some i and j (i ≠ j).

Bessie has some set of these coins totaling t cents. She tells Jessie q pairs of integers. For each i (1 ≤ i ≤ q), the pair bi, ci tells Jessie that Bessie has a strictly greater number of coins of type bi than coins of type ci. It is known that all bi are distinct and all ci are distinct.

Help Jessie find the number of possible combinations of coins Bessie could have. Two combinations are considered different if there is some i (1 ≤ i ≤ n), such that the number of coins Bessie has of type i is different in the two combinations. Since the answer can be very large, output it modulo 1000000007 (109 + 7).

If there are no possible combinations of coins totaling t cents that satisfy Bessie's conditions, output 0.

Input

The first line contains three space-separated integers, n, q and t (1 ≤ n ≤ 300; 0 ≤ q ≤ n; 1 ≤ t ≤ 105). The second line contains n space separated integers, a1, a2, ..., an (1 ≤ ai ≤ 105). The next q lines each contain two distinct space-separated integers, bi and ci (1 ≤ bi, ci ≤ n; bi ≠ ci).

It's guaranteed that all bi are distinct and all ci are distinct.

Output

A single integer, the number of valid coin combinations that Bessie could have, modulo 1000000007 (109 + 7).

Examples

Input

4 2 17
3 1 2 5
4 2
3 4

Output

3

Input

3 2 6
3 1 1
1 2
2 3

Output

0

Input

3 2 10
1 2 3
1 2
2 1

Output

0

Note

For the first sample, the following 3 combinations give a total of 17 cents and satisfy the given conditions: {0 of type 1, 1 of type 2, 3 of type 3, 2 of type 4}, {0, 0, 6, 1}, {2, 0, 3, 1}.

No other combinations exist. Note that even though 4 occurs in both bi and ci,  the problem conditions are still satisfied because all bi are distinct and all ci are distinct.

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
const long long MAXN = 3e2 + 10;
const long long MAXT = 1e5 + 10;
const long long Mod = 1e9 + 7;
long long dp[MAXN][MAXT];
long long a[MAXN];
long long b[MAXN];
long long f[MAXN];
bool e[MAXN];
bool check[MAXN];
long long t = 1;
void dfs(long long v) {
  if (v == 0) {
    return;
  }
  check[v] = true;
  b[t++] = v;
  dfs(f[v]);
}
int main() {
  ios_base ::sync_with_stdio(false);
  cin.tie(0);
  long long n, q, t, sum = 0;
  cin >> n >> q >> t;
  for (long long i = 1; i <= n; i++) {
    cin >> a[i];
  }
  for (long long i = 0; i < q; i++) {
    long long v, u;
    cin >> v >> u;
    f[v] = u;
    e[u] = true;
  }
  for (long long i = 1; i <= n; i++) {
    if (!e[i]) {
      dfs(i);
    }
  }
  for (long long i = 1; i <= n; i++) {
    if (!check[i]) {
      cout << 0;
      return 0;
    }
  }
  dp[0][0] = 1;
  for (long long i = 1; i <= n; i++) {
    if (!e[b[i]]) {
      sum = 0;
    }
    sum += a[b[i]];
    for (long long j = 0; j < MAXT; j++) {
      dp[i][j] = (j >= sum - a[b[i]] ? dp[i - 1][j - sum + a[b[i]]] : 0) +
                 (j >= sum ? dp[i][j - sum] : 0);
      dp[i][j] %= Mod;
    }
  }
  cout << dp[n][t];
}

```


### Prompt

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

Artem is building a new robot. He has a matrix a consisting of n rows and m columns. The cell located on the i-th row from the top and the j-th column from the left has a value a_{i,j} written in it.

If two adjacent cells contain the same value, the robot will break. A matrix is called good if no two adjacent cells contain the same value, where two cells are called adjacent if they share a side.

Artem wants to increment the values in some cells by one to make a good.

More formally, find a good matrix b that satisfies the following condition —

  * For all valid (i,j), either b_{i,j} = a_{i,j} or b_{i,j} = a_{i,j}+1.

For the constraints of this problem, it can be shown that such a matrix b always exists. If there are several such tables, you can output any of them. Please note that you do not have to minimize the number of increments.

Input

Each test contains multiple test cases. The first line contains the number of test cases t (1 ≤ t ≤ 10). Description of the test cases follows.

The first line of each test case contains two integers n, m (1 ≤ n ≤ 100, 1 ≤ m ≤ 100) — the number of rows and columns, respectively.

The following n lines each contain m integers. The j-th integer in the i-th line is a_{i,j} (1 ≤ a_{i,j} ≤ 10^9).

Output

For each case, output n lines each containing m integers. The j-th integer in the i-th line is b_{i,j}.

Example

Input

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

Output

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

Note

In all the cases, you can verify that no two adjacent cells have the same value and that b is the same as a with some values incremented by one.

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
int n, m;
int a[105][105];
inline int getint() {
  int num = 0, bj = 1;
  char c = getchar();
  while (c < '0' || c > '9') {
    if (c == EOF) return EOF;
    bj = (c == '-' || bj == -1) ? -1 : 1, c = getchar();
  }
  while (c >= '0' && c <= '9') num = num * 10 + c - '0', c = getchar();
  return num * bj;
}
void init() {
  n = getint();
  m = getint();
  for (int i = 1; i <= n; ++i) {
    for (int j = 1; j <= m; ++j) a[i][j] = getint();
  }
}
void solve() {
  for (int i = 1; i <= n; ++i) {
    for (int j = 1; j <= m; ++j) {
      a[i][j] += (a[i][j] % 2 == (i + j) % 2 ? 0 : 1);
      cout << a[i][j] << " ";
    }
    cout << "\n";
  }
}
int main() {
  int T;
  cin >> T;
  while (T--) {
    init();
    solve();
  }
}

```


### Prompt

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

Tic-tac-toe is a game in which you win when you put ○ and × alternately in the 3 × 3 squares and line up ○ or × in one of the vertical, horizontal, and diagonal lines (Fig.). 1 to Fig. 3)

<image> | <image> | <image>
--- | --- | ---
Figure 1: ○ wins | Figure 2: × wins | Figure 3: Draw

In tic-tac-toe, ○ and × alternately fill the squares, and the game ends when either one is lined up. Therefore, as shown in Fig. 4, it is impossible for both ○ and × to be aligned. No improbable aspect is entered.

<image>
---
Figure 4: Impossible phase

Please create a program that reads the board of tic-tac-toe and outputs the result of victory or defeat.

Input

The input consists of multiple datasets. For each data set, one character string representing the board is given on one line. The character strings on the board are represented by o, x, and s in half-width lowercase letters for ○, ×, and blanks, respectively, and are arranged in the order of the squares in the figure below.

<image>

The number of datasets does not exceed 50.

Output

For each data set, output o in half-width lowercase letters if ○ wins, x in lowercase half-width letters if × wins, and d in lowercase half-width letters if it is a draw.

Example

Input

ooosxssxs
xoosxsosx
ooxxxooxo

Output

o
x
d

### Response

```cpp
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
using namespace std;

char a[4][4];

bool f(char c){
	for(int y = 0; y < 3; y++){
		int cnt = 0;
		for(int x = 0; x < 3; x++){
			if( a[y][x] == c ) cnt++;
		}
		if( cnt == 3 ) return true;
	}
	for(int x = 0; x < 3; x++){
		int cnt = 0;
		for(int y = 0; y < 3; y++){
			if( a[y][x] == c ) cnt++;
		}
		if( cnt == 3 ) return true;
	}
	if( a[0][0] == c && a[1][1] == c && a[2][2] == c ) return true;
	if( a[0][2] == c && a[1][1] == c && a[2][0] == c ) return true;
	return false;
}

int main(){
	while( cin >> a[0][0] ){
		for(int i = 1; i < 9; i++){
			int x = i % 3, y = i / 3;
			cin >> a[y][x];
		}
		if( f('x') ){
			cout << "x" << endl;
		}else if( f('o') ){
			cout << "o" << endl;
		}else{
			cout << "d" << endl;
		}
		cin.ignore();
	}
}
```


### Prompt

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

You are given a correct solution of the sudoku puzzle. If you don't know what is the sudoku, you can read about it [here](http://tiny.cc/636xmz).

The picture showing the correct sudoku solution:

<image>

Blocks are bordered with bold black color.

Your task is to change at most 9 elements of this field (i.e. choose some 1 ≤ i, j ≤ 9 and change the number at the position (i, j) to any other number in range [1; 9]) to make it anti-sudoku. The anti-sudoku is the 9 × 9 field, in which:

  * Any number in this field is in range [1; 9];
  * each row contains at least two equal elements;
  * each column contains at least two equal elements;
  * each 3 × 3 block (you can read what is the block in the link above) contains at least two equal elements.

It is guaranteed that the answer exists.

You have to answer t independent test cases.

Input

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

Each test case consists of 9 lines, each line consists of 9 characters from 1 to 9 without any whitespaces — the correct solution of the sudoku puzzle.

Output

For each test case, print the answer — the initial field with at most 9 changed elements so that the obtained field is anti-sudoku. If there are several solutions, you can print any. It is guaranteed that the answer exists.

Example

Input

1
154873296
386592714
729641835
863725149
975314628
412968357
631457982
598236471
247189563

Output

154873396
336592714
729645835
863725145
979314628
412958357
631457992
998236471
247789563

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int t, ti = 0;
  cin >> t;
  while ((ti++) != t) {
    long long int ar[10][10];
    for (int i = 1; i <= 9; i++) {
      for (int j = 1; j <= 9; j++) {
        scanf("%1lld", &ar[i][j]);
      }
    }
    ar[2][2] = ar[2][1];
    ar[1][7] = ar[1][6];
    ar[3][6] = ar[3][9];
    ar[5][3] = ar[5][1];
    ar[4][9] = ar[4][6];
    ar[6][5] = ar[6][8];
    ar[8][1] = ar[8][2];
    ar[9][4] = ar[9][3];
    ar[7][8] = ar[7][7];
    for (int i = 1; i <= 9; i++) {
      for (int j = 1; j <= 9; j++) printf("%lld", ar[i][j]);
      printf("\n");
    }
  }
}

```


### Prompt

Generate a CPP solution to the following problem:

Vasya is a born Berland film director, he is currently working on a new blockbuster, "The Unexpected". Vasya knows from his own experience how important it is to choose the main characters' names and surnames wisely. He made up a list of n names and n surnames that he wants to use. Vasya haven't decided yet how to call characters, so he is free to match any name to any surname. Now he has to make the list of all the main characters in the following format: "Name1 Surname1, Name2 Surname2, ..., Namen Surnamen", i.e. all the name-surname pairs should be separated by exactly one comma and exactly one space, and the name should be separated from the surname by exactly one space. First of all Vasya wants to maximize the number of the pairs, in which the name and the surname start from one letter. If there are several such variants, Vasya wants to get the lexicographically minimal one. Help him.

An answer will be verified a line in the format as is shown above, including the needed commas and spaces. It's the lexicographical minimality of such a line that needs to be ensured. The output line shouldn't end with a space or with a comma.

Input

The first input line contains number n (1 ≤ n ≤ 100) — the number of names and surnames. Then follow n lines — the list of names. Then follow n lines — the list of surnames. No two from those 2n strings match. Every name and surname is a non-empty string consisting of no more than 10 Latin letters. It is guaranteed that the first letter is uppercase and the rest are lowercase.

Output

The output data consist of a single line — the needed list. Note that one should follow closely the output data format!

Examples

Input

4
Ann
Anna
Sabrina
John
Petrov
Ivanova
Stoltz
Abacaba

Output

Ann Abacaba, Anna Ivanova, John Petrov, Sabrina Stoltz

Input

4
Aa
Ab
Ac
Ba
Ad
Ae
Bb
Bc

Output

Aa Ad, Ab Ae, Ac Bb, Ba Bc

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
const int maxn = 110;
int n, a[26], b[26];
string A[maxn], B[maxn];
namespace Ninit {
void init() {
  int i, c;
  scanf("%d", &n);
  for (i = 0; i < n; ++i) cin >> A[i], ++a[A[i][0] - 'A'], A[i] += ' ';
  sort(A, A + n);
  for (i = 0; i < n; ++i) cin >> B[i], ++b[B[i][0] - 'A'], B[i] += ',';
  sort(B, B + n);
  for (i = 0; i < 26; ++i) c = min(a[i], b[i]), a[i] -= c, b[i] -= c;
}
}  // namespace Ninit
namespace Nsolve {
bool use[maxn];
void solve() {
  int i, j;
  for (i = 0; i < n; ++i) {
    for (j = 0;; ++j) {
      for (; j < n; ++j)
        if (!use[j]) break;
      if (A[i][0] == B[j][0]) break;
      if (a[A[i][0] - 'A'] && b[B[j][0] - 'A']) {
        --a[A[i][0] - 'A'], --b[B[j][0] - 'A'];
        break;
      }
    }
    use[j] = true;
    if (i) cout << ' ';
    cout << A[i];
    if (i < n - 1)
      cout << B[j];
    else
      cout << B[j].substr(0, B[j].size() - 1);
  }
  cout << endl;
}
}  // namespace Nsolve
int main() {
  Ninit::init();
  Nsolve::solve();
  return 0;
}

```


### Prompt

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

You have a large rectangular board which is divided into n × m cells (the board has n rows and m columns). Each cell is either white or black.

You paint each white cell either red or blue. Obviously, the number of different ways to paint them is 2^w, where w is the number of white cells.

After painting the white cells of the board, you want to place the maximum number of dominoes on it, according to the following rules:

  * each domino covers two adjacent cells;
  * each cell is covered by at most one domino;
  * if a domino is placed horizontally (it covers two adjacent cells in one of the rows), it should cover only red cells;
  * if a domino is placed vertically (it covers two adjacent cells in one of the columns), it should cover only blue cells.

Let the value of the board be the maximum number of dominoes you can place. Calculate the sum of values of the board over all 2^w possible ways to paint it. Since it can be huge, print it modulo 998 244 353.

Input

The first line contains two integers n and m (1 ≤ n, m ≤ 3 ⋅ 10^5; nm ≤ 3 ⋅ 10^5) — the number of rows and columns, respectively.

Then n lines follow, each line contains a string of m characters. The j-th character in the i-th string is * if the j-th cell in the i-th row is black; otherwise, that character is o.

Output

Print one integer — the sum of values of the board over all 2^w possible ways to paint it, taken modulo 998 244 353.

Examples

Input

3 4
**oo
oo*o
**oo

Output

144

Input

3 4
**oo
oo**
**oo

Output

48

Input

2 2
oo
o*

Output

4

Input

1 4
oooo

Output

9

### Response

```cpp
#include <cstdlib>
#include <iostream>
#include <cstdio>
#include <math.h>
#include <cstring>
#include <time.h>
#include <complex>
#include <algorithm>
#include <queue>
#include <stack>
#include <unordered_map>
#include <set>
#include <bitset>

#pragma warning(disable:4996)
#define PII std::pair<long long, long long>
#define PTT std::pair<tree *, tree *>

template<typename T> T min(T x, T y)
{
	return x < y ? x : y;
}
template<typename T> T max(T x, T y)
{
	return x > y ? x : y;
};

const long long INF = 2000000005;//00000;// autojs.org
const long long mod = 998244353;//1000000007;//
const int MAXN = 300005;

int N, M, tot, cntr[MAXN], cntc[MAXN];
std::vector<bool> v[MAXN];
long long f[MAXN][2];

long long qpow(long long x, long long y)
{
	if (!y)
		return 1;
	long long t = qpow(x, y / 2);
	t = t * t % mod;
	return y & 1 ? t * x % mod : t;
}
void DP(bool *a, int n)
{
	static int cnt[MAXN];
	for (int i = 1; i <= n; i++)
		cnt[i] = cnt[i - 1] + !a[i];
	for (int i = 2; i <= n; i++)
	{
		f[i][0] = (f[i - 1][0] + f[i - 1][1]) % mod;
		f[i][1] = 0;
		if (!a[i])
		{
			f[i][1] += f[i - 1][0];
			if (!a[i - 1])
				f[i][1] += qpow(2, cnt[i - 2]) + f[i - 2][0] + f[i - 2][1];
			f[i][1] %= mod;
		}
	}
}

void init()
{
	static char s[MAXN];
	scanf("%d %d", &N, &M);
	for (int i = 1; i <= N; i++)
	{
		scanf("%s", s + 1);
		for (int j = 1; j <= M; j++)
		{
			v[i].push_back(s[j] == '*');
			tot += !(s[j] == '*');
			cntr[i] += !(s[j] == '*');
			cntc[j] += !(s[j] == '*');
		}
	}
}
void solve()
{
	bool tmp[MAXN];
	long long ans = 0;
	for (int i = 1; i <= N; i++)
	{
		for (int j = 0; j < M; j++)
			tmp[j + 1] = v[i][j];
		DP(tmp, M);
		ans = (ans + (f[M][0] + f[M][1]) % mod * qpow(2, tot - cntr[i]) % mod) % mod;
	}
	for (int j = 1; j <= M; j++)
	{
		for (int i = 1; i <= N; i++)
			tmp[i] = v[i][j - 1];
		DP(tmp, N);
		ans = (ans + (f[N][0] + f[N][1]) % mod * qpow(2, tot - cntc[j]) % mod) % mod;
	}
	printf("%lld\n", ans);
}

int main()
{
	init();
	solve();

	return 0;
}
/*
5 5
ooooo
ooooo
ooooo
ooooo
ooooo

*/
```


### Prompt

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

In this problem you have to build tournament graph, consisting of n vertices, such, that for any oriented pair of vertices (v, u) (v ≠ u) there exists a path from vertex v to vertex u consisting of no more then two edges.

A directed graph without self-loops is a tournament, if there is exactly one edge between any two distinct vertices (in one out of two possible directions).

Input

The first line contains an integer n (3 ≤ n ≤ 1000), the number of the graph's vertices.

Output

Print -1 if there is no graph, satisfying the described conditions.

Otherwise, print n lines with n integers in each. The numbers should be separated with spaces. That is adjacency matrix a of the found tournament. Consider the graph vertices to be numbered with integers from 1 to n. Then av, u = 0, if there is no edge from v to u, and av, u = 1 if there is one.

As the output graph has to be a tournament, following equalities must be satisfied:

  * av, u + au, v = 1 for each v, u (1 ≤ v, u ≤ n; v ≠ u);
  * av, v = 0 for each v (1 ≤ v ≤ n).

Examples

Input

3

Output

0 1 0
0 0 1
1 0 0

Input

4

Output

-1

### Response

```cpp
#include <bits/stdc++.h>
const int N = 1010;
int n, i, j, a[N][N];
void c(int n) {
  for (i = 1; i <= n; i++)
    for (j = 1; j <= n / 2; j++) a[i][(i + j - 1) % n + 1] = 1;
}
int main() {
  scanf("%d", &n);
  if (n == 4) {
    printf("-1\n");
    return 0;
  }
  if (n & 1)
    c(n);
  else {
    c(n - 1);
    for (i = 1; i <= n - 1; i++)
      if (i & 1)
        a[n][i] = 1;
      else
        a[i][n] = 1;
  }
  for (i = 1; i <= n; i++) {
    for (j = 1; j <= n; j++) {
      if (j > 1) printf(" ");
      printf("%d", a[i][j]);
    }
    printf("\n");
  }
  scanf("\n");
  return 0;
}

```


### Prompt

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

Note that girls in Arpa’s land are really attractive.

Arpa loves overnight parties. In the middle of one of these parties Mehrdad suddenly appeared. He saw n pairs of friends sitting around a table. i-th pair consisted of a boy, sitting on the ai-th chair, and his girlfriend, sitting on the bi-th chair. The chairs were numbered 1 through 2n in clockwise direction. There was exactly one person sitting on each chair.

<image>

There were two types of food: Kooft and Zahre-mar. Now Mehrdad wonders, was there any way to serve food for the guests such that:

  * Each person had exactly one type of food,
  * No boy had the same type of food as his girlfriend,
  * Among any three guests sitting on consecutive chairs, there was two of them who had different type of food. Note that chairs 2n and 1 are considered consecutive.

Find the answer for the Mehrdad question. If it was possible, find some arrangement of food types that satisfies the conditions.

Input

The first line contains an integer n (1 ≤ n ≤ 105) — the number of pairs of guests.

The i-th of the next n lines contains a pair of integers ai and bi (1 ≤ ai, bi ≤ 2n) — the number of chair on which the boy in the i-th pair was sitting and the number of chair on which his girlfriend was sitting. It's guaranteed that there was exactly one person sitting on each chair.

Output

If there is no solution, print -1.

Otherwise print n lines, the i-th of them should contain two integers which represent the type of food for the i-th pair. The first integer in the line is the type of food the boy had, and the second integer is the type of food the girl had. If someone had Kooft, print 1, otherwise print 2.

If there are multiple solutions, print any of them.

Example

Input

3
1 4
2 5
3 6

Output

1 2
2 1
1 2

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
const int MaxN = 100050;
int head[MaxN * 2], cnt;
struct edge {
  int next, to;
} e[MaxN * 6];
int n, a[MaxN], b[MaxN], col[MaxN * 2];
void link(int u, int v) {
  ++cnt;
  e[cnt].next = head[u];
  e[cnt].to = v;
  head[u] = cnt;
  ++cnt;
  e[cnt].next = head[v];
  e[cnt].to = u;
  head[v] = cnt;
}
void dfs(int x, int c) {
  col[x] = c;
  for (int i = head[x]; i; i = e[i].next)
    if (col[e[i].to] == -1) dfs(e[i].to, c ^ 1);
}
int main() {
  scanf("%d", &n);
  memset(col, 0xff, sizeof(col));
  for (int i = 1; i <= n; ++i) scanf("%d%d", &a[i], &b[i]);
  for (int i = 1; i <= n; ++i) {
    link(a[i], b[i]);
    if (i != n)
      link(2 * i, 2 * i + 1);
    else
      link(2 * i, 1);
  }
  for (int i = 1; i <= 2 * n; ++i)
    if (col[i] == -1) dfs(i, 1);
  for (int i = 1; i <= n; ++i) printf("%d %d\n", col[a[i]] + 1, col[b[i]] + 1);
  return 0;
}

```


### Prompt

Generate a Cpp solution to the following problem:

One way to create a task is to learn from math. You can generate some random math statement or modify some theorems to get something new and build a new task from that.

For example, there is a statement called the "Goldbach's conjecture". It says: "each even number no less than four can be expressed as the sum of two primes". Let's modify it. How about a statement like that: "each integer no less than 12 can be expressed as the sum of two composite numbers." Not like the Goldbach's conjecture, I can prove this theorem.

You are given an integer n no less than 12, express it as a sum of two composite numbers.

Input

The only line contains an integer n (12 ≤ n ≤ 106).

Output

Output two composite integers x and y (1 < x, y < n) such that x + y = n. If there are multiple solutions, you can output any of them.

Examples

Input

12

Output

4 8

Input

15

Output

6 9

Input

23

Output

8 15

Input

1000000

Output

500000 500000

Note

In the first example, 12 = 4 + 8 and both 4, 8 are composite numbers. You can output "6 6" or "8 4" as well.

In the second example, 15 = 6 + 9. Note that you can't output "1 14" because 1 is not a composite number.

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n;
  cin >> n;
  vector<int> v(n + 1);
  for (int i = 2; i <= n; i++) {
    if (v[i] == 0)
      for (int j = 2; j * i < n; j++) v[i * j] = 1;
  }
  vector<int> v1;
  v1.push_back(1);
  for (int i = 2; i <= n; i++)
    if (v[i] != 0) v1.push_back(i);
  for (int i = 1; i < v1.size(); i++)
    if (binary_search(v1.begin(), v1.end(), (n - v1[i]))) {
      cout << v1[i] << " " << n - v1[i];
      break;
    }
  return 0;
}

```


### Prompt

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

Takahashi bought a piece of apple pie at ABC Confiserie. According to his memory, he paid N yen (the currency of Japan) for it.

The consumption tax rate for foods in this shop is 8 percent. That is, to buy an apple pie priced at X yen before tax, you have to pay X \times 1.08 yen (rounded down to the nearest integer).

Takahashi forgot the price of his apple pie before tax, X, and wants to know it again. Write a program that takes N as input and finds X. We assume X is an integer.

If there are multiple possible values for X, find any one of them. Also, Takahashi's memory of N, the amount he paid, may be incorrect. If no value could be X, report that fact.

Constraints

* 1 \leq N \leq 50000
* N is an integer.

Input

Input is given from Standard Input in the following format:

N

Output

If there are values that could be X, the price of the apple pie before tax, print any one of them.
If there are multiple such values, printing any one of them will be accepted.
If no value could be X, print `:(`.

Examples

Input

432

Output

400

Input

1079

Output

:(

Input

1001

Output

927

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;

int main(){
  long N;cin>>N;
  for(long i=1;i<=50000;i++){
    if(i*108/100==N){
      cout<<i<<endl;
      return 0;
    }
  }
  cout<<":("<<endl;
}
```


### Prompt

Develop a solution in CPP to the problem described below:

In the game of Mastermind, there are two players — Alice and Bob. Alice has a secret code, which Bob tries to guess. Here, a code is defined as a sequence of n colors. There are exactly n+1 colors in the entire universe, numbered from 1 to n+1 inclusive.

When Bob guesses a code, Alice tells him some information about how good of a guess it is, in the form of two integers x and y.

The first integer x is the number of indices where Bob's guess correctly matches Alice's code. The second integer y is the size of the intersection of the two codes as multisets. That is, if Bob were to change the order of the colors in his guess, y is the maximum number of indices he could get correct.

For example, suppose n=5, Alice's code is [3,1,6,1,2], and Bob's guess is [3,1,1,2,5]. At indices 1 and 2 colors are equal, while in the other indices they are not equal. So x=2. And the two codes have the four colors 1,1,2,3 in common, so y=4.

<image> Solid lines denote a matched color for the same index. Dashed lines denote a matched color at a different index. x is the number of solid lines, and y is the total number of lines.

You are given Bob's guess and two values x and y. Can you find one possibility of Alice's code so that the values of x and y are correct?

Input

The first line contains a single integer t (1≤ t≤ 1000) — the number of test cases. Next 2t lines contain descriptions of test cases.

The first line of each test case contains three integers n,x,y (1≤ n≤ 10^5, 0≤ x≤ y≤ n) — the length of the codes, and two values Alice responds with.

The second line of each test case contains n integers b_1,…,b_n (1≤ b_i≤ n+1) — Bob's guess, where b_i is the i-th color of the guess.

It is guaranteed that the sum of n across all test cases does not exceed 10^5.

Output

For each test case, on the first line, output "YES" if there is a solution, or "NO" if there is no possible secret code consistent with the described situation. You can print each character in any case (upper or lower).

If the answer is "YES", on the next line output n integers a_1,…,a_n (1≤ a_i≤ n+1) — Alice's secret code, where a_i is the i-th color of the code.

If there are multiple solutions, output any.

Example

Input

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

Output

YES
3 1 6 1 2
YES
3 1 1 1 2
YES
3 3 5 5
NO
YES
4 4 4 4 3 1
YES
3 1 3 1 7 7
YES
2 3 1 1 1 1

Note

The first test case is described in the statement.

In the second test case, x=3 because the colors are equal at indices 2,4,5. And y=4 because they share the colors 1,1,1,2.

In the third test case, x=0 because there is no index where the colors are the same. But y=4 because they share the colors 3,3,5,5.

In the fourth test case, it can be proved that no solution exists.

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int t;
  cin >> t;
  for (int q = 1; q <= t; q++) {
    int n, x, y;
    cin >> n >> x >> y;
    vector<int> b(n), cnt(n + 2, 0);
    for (int i = 0; i < n; i++) {
      cin >> b[i];
      cnt[b[i]]++;
    }
    int c = (y - x) / 2, C = (y - x);
    vector<pair<int, int>> p;
    int non = 0;
    for (int i = 1; i <= n + 1; i++) {
      if (cnt[i]) {
        p.push_back({cnt[i], i});
      } else
        non = i;
    }
    sort(p.begin(), p.end());
    if ((y - x) & 1) {
      int contr = 0;
      for (int i = 0; i < p.size(); i++) {
        contr += min(c, p[i].first);
      }
      if (contr < C) {
        c++;
        C = 2 * c;
      }
    }
    vector<int> ch, a(n, 0);
    map<int, vector<int>> mp;
    bool ok = true;
    for (int i = 0; i < p.size(); i++) {
      for (int j = 1; j <= min(c, p[i].first) && ch.size() < C; j++) {
        ch.push_back(p[i].second);
      }
    }
    if (ch.size() != C || n - C < x)
      ok = false;
    else {
      sort(ch.begin(), ch.end());
      for (int i = 0; i < ch.size(); i++) {
        mp[ch[i]].push_back(ch[(i + c) % (C)]);
      }
      int k = y - x;
      for (int i = 0; i < n; i++) {
        if (!mp[b[i]].empty()) {
          if (k) {
            a[i] = mp[b[i]].back();
            mp[b[i]].pop_back();
            k--;
          } else {
            a[i] = non;
            mp[b[i]].pop_back();
          }
        } else {
          if (x) {
            a[i] = b[i];
            x--;
          } else
            a[i] = non;
        }
      }
    }
    if (ok) {
      cout << "YES"
           << "\n";
      for (int i = 0; i < n; i++) {
        cout << a[i] << " ";
      }
      cout << "\n";
    } else {
      cout << "NO"
           << "\n";
    }
  }
  return 0;
}

```


### Prompt

Develop a solution in CPP to the problem described below:

You have a rectangular chocolate bar consisting of n × m single squares. You want to eat exactly k squares, so you may need to break the chocolate bar.

In one move you can break any single rectangular piece of chocolate in two rectangular pieces. You can break only by lines between squares: horizontally or vertically. The cost of breaking is equal to square of the break length.

For example, if you have a chocolate bar consisting of 2 × 3 unit squares then you can break it horizontally and get two 1 × 3 pieces (the cost of such breaking is 32 = 9), or you can break it vertically in two ways and get two pieces: 2 × 1 and 2 × 2 (the cost of such breaking is 22 = 4).

For several given values n, m and k find the minimum total cost of breaking. You can eat exactly k squares of chocolate if after all operations of breaking there is a set of rectangular pieces of chocolate with the total size equal to k squares. The remaining n·m - k squares are not necessarily form a single rectangular piece.

Input

The first line of the input contains a single integer t (1 ≤ t ≤ 40910) — the number of values n, m and k to process.

Each of the next t lines contains three integers n, m and k (1 ≤ n, m ≤ 30, 1 ≤ k ≤ min(n·m, 50)) — the dimensions of the chocolate bar and the number of squares you want to eat respectively.

Output

For each n, m and k print the minimum total cost needed to break the chocolate bar, in order to make it possible to eat exactly k squares.

Examples

Input

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

Output

5
5
4
0

Note

In the first query of the sample one needs to perform two breaks:

  * to split 2 × 2 bar into two pieces of 2 × 1 (cost is 22 = 4),
  * to split the resulting 2 × 1 into two 1 × 1 pieces (cost is 12 = 1).

In the second query of the sample one wants to eat 3 unit squares. One can use exactly the same strategy as in the first query of the sample.

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
int dp[35][35][55];
int t, n, m, k;
int main() {
  scanf("%d", &t);
  dp[1][1][1] = 0;
  dp[1][1][0] = 0;
  for (int i = 1; i <= 31; i++) {
    for (int j = 1; j <= 31; j++) {
      if (i == 1 && j == 1) continue;
      int op = min(i * j, 52);
      for (int k = 1; k < op; k++) {
        dp[i][j][k] = 100000000;
        for (int s = 1; s <= (i / 2) + 1 && i - s >= 0; s++) {
          for (int q = 0; q <= s * j && q <= k; q++) {
            if ((k - q) > (i - s) * j) continue;
            dp[i][j][k] =
                min(dp[i][j][k], dp[i - s][j][k - q] + dp[s][j][q] + j * j);
          }
        }
        for (int s = 1; s <= (j / 2) + 1 && j - s >= 0; s++) {
          for (int q = 0; q <= i * s && q <= k; q++) {
            if (k - q > i * (j - s)) continue;
            dp[i][j][k] =
                min(dp[i][j][k], dp[i][j - s][k - q] + dp[i][s][q] + i * i);
          }
        }
      }
    }
  }
  while (t--) {
    scanf("%d", &n), scanf("%d", &m), scanf("%d", &k);
    printf("%d\n", dp[n][m][k]);
  }
  return 0;
}

```


### Prompt

Generate a CPP solution to the following problem:

Polycarp lives on the coordinate axis Ox and travels from the point x=a to x=b. It moves uniformly rectilinearly at a speed of one unit of distance per minute.

On the axis Ox at the point x=c the base station of the mobile operator is placed. It is known that the radius of its coverage is r. Thus, if Polycarp is at a distance less than or equal to r from the point x=c, then he is in the network coverage area, otherwise — no. The base station can be located both on the route of Polycarp and outside it.

Print the time in minutes during which Polycarp will not be in the coverage area of the network, with a rectilinear uniform movement from x=a to x=b. His speed — one unit of distance per minute.

Input

The first line contains a positive integer t (1 ≤ t ≤ 1000) — the number of test cases. In the following lines are written t test cases.

The description of each test case is one line, which contains four integers a, b, c and r (-10^8 ≤ a,b,c ≤ 10^8, 0 ≤ r ≤ 10^8) — the coordinates of the starting and ending points of the path, the base station, and its coverage radius, respectively.

Any of the numbers a, b and c can be equal (either any pair or all three numbers). The base station can be located both on the route of Polycarp and outside it.

Output

Print t numbers — answers to given test cases in the order they are written in the test. Each answer is an integer — the number of minutes during which Polycarp will be unavailable during his movement.

Example

Input

9
1 10 7 1
3 3 3 0
8 2 10 4
8 2 10 100
-10 20 -17 2
-3 2 2 0
-3 1 2 0
2 3 2 3
-1 3 -2 2

Output

7
0
4
0
30
5
4
0
3

Note

The following picture illustrates the first test case.

<image> Polycarp goes from 1 to 10. The yellow area shows the coverage area of the station with a radius of coverage of 1, which is located at the point of 7. The green area shows a part of the path when Polycarp is out of coverage area.

### Response

```cpp
#include <bits/stdc++.h>
const int N = 500005;
const int mod = 1e9 + 7;
using namespace std;
void solve() {
  int n, m, k, x = 0, y = 0, c = 0, q, ans = 0, a, b, r;
  cin >> a >> b >> c >> r;
  if (a > b) swap(a, b);
  if (a <= c and c <= b) {
    x = c - r;
    ans = max(0, x - a);
    x = r + c;
    ans += max(0, b - x);
    cout << ans << "\n";
    return;
  }
  if (c <= a and c <= b) {
    c = c + r;
    c = max(c, a);
    cout << max(0, b - c) << "\n";
  } else {
    c = c - r;
    c = min(c, b);
    cout << max(0, c - a) << "\n";
  }
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int T = 1;
  cin >> T;
  while (T--) {
    solve();
  }
  return 0;
}

```


### Prompt

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

Once upon a time there was only one router in the well-known company Bmail. Years went by and over time new routers were purchased. Every time they bought a new router, they connected it to one of the routers bought before it. You are given the values p_i — the index of the router to which the i-th router was connected after being purchased (p_i < i).

There are n routers in Boogle in total now. Print the sequence of routers on the path from the first to the n-th router.

Input

The first line contains integer number n (2 ≤ n ≤ 200000) — the number of the routers. The following line contains n-1 integers p_2, p_3, ..., p_n (1 ≤ p_i < i), where p_i is equal to index of the router to which the i-th was connected after purchase.

Output

Print the path from the 1-st to the n-th router. It starts with 1 and ends with n. All the elements in the path should be distinct.

Examples

Input

8
1 1 2 2 3 2 5

Output

1 2 5 8

Input

6
1 2 3 4 5

Output

1 2 3 4 5 6

Input

7
1 1 2 3 4 3

Output

1 3 7

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int a[n + 1];
  int i, j, l;
  for (i = 2; i <= n; i++) cin >> a[i];
  stack<int> s;
  a[1] = 0;
  j = n;
  while (j > 0) {
    s.push(j);
    j = a[j];
  }
  while (!s.empty()) {
    j = s.top();
    s.pop();
    cout << j << " ";
  }
  cout << endl;
  return 0;
}

```


### Prompt

Please create a solution in CPP to the following problem:

Autumn came late to the kingdom of Far Far Away. The harvest was exuberant and it is now time to get ready for the winter. As most people celebrate the Harvest festival, Simon the Caretaker tries to solve a very non-trivial task of how to find place for the agricultural equipment in the warehouse.

He's got problems with some particularly large piece of equipment, which is, of course, turboplows. The problem is that when a turboplow is stored, it takes up not some simply rectangular space. It takes up a T-shaped space like on one of the four pictures below (here character "#" stands for the space occupied by the turboplow and character "." stands for the free space):

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

Simon faced a quite natural challenge: placing in the given n × m cells warehouse the maximum number of turboplows. As one stores the turboplows, he can rotate them in any manner (so that they take up the space like on one of the four pictures above). However, two turboplows cannot "overlap", that is, they cannot share the same cell in the warehouse.

Simon feels that he alone cannot find the optimal way of positioning the plugs in the warehouse that would maximize their quantity. Can you help him?

Input

The only line contains two space-separated integers n and m — the sizes of the warehouse (1 ≤ n, m ≤ 9).

Output

In the first line print the maximum number of turboplows that can be positioned in the warehouse. In each of the next n lines print m characters. Use "." (dot) to mark empty space and use successive capital Latin letters ("A" for the first turboplow, "B" for the second one and so on until you reach the number of turboplows in your scheme) to mark place for the corresponding turboplows considering that they are positioned in the optimal manner in the warehouse. The order in which you number places for the turboplows does not matter. If there are several optimal solutions for a warehouse of the given size, print any of them.

Examples

Input

3 3

Output

1
AAA
.A.
.A.

Input

5 6

Output

4
A..C..
AAAC..
ABCCCD
.B.DDD
BBB..D

Input

2 2

Output

0
..
..

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
int MSK;
int dp[1 << 19][9][9];
int adj[4][2];
int n, m;
int f(int bt, int r, int c) {
  if (r >= n - 2) return 0;
  int &res = dp[bt][r][c];
  if (res != -1) return res;
  if (m - c < 3) {
    res = f((bt << (m - c)) & MSK, r + 1, 0);
  } else {
    res = f((bt << 1) & MSK, r, c + 1);
    int bt2 = (bt >> 1);
    int b = (bt & 1) << 2;
    for (int i = 0; i < 4; i++) {
      if (bt2 & adj[i][0]) continue;
      if (b & adj[i][1]) continue;
      int k = (((bt2 | adj[i][0]) << 3) | (adj[i][1] | b)) & MSK;
      k = f(k, r, c + 2) + 1;
      if (k > res) {
        res = k;
      }
    }
  }
  return res;
}
string s[11];
char alp = 'A';
string T[4][3] = {{"###", ".#.", ".#."},
                  {"..#", "###", "..#"},
                  {".#.", ".#.", "###"},
                  {"#..", "###", "#.."}};
void print(int bt, int r, int c) {
  if (r >= n - 2) return;
  if (m - c < 3) {
    print((bt << (m - c)) & MSK, r + 1, 0);
  } else {
    int bt2 = (bt >> 1);
    int b = (bt & 1) << 2;
    int x = 0;
    for (x = 0; x < 4; x++) {
      if (bt2 & adj[x][0]) continue;
      if (b & adj[x][1]) continue;
      int k = (((bt2 | adj[x][0]) << 3) | (adj[x][1] | b)) & MSK;
      if (dp[bt][r][c] == f(k, r, c + 2) + 1) {
        for (int i = 0; i < 3; i++) {
          for (int j = 0; j < 3; j++)
            if (T[x][i][j] == '#') s[r + i][c + j] = alp;
        }
        alp++;
        print(k, r, c + 2);
        break;
      }
    }
    if (x == 4) print((bt << 1) & MSK, r, c + 1);
  }
}
int main() {
  cin >> n >> m;
  MSK = (1 << (2 * m + 1)) - 1;
  int a[4][3] = {{7, 2, 2}, {1, 7, 1}, {2, 2, 7}, {4, 7, 4}};
  for (int i = 0; i < 4; i++) {
    adj[i][0] = (a[i][0] << (2 * m - 3)) | (a[i][1] << (m - 3));
    adj[i][1] = a[i][2];
  }
  for (int i = 0; i < m; i++) s[0] += '.';
  for (int i = 1; i < n; i++) s[i] = s[0];
  memset(dp, -1, sizeof dp);
  int ans = f(0, 0, 0);
  cout << ans << endl;
  print(0, 0, 0);
  for (int i = 0; i < n; i++) cout << s[i] << endl;
  return 0;
}

```


### Prompt

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

problem

Given $ N $ different natural numbers $ a_i $. I decided to make a pair by choosing a different natural number from the given natural numbers. Output one pair that can be created with a value difference that is a multiple of $ N -1 $.

It should be noted that such a pair always exists.

Example

Input

5
1 2 4 7 10

Output

2 10

### Response

```cpp
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <set>
#include <map>
#include <cmath>
using namespace std;
typedef long long i64;
typedef long double ld;
typedef pair<i64,i64> P;
#define rep(i,s,e) for(int (i) = (s);(i) <= (e);(i)++)

int n;

vector<int> a(1010);

int main(){
  cin >> n;
  for(int i = 0;i < n;i++){
    cin >> a[i];
  }

  rep(i,0,n - 1) rep(j,0,n - 1){
    if(i == j) continue;
    if(abs(a[i] - a[j]) % (n - 1) == 0){
      cout << a[i] << " " << a[j] << endl;
      return 0;
    }
  }
}

```


### Prompt

Generate a cpp solution to the following problem:

You've got another geometrical task. You are given two non-degenerate polygons A and B as vertex coordinates. Polygon A is strictly convex. Polygon B is an arbitrary polygon without any self-intersections and self-touches. The vertices of both polygons are given in the clockwise order. For each polygon no three consecutively following vertices are located on the same straight line.

Your task is to check whether polygon B is positioned strictly inside polygon A. It means that any point of polygon B should be strictly inside polygon A. "Strictly" means that the vertex of polygon B cannot lie on the side of the polygon A.

Input

The first line contains the only integer n (3 ≤ n ≤ 105) — the number of vertices of polygon A. Then n lines contain pairs of integers xi, yi (|xi|, |yi| ≤ 109) — coordinates of the i-th vertex of polygon A. The vertices are given in the clockwise order.

The next line contains a single integer m (3 ≤ m ≤ 2·104) — the number of vertices of polygon B. Then following m lines contain pairs of integers xj, yj (|xj|, |yj| ≤ 109) — the coordinates of the j-th vertex of polygon B. The vertices are given in the clockwise order.

The coordinates of the polygon's vertices are separated by a single space. It is guaranteed that polygons A and B are non-degenerate, that polygon A is strictly convex, that polygon B has no self-intersections and self-touches and also for each polygon no three consecutively following vertices are located on the same straight line.

Output

Print on the only line the answer to the problem — if polygon B is strictly inside polygon A, print "YES", otherwise print "NO" (without the quotes).

Examples

Input

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

Output

YES

Input

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

Output

NO

Input

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

Output

NO

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
const int sz = 2e5 + 5;
pair<long long, long long> pv[sz];
long long cross(pair<long long, long long> a, pair<long long, long long> b,
                pair<long long, long long> c) {
  return (b.second - a.second) * (c.first - a.first) -
         (b.first - a.first) * (c.second - a.second);
}
int orient(pair<long long, long long> a, pair<long long, long long> b,
           pair<long long, long long> c) {
  long long val = cross(a, b, c);
  if (!val) return 0;
  return val > 0 ? 1 : 2;
}
bool up(pair<long long, long long> p) {
  return p.second > 0 || (!p.second && p.first >= 0);
}
bool pip(pair<long long, long long> p, int n) {
  if (n < 3) return 0;
  int l = 1, r = n - 2;
  while (l < r) {
    int md = (l + r + 1) >> 1;
    if (orient(pv[0], pv[md], p) == 1)
      r = md - 1;
    else
      l = md;
  }
  if (!cross(pv[0], pv[1], p)) return 0;
  if (!cross(pv[0], pv[n - 1], p)) return 0;
  if (!cross(pv[l], pv[l + 1], p)) return 0;
  if (orient(pv[0], pv[l], p) == 1) return 0;
  if (orient(pv[l], pv[l + 1], p) == 1) return 0;
  if (orient(pv[l + 1], pv[0], p) == 1) return 0;
  return 1;
}
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) scanf("%lld %lld", &pv[i].first, &pv[i].second);
  reverse(pv, pv + n);
  int q;
  cin >> q;
  bool ans = 1;
  while (q--) {
    pair<long long, long long> p;
    scanf("%lld %lld", &p.first, &p.second);
    bool in = pip(p, n);
    ans &= in;
  }
  if (ans)
    puts("YES");
  else
    puts("NO");
}

```


### Prompt

Please create a solution in cpp to the following problem:

During the winter holidays, the demand for Christmas balls is exceptionally high. Since it's already 2018, the advances in alchemy allow easy and efficient ball creation by utilizing magic crystals.

Grisha needs to obtain some yellow, green and blue balls. It's known that to produce a yellow ball one needs two yellow crystals, green — one yellow and one blue, and for a blue ball, three blue crystals are enough.

Right now there are A yellow and B blue crystals in Grisha's disposal. Find out how many additional crystals he should acquire in order to produce the required number of balls.

Input

The first line features two integers A and B (0 ≤ A, B ≤ 109), denoting the number of yellow and blue crystals respectively at Grisha's disposal.

The next line contains three integers x, y and z (0 ≤ x, y, z ≤ 109) — the respective amounts of yellow, green and blue balls to be obtained.

Output

Print a single integer — the minimum number of crystals that Grisha should acquire in addition.

Examples

Input

4 3
2 1 1

Output

2

Input

3 9
1 1 3

Output

1

Input

12345678 87654321
43043751 1000000000 53798715

Output

2147483648

Note

In the first sample case, Grisha needs five yellow and four blue crystals to create two yellow balls, one green ball, and one blue ball. To do that, Grisha needs to obtain two additional crystals: one yellow and one blue.

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
int toNumber(string s) {
  int Number;
  if (!(istringstream(s) >> Number)) Number = 0;
  return Number;
}
string toString(int number) {
  ostringstream ostr;
  ostr << number;
  return ostr.str();
}
long long ele(long long a, long long b) {
  if (b == 0) return 1;
  if (b % 2 == 0) {
    return ele((a * a), b / 2);
  } else {
    return a * ele((a * a), b / 2);
  }
}
long long mcd(long long a, long long b) {
  if (a == 0) return b;
  return mcd(b % a, a);
}
double d_abs(long a, long b) {
  if (a > b) {
    return a - b;
  }
  return b - a;
}
int ent(char c) { return c - '0'; }
void solve() {
  long long a, b, x, y, z;
  cin >> a >> b >> x >> y >> z;
  long long needye = 2 * x + y;
  long long needblue = 3 * z + y;
  long long cero = 0;
  cout << max(cero, needye - a) + max(cero, needblue - b) << endl;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int T;
  T = 1;
  while (T--) {
    solve();
  }
}

```


### Prompt

Generate a CPP solution to the following problem:

Polycarpus has n markers and m marker caps. Each marker is described by two numbers: xi is the color and yi is the diameter. Correspondingly, each cap is described by two numbers: aj is the color and bj is the diameter. Cap (aj, bj) can close marker (xi, yi) only if their diameters match, that is, bj = yi. Besides, a marker is considered to be beautifully closed, if the cap color and the marker color match, that is, aj = xi.

Find the way to close the maximum number of markers. If there are several such ways, then choose the one that has the maximum number of beautifully closed markers.

Input

The first input line contains two space-separated integers n and m (1 ≤ n, m ≤ 105) — the number of markers and the number of caps, correspondingly.

Next n lines describe the markers. The i-th line contains two space-separated integers xi, yi (1 ≤ xi, yi ≤ 1000) — the i-th marker's color and diameter, correspondingly.

Next m lines describe the caps. The j-th line contains two space-separated integers aj, bj (1 ≤ aj, bj ≤ 1000) — the color and diameter of the j-th cap, correspondingly.

Output

Print two space-separated integers u, v, where u is the number of closed markers and v is the number of beautifully closed markers in the sought optimal way. Remember that you have to find the way to close the maximum number of markers, and if there are several such ways, you should choose the one where the number of beautifully closed markers is maximum.

Examples

Input

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

Output

3 2

Input

2 2
1 2
2 1
3 4
5 1

Output

1 0

Note

In the first test sample the first marker should be closed by the fourth cap, the second marker should be closed by the first cap and the third marker should be closed by the second cap. Thus, three markers will be closed, and two of them will be beautifully closed — the first and the third markers.

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 100001;
int sm[MAXN], sc[MAXN];
int main(int argc, char const* argv[]) {
  int n, m;
  scanf("%d%d", &n, &m);
  map<int, map<int, int> > markers, caps;
  int a, b;
  for (int i = 0; i < n; ++i) {
    scanf("%d%d", &a, &b);
    ++sm[b];
    ++markers[b][a];
  }
  for (int i = 0; i < m; ++i) {
    scanf("%d%d", &a, &b);
    ++sc[b];
    ++caps[b][a];
  }
  int rc = 0, rb = 0;
  for (map<int, map<int, int> >::iterator it = markers.begin();
       it != markers.end(); ++it) {
    int size = it->first;
    if (sc[size] == 0) continue;
    rc += min(sm[size], sc[size]);
    map<int, int>&mm = it->second, mc = caps[size];
    for (map<int, int>::iterator itt = mm.begin(); itt != mm.end(); ++itt) {
      rb += min(itt->second, mc[itt->first]);
    }
  }
  printf("%d %d\n", rc, rb);
  return 0;
}

```


### Prompt

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

You are playing the following game. There are n points on a plane. They are the vertices of a regular n-polygon. Points are labeled with integer numbers from 1 to n. Each pair of distinct points is connected by a diagonal, which is colored in one of 26 colors. Points are denoted by lowercase English letters. There are three stones positioned on three distinct vertices. All stones are the same. With one move you can move the stone to another free vertex along some diagonal. The color of this diagonal must be the same as the color of the diagonal, connecting another two stones.

Your goal is to move stones in such way that the only vertices occupied by stones are 1, 2 and 3. You must achieve such position using minimal number of moves. Write a program which plays this game in an optimal way.

Input

In the first line there is one integer n (3 ≤ n ≤ 70) — the number of points. In the second line there are three space-separated integer from 1 to n — numbers of vertices, where stones are initially located.

Each of the following n lines contains n symbols — the matrix denoting the colors of the diagonals. Colors are denoted by lowercase English letters. The symbol j of line i denotes the color of diagonal between points i and j. Matrix is symmetric, so j-th symbol of i-th line is equal to i-th symbol of j-th line. Main diagonal is filled with '*' symbols because there is no diagonal, connecting point to itself.

Output

If there is no way to put stones on vertices 1, 2 and 3, print -1 on a single line. Otherwise, on the first line print minimal required number of moves and in the next lines print the description of each move, one move per line. To describe a move print two integers. The point from which to remove the stone, and the point to which move the stone. If there are several optimal solutions, print any of them.

Examples

Input

4
2 3 4
*aba
a*ab
ba*b
abb*

Output

1
4 1

Input

4
2 3 4
*abc
a*ab
ba*b
cbb*

Output

-1

Note

In the first example we can move stone from point 4 to point 1 because this points are connected by the diagonal of color 'a' and the diagonal connection point 2 and 3, where the other stones are located, are connected by the diagonal of the same color. After that stones will be on the points 1, 2 and 3.

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
using fst = tuple<int, int, int>;
const int N = 75;
int n, h[N][N][N], a[3], tmp[3];
fst par[N][N][N];
string s[N];
bool vis[N][N][N];
vector<pair<int, int>> ans;
queue<fst> q;
int main() {
  ios::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
  cin >> n;
  for (int i = 0; i < 3; i++) cin >> a[i], --a[i];
  sort(a, a + 3);
  for (int i = 0; i < n; i++) cin >> s[i];
  vis[a[0]][a[1]][a[2]] = true, par[a[0]][a[1]][a[2]] = {-1, -1, -1};
  q.push({a[0], a[1], a[2]});
  while (!q.empty()) {
    tie(tmp[0], tmp[1], tmp[2]) = q.front();
    q.pop();
    for (int i = 0; i < n; i++) {
      bool flag = false;
      for (int j = 0; j < 3; j++)
        if (tmp[j] == i) flag = true;
      if (flag) continue;
      for (int j = 0; j < 3; j++)
        for (int k = j + 1; k < 3; k++) {
          a[0] = tmp[j], a[1] = tmp[k];
          a[2] = tmp[1 ^ 2 ^ j ^ k];
          if (s[a[0]][a[1]] ^ s[a[2]][i]) continue;
          a[2] = i;
          sort(a, a + 3);
          if (!vis[a[0]][a[1]][a[2]]) {
            h[a[0]][a[1]][a[2]] = h[tmp[0]][tmp[1]][tmp[2]] + 1;
            vis[a[0]][a[1]][a[2]] = true,
            par[a[0]][a[1]][a[2]] = {tmp[0], tmp[1], tmp[2]};
            q.push({a[0], a[1], a[2]});
          }
        }
    }
  }
  if (!vis[0][1][2]) return cout << "-1\n", 0;
  cout << h[0][1][2] << '\n';
  fst sv = {0, 1, 2}, sv2;
  set<int> exist;
  int res;
  while (get<0>(sv) ^ -1 || !get<0>(sv)) {
    sv2 = par[get<0>(sv)][get<1>(sv)][get<2>(sv)];
    tie(a[0], a[1], a[2]) = sv;
    if (get<0>(sv2) == -1) {
      sv = sv2;
      continue;
    }
    exist.insert(get<0>(sv2)), exist.insert(get<1>(sv2)),
        exist.insert(get<2>(sv2));
    for (int i = 0; i < 3; i++)
      exist.count(a[i]) ? exist.erase(a[i]) : res = a[i];
    ans.push_back({*exist.begin() + 1, res + 1});
    exist.clear(), sv = sv2;
  }
  reverse(ans.begin(), ans.end());
  for (auto [x, y] : ans) cout << x << ' ' << y << '\n';
}

```


### Prompt

Please formulate a cpp solution to the following problem:

There is a staircase with N steps. Takahashi is now standing at the foot of the stairs, that is, on the 0-th step. He can climb up one or two steps at a time.

However, the treads of the a_1-th, a_2-th, a_3-th, \ldots, a_M-th steps are broken, so it is dangerous to set foot on those steps.

How many are there to climb up to the top step, that is, the N-th step, without setting foot on the broken steps? Find the count modulo 1\ 000\ 000\ 007.

Constraints

* 1 \leq N \leq 10^5
* 0 \leq M \leq N-1
* 1 \leq a_1 < a_2 < ... < a_M \leq N-1

Input

Input is given from Standard Input in the following format:

N M
a_1
a_2
.
.
.
a_M

Output

Print the number of ways to climb up the stairs under the condition, modulo 1\ 000\ 000\ 007.

Examples

Input

6 1
3

Output

4

Input

10 2
4
5

Output

0

Input

100 5
1
23
45
67
89

Output

608200469

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
int mod=1000000007;
int main(){
  int n,m;
  cin >> n >> m;
  vector<int> a(m);
  vector<int> d(n+1,-1);
  d[0]=1;
  d[1]=1;
  for(int i=0;i<m;i++){
    cin >> a[i];
    d[a[i]]=0;
  }
  for(int i=2;i<=n;i++){
    if(d[i]!=0){
      d[i]=(d[i-1]+d[i-2])%mod;
    }
  }
  cout << d[n] << endl;
}
```


### Prompt

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

Dima loves making pictures on a piece of squared paper. And yet more than that Dima loves the pictures that depict one of his favorite figures.

A piece of squared paper of size n × m is represented by a table, consisting of n rows and m columns. All squares are white on blank squared paper. Dima defines a picture as an image on a blank piece of paper, obtained by painting some squares black.

The picture portrays one of Dima's favorite figures, if the following conditions hold:

  * The picture contains at least one painted cell;
  * All painted cells form a connected set, that is, you can get from any painted cell to any other one (you can move from one cell to a side-adjacent one);
  * The minimum number of moves needed to go from the painted cell at coordinates (x1, y1) to the painted cell at coordinates (x2, y2), moving only through the colored cells, equals |x1 - x2| + |y1 - y2|.

Now Dima is wondering: how many paintings are on an n × m piece of paper, that depict one of his favorite figures? Count this number modulo 1000000007 (109 + 7).

Input

The first line contains two integers n and m — the sizes of the piece of paper (1 ≤ n, m ≤ 150).

Output

In a single line print the remainder after dividing the answer to the problem by number 1000000007 (109 + 7).

Examples

Input

2 2

Output

13

Input

3 4

Output

571

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
const int N = 160, P = 1e9 + 7;
int n, m, dp[N][N][N][4];
void add(int &a, int b) {
  a += b;
  if (a >= P) a -= P;
  if (a < 0) a += P;
}
void add(int i, int x1, int y1, int x2, int y2, int op, int r) {
  ++x2, ++y2;
  add(dp[i][x1][y1][op], r);
  add(dp[i][x1][y2][op], -r);
  add(dp[i][x2][y1][op], -r);
  add(dp[i][x2][y2][op], r);
}
int main() {
  scanf("%d%d", &n, &m);
  add(1, 1, 1, m, m, 0, 1);
  int ans = 0;
  for (int i = 1; i <= n + 1; ++i)
    for (int l = 1; l <= m; ++l)
      for (int r = 1; r <= m; ++r)
        for (int z = 0; z <= 3; ++z) {
          int &ret = dp[i - 1][l][r][z];
          add(ret, dp[i - 1][l - 1][r][z]);
          add(ret, dp[i - 1][l][r - 1][z]);
          add(ret, -dp[i - 1][l - 1][r - 1][z]);
          if (!ret || l > r) continue;
          ans = (ans + (long long)(n + 2 - i) * ret) % P;
          if (i == n + 1) continue;
          if (z == 0) {
            add(i, 1, r, l, m, 0, ret);
            if (l + 1 <= r) add(i, l + 1, r, r, m, 1, ret);
            if (l <= r - 1) add(i, 1, l, l, r - 1, 2, ret);
            if (l + 1 <= r - 1) add(i, l + 1, l + 1, r, r - 1, 3, ret);
          } else if (z == 1) {
            add(i, l, r, r, m, 1, ret);
            if (l <= r - 1) add(i, l, l, r, r - 1, 3, ret);
          } else if (z == 2) {
            add(i, 1, l, l, r, 2, ret);
            if (l + 1 <= r) add(i, l + 1, l + 1, r, r, 3, ret);
          } else if (z == 3) {
            add(i, l, l, r, r, 3, ret);
          }
        }
  printf("%d\n", ans);
}

```


### Prompt

Please create a solution in CPP to the following problem:

Vasya became interested in bioinformatics. He's going to write an article about similar cyclic DNA sequences, so he invented a new method for determining the similarity of cyclic sequences.

Let's assume that strings s and t have the same length n, then the function h(s, t) is defined as the number of positions in which the respective symbols of s and t are the same. Function h(s, t) can be used to define the function of Vasya distance ρ(s, t):

<image> where <image> is obtained from string s, by applying left circular shift i times. For example, ρ("AGC", "CGT") =  h("AGC", "CGT") + h("AGC", "GTC") + h("AGC", "TCG") +  h("GCA", "CGT") + h("GCA", "GTC") + h("GCA", "TCG") +  h("CAG", "CGT") + h("CAG", "GTC") + h("CAG", "TCG") =  1 + 1 + 0 + 0 + 1 + 1 + 1 + 0 + 1 = 6

Vasya found a string s of length n on the Internet. Now he wants to count how many strings t there are such that the Vasya distance from the string s attains maximum possible value. Formally speaking, t must satisfy the equation: <image>.

Vasya could not try all possible strings to find an answer, so he needs your help. As the answer may be very large, count the number of such strings modulo 109 + 7.

Input

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

The second line of the input contains a single string of length n, consisting of characters "ACGT".

Output

Print a single number — the answer modulo 109 + 7.

Examples

Input

1
C

Output

1

Input

2
AG

Output

4

Input

3
TTT

Output

1

Note

Please note that if for two distinct strings t1 and t2 values ρ(s, t1) и ρ(s, t2) are maximum among all possible t, then both strings must be taken into account in the answer even if one of them can be obtained by a circular shift of another one.

In the first sample, there is ρ("C", "C") = 1, for the remaining strings t of length 1 the value of ρ(s, t) is 0.

In the second sample, ρ("AG", "AG") = ρ("AG", "GA") = ρ("AG", "AA") = ρ("AG", "GG") = 4.

In the third sample, ρ("TTT", "TTT") = 27

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n;
  string str;
  cin >> n >> str;
  int freq[0x100];
  memset(freq, 0, sizeof(freq));
  for (int i = 0; i < n; i++) freq[(int)str[i]]++;
  int maxFreq = max(max(freq['A'], freq['C']), max(freq['G'], freq['T']));
  int k = (freq['A'] == maxFreq) + (freq['C'] == maxFreq) +
          (freq['G'] == maxFreq) + (freq['T'] == maxFreq);
  long long ans = 1;
  for (int i = 0; i < n; i++) ans = (ans * k) % 1000000007;
  cout << ans << endl;
  return 0;
}

```


### Prompt

Construct a cpp code solution to the problem outlined:

Two players play a simple game. Each player is provided with a box with balls. First player's box contains exactly n1 balls and second player's box contains exactly n2 balls. In one move first player can take from 1 to k1 balls from his box and throw them away. Similarly, the second player can take from 1 to k2 balls from his box in his move. Players alternate turns and the first player starts the game. The one who can't make a move loses. Your task is to determine who wins if both players play optimally.

Input

The first line contains four integers n1, n2, k1, k2. All numbers in the input are from 1 to 50.

This problem doesn't have subproblems. You will get 3 points for the correct submission.

Output

Output "First" if the first player wins and "Second" otherwise.

Examples

Input

2 2 1 2

Output

Second

Input

2 1 1 1

Output

First

Note

Consider the first sample test. Each player has a box with 2 balls. The first player draws a single ball from his box in one move and the second player can either take 1 or 2 balls from his box in one move. No matter how the first player acts, the second player can always win if he plays wisely.

### Response

```cpp
#include <bits/stdc++.h>
double EPS = 1e-9;
long long INFF = 1000000000000000005LL;
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  ;
  int n1, n2, k1, k2;
  cin >> n1 >> n2 >> k1 >> k2;
  if (n2 >= n1) {
    cout << "Second" << '\n';
  } else {
    cout << "First" << '\n';
  }
  return 0;
}

```


### Prompt

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

The Little Elephant enjoys recursive functions.

This time he enjoys the sorting function. Let a is a permutation of an integers from 1 to n, inclusive, and ai denotes the i-th element of the permutation. The Little Elephant's recursive function f(x), that sorts the first x permutation's elements, works as follows:

  * If x = 1, exit the function.
  * Otherwise, call f(x - 1), and then make swap(ax - 1, ax) (swap the x-th and (x - 1)-th elements of a).

The Little Elephant's teacher believes that this function does not work correctly. But that-be do not get an F, the Little Elephant wants to show the performance of its function. Help him, find a permutation of numbers from 1 to n, such that after performing the Little Elephant's function (that is call f(n)), the permutation will be sorted in ascending order.

Input

A single line contains integer n (1 ≤ n ≤ 1000) — the size of permutation.

Output

In a single line print n distinct integers from 1 to n — the required permutation. Numbers in a line should be separated by spaces.

It is guaranteed that the answer exists.

Examples

Input

1

Output

1

Input

2

Output

2 1

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  cout << n;
  for (int i = 1; i < n; i++) cout << " " << i;
}

```


### Prompt

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

A robber has attempted to rob a bank but failed to complete his task. However, he had managed to open all the safes.

Oleg the bank client loves money (who doesn't), and decides to take advantage of this failed robbery and steal some money from the safes. There are many safes arranged in a line, where the i-th safe from the left is called safe i. There are n banknotes left in all the safes in total. The i-th banknote is in safe xi. Oleg is now at safe a. There are two security guards, one of which guards the safe b such that b < a, i.e. the first guard is to the left of Oleg. The other guard guards the safe c so that c > a, i.e. he is to the right of Oleg.

The two guards are very lazy, so they do not move. In every second, Oleg can either take all the banknotes from the current safe or move to any of the neighboring safes. However, he cannot visit any safe that is guarded by security guards at any time, becaues he might be charged for stealing. Determine the maximum amount of banknotes Oleg can gather.

Input

The first line of input contains three space-separated integers, a, b and c (1 ≤ b < a < c ≤ 109), denoting the positions of Oleg, the first security guard and the second security guard, respectively.

The next line of input contains a single integer n (1 ≤ n ≤ 105), denoting the number of banknotes.

The next line of input contains n space-separated integers x1, x2, ..., xn (1 ≤ xi ≤ 109), denoting that the i-th banknote is located in the xi-th safe. Note that xi are not guaranteed to be distinct.

Output

Output a single integer: the maximum number of banknotes Oleg can take.

Examples

Input

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

Output

4

Input

6 5 7
5
1 5 7 92 3

Output

0

Note

In the first example Oleg can take the banknotes in positions 4, 5, 6 (note that there are 2 banknotes at position 5). Oleg can't take the banknotes in safes 7 and 8 because he can't run into the second security guard. Similarly, Oleg cannot take the banknotes at positions 3 and 2 because he can't run into the first security guard. Thus, he can take a maximum of 4 banknotes.

For the second sample, Oleg can't take any banknotes without bumping into any of the security guards.

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
int b, a, c, n, x, ans;
int main() {
  scanf("%d%d%d%d", &a, &b, &c, &n);
  while (n--) {
    scanf("%d", &x);
    if (x > b && x < c) ans++;
  }
  printf("%d\n", ans);
  return 0;
}

```


### Prompt

Develop a solution in Cpp to the problem described below:

You are given a tree (an undirected connected graph without cycles) and an integer s.

Vanya wants to put weights on all edges of the tree so that all weights are non-negative real numbers and their sum is s. At the same time, he wants to make the diameter of the tree as small as possible.

Let's define the diameter of a weighed tree as the maximum sum of the weights of the edges lying on the path between two some vertices of the tree. In other words, the diameter of a weighed tree is the length of the longest simple path in the tree, where length of a path is equal to the sum of weights over all edges in the path.

Find the minimum possible diameter that Vanya can get.

Input

The first line contains two integer numbers n and s (2 ≤ n ≤ 10^5, 1 ≤ s ≤ 10^9) — the number of vertices in the tree and the sum of edge weights.

Each of the following n−1 lines contains two space-separated integer numbers a_i and b_i (1 ≤ a_i, b_i ≤ n, a_i ≠ b_i) — the indexes of vertices connected by an edge. The edges are undirected.

It is guaranteed that the given edges form a tree.

Output

Print the minimum diameter of the tree that Vanya can get by placing some non-negative real weights on its edges with the sum equal to s.

Your answer will be considered correct if its absolute or relative error does not exceed 10^{-6}.

Formally, let your answer be a, and the jury's answer be b. Your answer is considered correct if \frac {|a-b|} {max(1, b)} ≤ 10^{-6}.

Examples

Input

4 3
1 2
1 3
1 4

Output

2.000000000000000000

Input

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

Output

0.500000000000000000

Input

5 5
1 2
2 3
3 4
3 5

Output

3.333333333333333333

Note

In the first example it is necessary to put weights like this:

<image>

It is easy to see that the diameter of this tree is 2. It can be proved that it is the minimum possible diameter.

In the second example it is necessary to put weights like this:

<image>

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
int n, s;
vector<int> a[100000 + 5];
int X[100000 + 5], Y[100000 + 5];
int main() {
  scanf("%d", &n), scanf("%d", &s);
  for (int i = 1; i < n; i++) {
    scanf("%d", &X[i]), scanf("%d", &Y[i]);
    a[X[i]].push_back(Y[i]);
    a[Y[i]].push_back(X[i]);
  }
  int cnt = 0;
  for (int i = 1; i <= n; i++) {
    if (a[i].size() == 1) cnt++;
  }
  double ans = (double)s * 2 / cnt;
  printf("%.18lf\n", ans);
  return 0;
}

```


### Prompt

Please formulate a Cpp solution to the following problem:

You are given an array a consisting of n integers. In one move, you can jump from the position i to the position i - a_i (if 1 ≤ i - a_i) or to the position i + a_i (if i + a_i ≤ n).

For each position i from 1 to n you want to know the minimum the number of moves required to reach any position j such that a_j has the opposite parity from a_i (i.e. if a_i is odd then a_j has to be even and vice versa).

Input

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

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

Output

Print n integers d_1, d_2, ..., d_n, where d_i is the minimum the number of moves required to reach any position j such that a_j has the opposite parity from a_i (i.e. if a_i is odd then a_j has to be even and vice versa) or -1 if it is impossible to reach such a position.

Example

Input

10
4 5 7 6 7 5 4 4 6 4

Output

1 1 1 2 -1 1 1 3 1 1

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
int n, a[200005], dp[200005], vis[200005];
std::vector<int> v[200005];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    dp[i] = n;
    vis[i] = 0;
    if (i - a[i] >= 0) v[i - a[i]].push_back(i);
    if (i + a[i] < n) v[i + a[i]].push_back(i);
  }
  vector<int> v1, v2;
  v1.clear();
  v2.clear();
  for (int i = 0; i < n; i++) {
    if (i - a[i] >= 0 && a[i] % 2 != a[i - a[i]] % 2) {
      dp[i] = 1;
      v1.push_back(i);
    } else if (i + a[i] < n && a[i] % 2 != a[i + a[i]] % 2) {
      dp[i] = 1;
      v1.push_back(i);
    }
  }
  int cnt = 2;
  while (!v1.empty()) {
    for (int j : v1) {
      for (int k : v[j]) {
        if (dp[k] > cnt) {
          dp[k] = cnt;
          v2.push_back(k);
        }
      }
    }
    v1 = v2;
    v2.clear();
    cnt++;
  }
  for (int i = 0; i < n; i++) {
    if (dp[i] >= n)
      cout << "-1 ";
    else
      cout << dp[i] << " ";
  }
  return 0;
}

```


### Prompt

Please create a solution in CPP to the following problem:

Ania has a large integer S. Its decimal representation has length n and doesn't contain any leading zeroes. Ania is allowed to change at most k digits of S. She wants to do it in such a way that S still won't contain any leading zeroes and it'll be minimal possible. What integer will Ania finish with?

Input

The first line contains two integers n and k (1 ≤ n ≤ 200 000, 0 ≤ k ≤ n) — the number of digits in the decimal representation of S and the maximum allowed number of changed digits.

The second line contains the integer S. It's guaranteed that S has exactly n digits and doesn't contain any leading zeroes.

Output

Output the minimal possible value of S which Ania can end with. Note that the resulting integer should also have n digits.

Examples

Input

5 3
51528

Output

10028

Input

3 2
102

Output

100

Input

1 1
1

Output

0

Note

A number has leading zeroes if it consists of at least two digits and its first digit is 0. For example, numbers 00, 00069 and 0101 have leading zeroes, while 0, 3000 and 1010 don't have leading zeroes.

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
void ayushmehta651() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
}
long long magic() {
  long long n, k;
  cin >> n >> k;
  string s;
  cin >> s;
  if (n == 1) {
    if (k)
      cout << 0 << '\n';
    else
      cout << s << '\n';
    return 0;
  }
  if (s[0] != '1' and k) {
    s[0] = '1';
    k -= 1;
  }
  for (long long i = 1; i < s.length() and k; ++i) {
    if (s[i] != '0') {
      s[i] = '0';
      k -= 1;
    }
  }
  cout << s << '\n';
  return 0;
}
int32_t main() {
  ayushmehta651();
  magic();
  return 0;
}

```


### Prompt

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

Given are integers A, B, and N.

Find the maximum possible value of floor(Ax/B) - A × floor(x/B) for a non-negative integer x not greater than N.

Here floor(t) denotes the greatest integer not greater than the real number t.

Constraints

* 1 ≤ A ≤ 10^{6}
* 1 ≤ B ≤ 10^{12}
* 1 ≤ N ≤ 10^{12}
* All values in input are integers.

Input

Input is given from Standard Input in the following format:

A B N

Output

Print the maximum possible value of floor(Ax/B) - A × floor(x/B) for a non-negative integer x not greater than N, as an integer.

Examples

Input

5 7 4

Output

2

Input

11 10 9

Output

9

### Response

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

int main(){
  long a, b, n;
  cin >> a >> b >> n;
  cout << a*min(n, b-1)/b;
  return 0;
}

```


### Prompt

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

There are N balls in a two-dimensional plane. The i-th ball is at coordinates (x_i, y_i).

We will collect all of these balls, by choosing two integers p and q such that p \neq 0 or q \neq 0 and then repeating the following operation:

* Choose a ball remaining in the plane and collect it. Let (a, b) be the coordinates of this ball. If we collected a ball at coordinates (a - p, b - q) in the previous operation, the cost of this operation is 0. Otherwise, including when this is the first time to do this operation, the cost of this operation is 1.

Find the minimum total cost required to collect all the balls when we optimally choose p and q.

Constraints

* 1 \leq N \leq 50
* |x_i|, |y_i| \leq 10^9
* If i \neq j, x_i \neq x_j or y_i \neq y_j.
* All values in input are integers.

Input

Input is given from Standard Input in the following format:

N
x_1 y_1
:
x_N y_N

Output

Print the minimum total cost required to collect all the balls.

Examples

Input

2
1 1
2 2

Output

1

Input

3
1 4
4 6
7 8

Output

1

Input

4
1 1
1 2
2 1
2 2

Output

2

### Response

```cpp
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
const int INF = 1<<30;

int main(){
  int n;cin>>n;
  map<pair<int, int>, int> mp;
  vector<pair<int, int>> vec(n);
  for(int i=0;i<n;i++){
    int x, y;cin>>x>>y;
    vec[i]=make_pair(x, y);
  }
  for(int i=0;i<n;i++){
  	for(int j=0;j<n;j++){
      if(i==j)continue;
      mp[make_pair(vec[j].first-vec[i].first, vec[j].second-vec[i].second)]++;
    }
  }
  int m=0;
  for(auto itr=mp.begin();itr!=mp.end();itr++){
  	m=max(m, itr->second);
  }
  cout<<n-m<<endl;
}

```


### Prompt

Create a solution in CPP for the following problem:

On Bertown's main street n trees are growing, the tree number i has the height of ai meters (1 ≤ i ≤ n). By the arrival of the President of Berland these trees were decided to be changed so that their heights formed a beautiful sequence. This means that the heights of trees on ends (the 1st one and the n-th one) should be equal to each other, the heights of the 2-nd and the (n - 1)-th tree must also be equal to each other, at that the height of the 2-nd tree should be larger than the height of the first tree by 1, and so on. In other words, the heights of the trees, standing at equal distance from the edge (of one end of the sequence) must be equal to each other, and with the increasing of the distance from the edge by 1 the tree height must also increase by 1. For example, the sequences "2 3 4 5 5 4 3 2" and "1 2 3 2 1" are beautiful, and '1 3 3 1" and "1 2 3 1" are not.

Changing the height of a tree is a very expensive operation, using advanced technologies invented by Berland scientists. In one operation you can choose any tree and change its height to any number, either increase or decrease. Note that even after the change the height should remain a positive integer, i. e, it can't be less than or equal to zero. Identify the smallest number of changes of the trees' height needed for the sequence of their heights to become beautiful.

Input

The first line contains integer n (1 ≤ n ≤ 105) which is the number of trees. The second line contains integers ai (1 ≤ ai ≤ 105) which are the heights of the trees.

Output

Print a single number which is the minimal number of trees whose heights will have to be changed for the sequence to become beautiful.

Examples

Input

3
2 2 2

Output

1

Input

4
1 2 2 1

Output

0

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
int a[100005], n, x, y, ans;
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> x;
    if (i <= n / 2)
      y = i;
    else
      y = n - i + 1;
    if (x - y >= 0) {
      a[x - y]++;
      if (a[x - y] > ans) ans = a[x - y];
    }
  }
  cout << n - ans << endl;
  return 0;
}

```


### Prompt

Create a solution in CPP for the following problem:

This is the easy version of the problem. The difference between the versions is in the constraints on the array elements. You can make hacks only if all versions of the problem are solved.

You are given an array [a_1, a_2, ..., a_n].

Your goal is to find the length of the longest subarray of this array such that the most frequent value in it is not unique. In other words, you are looking for a subarray such that if the most frequent value occurs f times in this subarray, then at least 2 different values should occur exactly f times.

An array c is a subarray of an array d if c can be obtained from d by deletion of several (possibly, zero or all) elements from the beginning and several (possibly, zero or all) elements from the end.

Input

The first line contains a single integer n (1 ≤ n ≤ 200 000) — the length of the array.

The second line contains n integers a_1, a_2, …, a_n (1 ≤ a_i ≤ min(n, 100)) — elements of the array.

Output

You should output exactly one integer — the length of the longest subarray of the array whose most frequent value is not unique. If there is no such subarray, output 0.

Examples

Input

7
1 1 2 2 3 3 3

Output

6

Input

10
1 1 1 5 4 1 3 1 2 2

Output

7

Input

1
1

Output

0

Note

In the first sample, the subarray [1, 1, 2, 2, 3, 3] is good, but [1, 1, 2, 2, 3, 3, 3] isn't: in the latter there are 3 occurrences of number 3, and no other element appears 3 times.

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
int solve(int a, int b, vector<int> &v) {
  int balance = 0, n = v.size();
  vector<int> fst(1 + n + n, -2);
  int ans = 0;
  fst[n] = -1;
  for (int i = 0; i < n; i++) {
    if (v[i] == a) balance++;
    if (v[i] == b) balance--;
    if (fst[n + balance] >= -1)
      ans = max(ans, i - fst[n + balance]);
    else
      fst[n + balance] = i;
  }
  return ans;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  vector<int> v(n), freq(101);
  for (int i = 0; i < n; i++) cin >> v[i], freq[v[i]]++;
  int mx = 0;
  for (int i = 1; i <= 100; i++)
    if (freq[mx] < freq[i]) mx = i;
  int ans = 0;
  for (int i = 1; i <= 100; i++)
    if (i != mx) ans = max(ans, solve(mx, i, v));
  cout << ans << "\n";
  return 0;
}

```


### Prompt

Develop a solution in CPP to the problem described below:

Sugoroku

problem

JOI is playing sugoroku alone. There are N squares in a straight line in this sugoroku, and each has a movement instruction written on it. The starting point is the 1st square and the goal is the Nth square. JOI repeats the following until he reaches the goal.

Roll the dice and proceed from the current square by the number of rolls, and follow the instructions of that square. Do not follow the instructions of the square to which you moved according to the instructions.

The goal is not only when you stop at the Nth square, but also when the destination exceeds the Nth square.

Create a program that outputs how many times you roll the dice to reach the goal when you are given a sugoroku board and M dice rolls.

input

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

Each dataset consists of 1 + N + M rows.

Two integers N, M (2 ≤ N ≤ 1000, 1 ≤ M ≤ 1000) are written on the first line of the input, separated by blanks. N represents the number of sugoroku squares, and M represents the number of dice given.

In the following N lines, integers between -999 and 999 are written one by one. The integer on the 1 + i line (1 ≤ i ≤ N) represents the indication of the sugoroku i-th cell. Let X be the written integer. When X = 0, it indicates "do nothing", when X> 0, it indicates "advance X mass", and when X <0, it indicates "| X | mass return". However, | X | represents the absolute value of X.

In the following M line, integers from 1 to 6 are written one by one, and the number on the 1 + N + j line (1 ≤ j ≤ M) represents the dice roll that appears on the jth time.

However, the number of lines 2 and 1 + N is always 0. There is no cell with instructions to move to the cell before the first cell. In addition, the number of times the dice are rolled is M or less in any scoring input data.

When both N and M are 0, it indicates the end of input. The number of data sets does not exceed 5.

output

For each data set, an integer indicating how many times the dice are rolled to reach the goal is output on one line.

Input / output example

Input example

10 5
0
0
Five
6
-3
8
1
8
-Four
0
1
3
Five
1
Five
10 10
0
-1
-1
Four
Four
-Five
0
1
-6
0
1
Five
2
Four
6
Five
Five
Four
1
6
0 0

Output example

Five
6

The following figure shows the first input example.
<image>

The following figure shows the second input example.
<image>

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

Example

Input

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

Output

5
6

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;

int N, M;

void solve() {
    vector<int> v(N), d(M);
    for (auto& i : v) cin >> i;
    for (auto& i : d) cin >> i;

    int start = 0;
    int ans = 0;
    for (int i = 0; i < M; i++) {
        if (start >= N) break;
        ans++;
        start = d[i] + start + v[d[i] + start];
    }

    cout << ans << endl;
}

int main() {
    while (cin >> N >> M, N || M) solve();
}
```


### Prompt

Develop a solution in Cpp to the problem described below:

One Big Software Company has n employees numbered from 1 to n. The director is assigned number 1. Every employee of the company except the director has exactly one immediate superior. The director, of course, doesn't have a superior.

We will call person a a subordinates of another person b, if either b is an immediate supervisor of a, or the immediate supervisor of a is a subordinate to person b. In particular, subordinates of the head are all other employees of the company.

To solve achieve an Important Goal we need to form a workgroup. Every person has some efficiency, expressed by a positive integer ai, where i is the person's number. The efficiency of the workgroup is defined as the total efficiency of all the people included in it.

The employees of the big software company are obsessed with modern ways of work process organization. Today pair programming is at the peak of popularity, so the workgroup should be formed with the following condition. Each person entering the workgroup should be able to sort all of his subordinates who are also in the workgroup into pairs. In other words, for each of the members of the workgroup the number of his subordinates within the workgroup should be even.

Your task is to determine the maximum possible efficiency of the workgroup formed at observing the given condition. Any person including the director of company can enter the workgroup.

Input

The first line contains integer n (1 ≤ n ≤ 2·105) — the number of workers of the Big Software Company.

Then n lines follow, describing the company employees. The i-th line contains two integers pi, ai (1 ≤ ai ≤ 105) — the number of the person who is the i-th employee's immediate superior and i-th employee's efficiency. For the director p1 = - 1, for all other people the condition 1 ≤ pi < i is fulfilled.

Output

Print a single integer — the maximum possible efficiency of the workgroup.

Examples

Input

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

Output

17

Note

In the sample test the most effective way is to make a workgroup from employees number 1, 2, 4, 5, 6.

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
vector<int> adj[200010];
int val[200010];
long long ans[200010][3];
inline void dfs(int u) {
  long long temp[2] = {0, 0};
  for (int i = 0; i < adj[u].size(); i++) {
    int v = adj[u][i];
    dfs(v);
    if (i) {
      long long t0, t1;
      t0 = max(temp[0] + ans[v][0], temp[1] + max(ans[v][2], ans[v][1]));
      t1 = max(temp[1] + ans[v][0], temp[0] + max(ans[v][2], ans[v][1]));
      temp[0] = t0;
      temp[1] = t1;
    } else {
      temp[0] = ans[v][0];
      temp[1] = max(ans[v][1], ans[v][2]);
    }
  }
  ans[u][0] = temp[0];
  ans[u][1] = temp[1];
  ans[u][2] = temp[0] + val[u];
}
int main() {
  int n, p, root;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    scanf("%d%d", &p, val + i);
    if (p == -1) {
      root = i;
      continue;
    }
    adj[p].push_back(i);
  }
  dfs(root);
  long long res = 0;
  for (int i = 0; i < 3; i++) res = max(res, ans[root][i]);
  cout << res << endl;
  return 0;
}

```


### Prompt

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

Barney is standing in a bar and starring at a pretty girl. He wants to shoot her with his heart arrow but he needs to know the distance between him and the girl to make his shot accurate.

<image>

Barney asked the bar tender Carl about this distance value, but Carl was so busy talking to the customers so he wrote the distance value (it's a real number) on a napkin. The problem is that he wrote it in scientific notation. The scientific notation of some real number x is the notation of form AeB, where A is a real number and B is an integer and x = A × 10B is true. In our case A is between 0 and 9 and B is non-negative.

Barney doesn't know anything about scientific notation (as well as anything scientific at all). So he asked you to tell him the distance value in usual decimal representation with minimal number of digits after the decimal point (and no decimal point if it is an integer). See the output format for better understanding.

Input

The first and only line of input contains a single string of form a.deb where a, d and b are integers and e is usual character 'e' (0 ≤ a ≤ 9, 0 ≤ d < 10100, 0 ≤ b ≤ 100) — the scientific notation of the desired distance value.

a and b contain no leading zeros and d contains no trailing zeros (but may be equal to 0). Also, b can not be non-zero if a is zero.

Output

Print the only real number x (the desired distance value) in the only line in its decimal notation.

Thus if x is an integer, print it's integer value without decimal part and decimal point and without leading zeroes.

Otherwise print x in a form of p.q such that p is an integer that have no leading zeroes (but may be equal to zero), and q is an integer that have no trailing zeroes (and may not be equal to zero).

Examples

Input

8.549e2

Output

854.9

Input

8.549e3

Output

8549

Input

0.33e0

Output

0.33

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
int N(int n) {
  int ans = 0;
  for (; n > 0; n /= 10) {
    ans += n % 10;
  }
  return ans;
}
int main() {
  string s, ans = "";
  cin >> s;
  int n = s.size(), b, q;
  if (s[n - 2] == 'e') q = 1, b = s[n - 1] - '0';
  if (s[n - 3] == 'e') q = 2, b = s[n - 1] - '0' + (s[n - 2] - '0') * 10;
  if (s[n - 4] == 'e')
    q = 3, b = s[n - 1] - '0' + (s[n - 2] - '0') * 10 + (s[n - 3] - '0') * 100;
  cout << s[0];
  s = s.substr(2, n - 3 - q);
  int i = 0;
  if (!(s == "0"))
    for (i = 0; i < s.size(); i++) {
      if (i == b) cout << '.';
      cout << s[i];
    }
  for (; i < b; i++) cout << "0";
  return 0;
}

```