### Prompt

Construct a cpp code solution to the problem outlined:

One quite ordinary day Valera went to school (there's nowhere else he should go on a week day). In a maths lesson his favorite teacher Ms. Evans told students about divisors. Despite the fact that Valera loved math, he didn't find this particular topic interesting. Even more, it seemed so boring that he fell asleep in the middle of a lesson. And only a loud ringing of a school bell could interrupt his sweet dream.

Of course, the valuable material and the teacher's explanations were lost. However, Valera will one way or another have to do the homework. As he does not know the new material absolutely, he cannot do the job himself. That's why he asked you to help. You're his best friend after all, you just cannot refuse to help.

Valera's home task has only one problem, which, though formulated in a very simple way, has not a trivial solution. Its statement looks as follows: if we consider all positive integers in the interval [a;b] then it is required to count the amount of such numbers in this interval that their smallest divisor will be a certain integer k (you do not have to consider divisor equal to one). In other words, you should count the amount of such numbers from the interval [a;b], that are not divisible by any number between 2 and k - 1 and yet are divisible by k.

Input

The first and only line contains three positive integers a, b, k (1 ≤ a ≤ b ≤ 2·109, 2 ≤ k ≤ 2·109).

Output

Print on a single line the answer to the given problem.

Examples

Input

1 10 2

Output

5

Input

12 23 3

Output

2

Input

6 19 5

Output

0

Note

Comments to the samples from the statement:

In the first sample the answer is numbers 2, 4, 6, 8, 10.

In the second one — 15, 21

In the third one there are no such numbers.

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
bool isprime(int n) {
  for (int i = 2; i * i <= n; ++i) {
    if (n % i == 0) {
      return 0;
    }
  }
  return 1;
}
int cal(int x, int p) {
  if (!isprime(p)) return 0;
  if (x < p) return 0;
  int res = x /= p;
  for (int i = 2; i < p && i <= x; i++) {
    res -= cal(x, i);
  }
  return res;
}
int main() {
  int a, b, k;
  scanf("%d%d%d", &a, &b, &k);
  printf("%d", cal(b, k) - cal(a - 1, k));
  return 0;
}

```


### Prompt

Construct a Cpp code solution to the problem outlined:

The year of 2012 is coming...

According to an ancient choradrican legend in this very year, in 2012, Diablo and his brothers Mephisto and Baal will escape from hell, and innumerable hordes of demons will enslave the human world. But seven brave heroes have already gathered on the top of a mountain Arreat to protect us mere mortals from the effect of this terrible evil.

The seven great heroes are: amazon Anka, barbarian Chapay, sorceress Cleo, druid Troll, necromancer Dracul, paladin Snowy and a professional hit girl Hexadecimal. Heroes already know how much experience will be given for each of the three megabosses: a for Mephisto, b for Diablo and c for Baal.

Here's the problem: heroes are as much as seven and megabosses are only three! Then our heroes decided to split into three teams, where each team will go to destroy their own megaboss. Each team member will receive a <image> of experience, rounded down, where x will be the amount of experience for the killed megaboss and y — the number of people in the team.

Heroes do not want to hurt each other's feelings, so they want to split into teams so that the difference between the hero who received the maximum number of experience and the hero who received the minimum number of experience were minimal. Since there can be several divisions into teams, then you need to find the one in which the total amount of liking in teams were maximum.

It is known that some heroes like others. But if hero p likes hero q, this does not mean that the hero q likes hero p. No hero likes himself.

The total amount of liking in teams is the amount of ordered pairs (p, q), such that heroes p and q are in the same group, and hero p likes hero q (but it is not important if hero q likes hero p). In case of heroes p and q likes each other and they are in the same group, this pair should be counted twice, as (p, q) and (q, p).

A team can consist even of a single hero, but it is important that every megaboss was destroyed. All heroes must be involved in the campaign against evil. None of the heroes can be in more than one team.

It is guaranteed that every hero is able to destroy any megaboss alone.

Input

The first line contains a single non-negative integer n (0 ≤ n ≤ 42) — amount of liking between the heroes. Next n lines describe liking in the form "p likes q", meaning that the hero p likes the hero q (p ≠  q). Every liking is described in the input exactly once, no hero likes himself.

In the last line are given three integers a, b and c (1 ≤ a, b, c ≤ 2·109), separated by spaces: the experience for Mephisto, the experience for Diablo and experience for Baal.

In all the pretests, except for examples from the statement, the following condition is satisfied: a = b = c.

Output

Print two integers — the minimal difference in the experience between two heroes who will receive the maximum and minimum number of experience points, and the maximal total amount of liking in teams (the number of friendships between heroes that end up in one team).

When calculating the second answer, the team division should satisfy the difference-minimizing contraint. I.e. primary you should minimize the difference in the experience and secondary you should maximize the total amount of liking.

Examples

Input

3
Troll likes Dracul
Dracul likes Anka
Snowy likes Hexadecimal
210 200 180

Output

30 3

Input

2
Anka likes Chapay
Chapay likes Anka
10000 50 50

Output

1950 2

Note

A note to first example: it the first team should be Dracul, Troll and Anka, in the second one Hexadecimal and Snowy, and in the third Cleo и Chapay.

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
map<string, int> hero;
int likes[8][8] = {0};
string str1, tmp, str2;
int a, b, c;
int perm[8] = {0, 1, 2, 3, 4, 5, 6, 7};
int main() {
  hero["Anka"] = 1;
  hero["Chapay"] = 2;
  hero["Cleo"] = 3;
  hero["Troll"] = 4;
  hero["Dracul"] = 5;
  hero["Snowy"] = 6;
  hero["Hexadecimal"] = 7;
  int n, i, minn, maxx, conta, j;
  cin >> n;
  for (i = 0; i < n; i++) {
    cin >> str1 >> tmp >> str2;
    likes[hero[str1]][hero[str2]] = 1;
  }
  cin >> a >> b >> c;
  int minFinal = 1000000000, likeFinal = -1;
  short sq1, sq2, sq3, ind;
  do {
    for (sq1 = 1; sq1 <= 5; sq1++)
      for (sq2 = 1; sq2 <= 5; sq2++)
        for (sq3 = 1; sq3 <= 5; sq3++)
          if (sq1 + sq2 + sq3 == 7) {
            ind = 0;
            minn = a / sq1;
            maxx = a / sq1;
            conta = 0;
            for (i = 1; i < sq1; i++) {
              for (j = i + 1; j <= sq1; j++) {
                if (likes[perm[ind + i]][perm[ind + j]]) conta++;
                if (likes[perm[ind + j]][perm[ind + i]]) conta++;
              }
            }
            ind += i;
            minn = min(minn, b / sq2);
            maxx = max(maxx, b / sq2);
            for (i = 1; i < sq2; i++) {
              for (j = i + 1; j <= sq2; j++) {
                if (likes[perm[ind + i]][perm[ind + j]]) conta++;
                if (likes[perm[ind + j]][perm[ind + i]]) conta++;
              }
            }
            ind += i;
            minn = min(minn, c / sq3);
            maxx = max(maxx, c / sq3);
            for (i = 1; i < sq3; i++) {
              for (j = i + 1; j <= sq3; j++) {
                if (likes[perm[ind + i]][perm[ind + j]]) conta++;
                if (likes[perm[ind + j]][perm[ind + i]]) conta++;
              }
            }
            if (maxx - minn < minFinal) {
              minFinal = maxx - minn;
              likeFinal = conta;
            } else if (maxx - minn == minFinal) {
              likeFinal = max(likeFinal, conta);
            }
          }
  } while (next_permutation(perm + 1, perm + 8));
  cout << minFinal << " " << likeFinal << endl;
  return 0;
}

```


### Prompt

Create a solution in Cpp for the following problem:

Nothing is eternal in the world, Kostya understood it on the 7-th of January when he saw partially dead four-color garland.

Now he has a goal to replace dead light bulbs, however he doesn't know how many light bulbs for each color are required. It is guaranteed that for each of four colors at least one light is working.

It is known that the garland contains light bulbs of four colors: red, blue, yellow and green. The garland is made as follows: if you take any four consecutive light bulbs then there will not be light bulbs with the same color among them. For example, the garland can look like "RYBGRYBGRY", "YBGRYBGRYBG", "BGRYB", but can not look like "BGRYG", "YBGRYBYGR" or "BGYBGY". Letters denote colors: 'R' — red, 'B' — blue, 'Y' — yellow, 'G' — green.

Using the information that for each color at least one light bulb still works count the number of dead light bulbs of each four colors.

Input

The first and the only line contains the string s (4 ≤ |s| ≤ 100), which describes the garland, the i-th symbol of which describes the color of the i-th light bulb in the order from the beginning of garland:

  * 'R' — the light bulb is red,
  * 'B' — the light bulb is blue,
  * 'Y' — the light bulb is yellow,
  * 'G' — the light bulb is green,
  * '!' — the light bulb is dead.

The string s can not contain other symbols except those five which were described.

It is guaranteed that in the given string at least once there is each of four letters 'R', 'B', 'Y' and 'G'.

It is guaranteed that the string s is correct garland with some blown light bulbs, it means that for example the line "GRBY!!!B" can not be in the input data.

Output

In the only line print four integers kr, kb, ky, kg — the number of dead light bulbs of red, blue, yellow and green colors accordingly.

Examples

Input

RYBGRYBGR

Output

0 0 0 0

Input

!RGYB

Output

0 1 0 0

Input

!!!!YGRB

Output

1 1 1 1

Input

!GB!RG!Y!

Output

2 1 1 0

Note

In the first example there are no dead light bulbs.

In the second example it is obvious that one blue bulb is blown, because it could not be light bulbs of other colors on its place according to the statements.

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
const int inf = 0x3f3f3f3f;
const double eps = 1e-8;
const int mod = 1000000007;
const double pi = acos(-1.0);
inline void gn(long long& x) {
  int sg = 1;
  char c;
  while (((c = getchar()) < '0' || c > '9') && c != '-')
    ;
  c == '-' ? (sg = -1, x = 0) : (x = c - '0');
  while ((c = getchar()) >= '0' && c <= '9') x = x * 10 + c - '0';
  x *= sg;
}
inline void gn(int& x) {
  long long t;
  gn(t);
  x = t;
}
inline void gn(unsigned long long& x) {
  long long t;
  gn(t);
  x = t;
}
long long gcd(long long a, long long b) { return a ? gcd(b % a, a) : b; }
long long powmod(long long a, long long x, long long mod) {
  long long t = 1ll;
  while (x) {
    if (x & 1) t = t * a % mod;
    a = a * a % mod;
    x >>= 1;
  }
  return t;
}
string s;
int gid(char c) {
  if (c == 'R') return 1;
  if (c == 'B') return 2;
  if (c == 'Y') return 3;
  if (c == 'G') return 4;
}
int ord[5];
int tt[5];
bool check() {
  int sz = s.length();
  for (int i = (0); i <= (sz - 1); i++) {
    if (s[i] == '!') continue;
    if (gid(s[i]) != ord[i % 4]) return false;
  }
  return true;
}
void calc() {
  memset((tt), 0, sizeof(tt));
  int sz = s.length();
  for (int i = (0); i <= (sz - 1); i++) {
    if (s[i] == '!') {
      tt[ord[i % 4]]++;
    }
  }
}
int main() {
  cin >> s;
  for (int i = (0); i <= (3); i++) ord[i] = i + 1;
  do {
    if (check()) {
      calc();
      break;
    }
  } while (next_permutation(ord, ord + 4));
  for (int i = (1); i <= (4); i++) cout << tt[i] << " ";
  return 0;
}

```


### Prompt

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

Given is an integer sequence of length N+1: A_0, A_1, A_2, \ldots, A_N. Is there a binary tree of depth N such that, for each d = 0, 1, \ldots, N, there are exactly A_d leaves at depth d? If such a tree exists, print the maximum possible number of vertices in such a tree; otherwise, print -1.

Constraints

* 0 \leq N \leq 10^5
* 0 \leq A_i \leq 10^{8} (0 \leq i \leq N)
* A_N \geq 1
* All values in input are integers.

Input

Input is given from Standard Input in the following format:

N
A_0 A_1 A_2 \cdots A_N

Output

Print the answer as an integer.

Examples

Input

3
0 1 1 2

Output

7

Input

4
0 0 1 0 2

Output

10

Input

2
0 3 1

Output

-1

Input

1
1 1

Output

-1

Input

10
0 0 1 1 2 3 5 8 13 21 34

Output

264

### Response

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

int main() {
    int N;
    std::cin >> N;

    std::vector<long long> A(N + 1);
    for (int i = 0; i <= N; i++) std::cin >> A[i];

    std::vector<long long> sum(N + 1);
    sum[N] = A[N];
    for (int i = N - 1; i >= 0; i--) {
        sum[i] = sum[i + 1] + A[i];
    }

    long long ans = 0, res = 0;
    for (int i = 0; i <= N; i++) {
        res = std::min(sum[i], res * 2 - A[i] + (i == 0 ? 1 : 0));

        if (res < 0) {
            std::cout << "-1\n";
            return 0;
        }

        ans += std::min(sum[i], res + A[i]);
    }
    std::cout << ans << "\n";
}
```


### Prompt

Construct a cpp code solution to the problem outlined:

Let N be a positive integer. You are given a string s of length N - 1, consisting of `<` and `>`.

Find the number of permutations (p_1, p_2, \ldots, p_N) of (1, 2, \ldots, N) that satisfy the following condition, modulo 10^9 + 7:

* For each i (1 \leq i \leq N - 1), p_i < p_{i + 1} if the i-th character in s is `<`, and p_i > p_{i + 1} if the i-th character in s is `>`.

Constraints

* N is an integer.
* 2 \leq N \leq 3000
* s is a string of length N - 1.
* s consists of `<` and `>`.

Input

Input is given from Standard Input in the following format:

N
s

Output

Print the number of permutations that satisfy the condition, modulo 10^9 + 7.

Examples

Input

4
<><

Output

5

Input

5
<<<<

Output

1

Input

20
>>>><>>><>><>>><<>>

Output

217136290

### Response

```cpp
#include <iostream>

using namespace std;

typedef long long ll;
ll mod = 1e9 + 7;

int main(int argc, char *argv[])
{
	int N;
	string s;
	ll from[3005], to[3005];
	ll S[3005];

	cin >> N >> s;

	for (int i = 0; i < N; i++) {
		from[i] = 1;
	}

	for (int i = 0; i < N - 1; i++) {
		for (int i = 0; i < N; i++) {
			to[i] = 0;
		}
		for (int x = 0; x < N + 1; x++) {
			S[x] = ((x ? S[x - 1] : 0) + from[x]) % mod;
		}
		for (int x = 0; x < N - 1 - i; x++) {
			if (s[i] == '>') {
				to[x] = (S[N] + mod - S[x]) % mod;
			} else {
				to[x] = S[x];
			}
		}
		swap(from, to);
	}

	cout << from[0] << endl;

	return 0;
}
```


### Prompt

Construct a CPP code solution to the problem outlined:

You are given two integers n and k. Find k-th smallest divisor of n, or report that it doesn't exist.

Divisor of n is any such natural number, that n can be divided by it without remainder.

Input

The first line contains two integers n and k (1 ≤ n ≤ 1015, 1 ≤ k ≤ 109).

Output

If n has less than k divisors, output -1.

Otherwise, output the k-th smallest divisor of n.

Examples

Input

4 2

Output

2

Input

5 3

Output

-1

Input

12 5

Output

6

Note

In the first example, number 4 has three divisors: 1, 2 and 4. The second one is 2.

In the second example, number 5 has only two divisors: 1 and 5. The third divisor doesn't exist, so the answer is -1.

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
const long long modu = 1e9 + 7;
int noofdig(int N) { return floor(log10(N)) + 1; }
int bits_count(unsigned int u) {
  unsigned int uCount;
  uCount = u - ((u >> 1) & 033333333333) - ((u >> 2) & 011111111111);
  return ((uCount + (uCount >> 3)) & 030707070707) % 63;
}
void solve() {
  long long int n, k;
  cin >> n >> k;
  vector<long long int> div;
  for (long long int i = 1; i * i <= n; i++) {
    if (n % i == 0) {
      div.push_back(i);
      if (i * i != n) div.push_back(n / i);
    }
  }
  sort(div.begin(), div.end());
  if ((long long int)div.size() >= k)
    cout << div[k - 1] << '\n';
  else
    cout << -1 << '\n';
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  srand(chrono::high_resolution_clock::now().time_since_epoch().count());
  int t = 1;
  while (t--) {
    solve();
  }
}

```


### Prompt

Please create a solution in Cpp to the following problem:

You are given a string, consisting of lowercase Latin letters.

A pair of neighbouring letters in a string is considered ugly if these letters are also neighbouring in a alphabet. For example, string "abaca" contains ugly pairs at positions (1, 2) — "ab" and (2, 3) — "ba". Letters 'a' and 'z' aren't considered neighbouring in a alphabet.

Can you rearrange the letters of a given string so that there are no ugly pairs? You can choose any order of the letters of the given string but you can't add any new letters or remove the existing ones. You can also leave the order the same.

If there are multiple answers, print any of them.

You also have to answer T separate queries.

Input

The first line contains a single integer T (1 ≤ T ≤ 100) — the number of queries.

Each of the next T lines contains string s (1 ≤ |s| ≤ 100) — the string for the next query. It is guaranteed that it contains only lowercase Latin letters.

Note that in hacks you have to set T = 1.

Output

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

If the answer for the i-th query exists, then print such a rearrangment of letters of the given string that it contains no ugly pairs. You can choose any order of the letters of the given string but you can't add any new letters or remove the existing ones. You can also leave the order the same.

If there are multiple answers, print any of them.

Otherwise print "No answer" for that query.

Example

Input

4
abcd
gg
codeforces
abaca

Output

cadb
gg
codfoerces
No answer

Note

In the first example answer "bdac" is also correct.

The second example showcases the fact that only neighbouring in alphabet letters are not allowed. The same letter is ok.

There are lots of valid answers for the third example.

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
string s;
int cnt[100];
int T;
bool check(int a, int b) { return (abs(a - b) != 1); }
void print(vector<int> a, vector<int> b) {
  for (int i = 0; i < a.size(); i++) {
    for (int j = 0; j < cnt[a[i]]; j++) cout << char(a[i] + 'a');
  }
  for (int i = 0; i < b.size(); i++) {
    for (int j = 0; j < cnt[b[i]]; j++) cout << char(b[i] + 'a');
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin >> T;
  while (T--) {
    cin >> s;
    for (int i = 0; i < 26; i++) cnt[i] = 0;
    for (int i = 0; i < s.size(); i++) cnt[s[i] - 'a']++;
    vector<int> odd, even;
    for (int i = 0; i < 26; i++)
      if (cnt[i] > 0) {
        if (i % 2 == 1)
          odd.push_back(i);
        else
          even.push_back(i);
      }
    if (odd.empty() || even.empty())
      print(odd, even);
    else if (check(even.back(), odd[0]))
      print(even, odd);
    else if (check(odd.back(), even[0]))
      print(odd, even);
    else
      cout << "No answer";
    cout << '\n';
  }
  return 0;
}

```


### Prompt

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

There are two rival donut shops.

The first shop sells donuts at retail: each donut costs a dollars.

The second shop sells donuts only in bulk: box of b donuts costs c dollars. So if you want to buy x donuts from this shop, then you have to buy the smallest number of boxes such that the total number of donuts in them is greater or equal to x.

You want to determine two positive integer values:

  1. how many donuts can you buy so that they are strictly cheaper in the first shop than in the second shop?
  2. how many donuts can you buy so that they are strictly cheaper in the second shop than in the first shop?

If any of these values doesn't exist then that value should be equal to -1. If there are multiple possible answers, then print any of them.

The printed values should be less or equal to 10^9. It can be shown that under the given constraints such values always exist if any values exist at all.

Input

The first line contains a single integer t (1 ≤ t ≤ 1000) — the number of testcases.

Each of the next t lines contains three integers a, b and c (1 ≤ a ≤ 10^9, 2 ≤ b ≤ 10^9, 1 ≤ c ≤ 10^9).

Output

For each testcase print two positive integers. For both shops print such x that buying x donuts in this shop is strictly cheaper than buying x donuts in the other shop. x should be greater than 0 and less or equal to 10^9.

If there is no such x, then print -1. If there are multiple answers, then print any of them.

Example

Input

4
5 10 4
4 5 20
2 2 3
1000000000 1000000000 1000000000

Output

-1 20
8 -1
1 2
-1 1000000000

Note

In the first testcase buying any number of donuts will be cheaper in the second shop. For example, for 3 or 5 donuts you'll have to buy a box of 10 donuts for 4 dollars. 3 or 5 donuts in the first shop would cost you 15 or 25 dollars, respectively, however. For 20 donuts you'll have to buy two boxes for 8 dollars total. Note that 3 and 5 are also valid answers for the second shop, along with many other answers.

In the second testcase buying any number of donuts will be either cheaper in the first shop or the same price. 8 donuts cost 32 dollars in the first shop and 40 dollars in the second shop (because you have to buy two boxes). 10 donuts will cost 40 dollars in both shops, so 10 is not a valid answer for any of the shops.

In the third testcase 1 donut costs 2 and 3 dollars, respectively. 2 donuts cost 4 and 3 dollars. Thus, 1 is a valid answer for the first shop and 2 is a valid answer for the second shop.

In the fourth testcase 10^9 donuts cost 10^{18} dollars in the first shop and 10^9 dollars in the second shop.

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
const long long losn = 1e6 + 5;
const long long maxn = 1e5 + 5;
const long long minn = 1e3 + 5;
const long long tiny = 1e2 + 5;
const long long inf = 1e9;
const long long mod = 1e9 + 7;
const long long hmod = 4698571;
int main() {
  long long t;
  cin >> t;
  while (t--) {
    long long a, b, c;
    cin >> a >> b >> c;
    long long nums = b * 2 - 1;
    long long an = nums * a;
    if ((an < c * 2 && nums <= inf) || a < c) {
      if (an < c * 2 && nums <= inf) {
        cout << nums << " ";
      } else {
        cout << 1 << " ";
      }
    } else {
      cout << -1 << " ";
    }
    if (a * b > c) {
      cout << b << endl;
    } else {
      cout << -1 << endl;
    }
  }
  return 0;
}

```


### Prompt

Construct a CPP code solution to the problem outlined:

There is a triangle formed by three points $(x_1, y_1)$, $(x_2, y_2)$, $(x_3, y_3)$ on a plain.

Write a program which prints "YES" if a point $P$ $(x_p, y_p)$ is in the triangle and "NO" if not.

Constraints

You can assume that:

* $ -100 \leq x_1, y_1, x_2, y_2, x_3, y_3, x_p, y_p \leq 100$
* 1.0 $\leq$ Length of each side of a tringle
* 0.001 $\leq$ Distance between $P$ and each side of a triangle

Input

Input consists of several datasets. Each dataset consists of:

$x_1$ $y_1$ $x_2$ $y_2$ $x_3$ $y_3$ $x_p$ $y_p$

All the input are real numbers. Input ends with EOF. The number of datasets is less than or equal to 100.

Output

For each dataset, print "YES" or "NO" in a line.

Example

Input

0.0 0.0 2.0 0.0 2.0 2.0 1.5 0.5
0.0 0.0 1.0 4.0 5.0 3.0 -1.0 3.0

Output

YES
NO

### Response

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

int main()
{
    double x1, y1, x2, y2, x3, y3, xp, yp;
    while(cin>>x1>>y1>>x2>>y2>>x3>>y3>>xp>>yp)
    {
        double s = ((y3-y1)*(xp-x1)+(x1-x3)*(yp-y1))/((x2-x1)*(y3-y1)-(x3-x1)*(y2-y1));
        double t = ((y1-y2)*(xp-x1)+(x2-x1)*(yp-y1))/((x2-x1)*(y3-y1)-(x3-x1)*(y2-y1));
        if( s>=0 && t>=0 && s+t<=1 ){cout << "YES\n";}
        else{cout << "NO\n"; }
    }

    return 0;
}
```


### Prompt

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

When Sasha was studying in the seventh grade, he started listening to music a lot. In order to evaluate which songs he likes more, he introduced the notion of the song's prettiness. The title of the song is a word consisting of uppercase Latin letters. The prettiness of the song is the prettiness of its title.

Let's define the simple prettiness of a word as the ratio of the number of vowels in the word to the number of all letters in the word.

Let's define the prettiness of a word as the sum of simple prettiness of all the substrings of the word.

More formally, let's define the function vowel(c) which is equal to 1, if c is a vowel, and to 0 otherwise. Let si be the i-th character of string s, and si..j be the substring of word s, staring at the i-th character and ending at the j-th character (sisi + 1... sj, i ≤ j).

Then the simple prettiness of s is defined by the formula:

<image>

The prettiness of s equals

<image>

Find the prettiness of the given song title.

We assume that the vowels are I, E, A, O, U, Y.

Input

The input contains a single string s (1 ≤ |s| ≤ 5·105) — the title of the song.

Output

Print the prettiness of the song with the absolute or relative error of at most 10 - 6.

Examples

Input

IEAIAIO

Output

28.0000000

Input

BYOB

Output

5.8333333

Input

YISVOWEL

Output

17.0500000

Note

In the first sample all letters are vowels. The simple prettiness of each substring is 1. The word of length 7 has 28 substrings. So, the prettiness of the song equals to 28.

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
char s[] = {"AEIOUY"};
const int MAXN = 5e5 + 10;
bool jd(char ch) {
  for (int i = 0; i < 6; i++)
    if (ch == s[i]) return true;
  return false;
}
int n;
long double ans = 0;
long double sum[MAXN];
char a[MAXN];
void cal(int x, int y) {
  if (x > y) return;
  if (x == y) {
    if (jd(a[x])) ans += 1;
    return;
  }
  int mid = (x + y) / 2;
  cal(x, mid);
  cal(mid + 1, y);
  int rl = y - mid;
  long double q = 0;
  for (int i = x; i <= mid; i++) {
    int l = mid - i + 1;
    int r = l + rl;
    q += sum[r] - sum[l];
    if (jd(a[i])) ans += q;
  }
  int ll = mid - x + 1;
  q = 0;
  for (int i = y; i > mid; i--) {
    int l = i - mid;
    int r = ll + l;
    q += sum[r] - sum[l];
    if (jd(a[i])) ans += q;
  }
}
int main() {
  cin >> a;
  n = strlen(a);
  sum[1] = 1;
  long double p = 1;
  for (int i = 2; i <= n; i++) {
    sum[i] = p / i;
    sum[i] += sum[i - 1];
  }
  cal(0, n - 1);
  double x = ans;
  printf("%.10f\n", x);
  return 0;
}

```


### Prompt

Please formulate a cpp solution to the following problem:

Write a program which reads a word W and a text T, and prints the number of word W which appears in text T

T consists of string Ti separated by space characters and newlines. Count the number of Ti which equals to W. The word and text are case insensitive.

Constraints

* The length of W ≤ 10
* W consists of lower case letters
* The length of T in a line ≤ 1000

Input

In the first line, the word W is given. In the following lines, the text T is given separated by space characters and newlines.

"END_OF_TEXT" indicates the end of the text.

Output

Print the number of W in the text.

Example

Input

computer
Nurtures computer scientists and highly-skilled computer engineers
who will create and exploit "knowledge" for the new era.
Provides an outstanding computer environment.
END_OF_TEXT

Output

3

### Response

```cpp
#include <iostream>
#include <string>

int main() {
	std::string s, t;
	std::cin >> s;
	for (char &c : s) c = tolower(c);

	int ans = 0;

	while (true) {
		std::cin >> t;
		if (t == "END_OF_TEXT") break;
		for (char &c : t) c = tolower(c);
		ans += (s == t);
	}

	std::cout << ans << '\n';

	return 0;
}

```


### Prompt

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

Makes solves problems on Decoforces and lots of other different online judges. Each problem is denoted by its difficulty — a positive integer number. Difficulties are measured the same across all the judges (the problem with difficulty d on Decoforces is as hard as the problem with difficulty d on any other judge).

Makes has chosen n problems to solve on Decoforces with difficulties a1, a2, ..., an. He can solve these problems in arbitrary order. Though he can solve problem i with difficulty ai only if he had already solved some problem with difficulty <image> (no matter on what online judge was it).

Before starting this chosen list of problems, Makes has already solved problems with maximum difficulty k.

With given conditions it's easy to see that Makes sometimes can't solve all the chosen problems, no matter what order he chooses. So he wants to solve some problems on other judges to finish solving problems from his list.

For every positive integer y there exist some problem with difficulty y on at least one judge besides Decoforces.

Makes can solve problems on any judge at any time, it isn't necessary to do problems from the chosen list one right after another.

Makes doesn't have too much free time, so he asked you to calculate the minimum number of problems he should solve on other judges in order to solve all the chosen problems from Decoforces.

Input

The first line contains two integer numbers n, k (1 ≤ n ≤ 103, 1 ≤ k ≤ 109).

The second line contains n space-separated integer numbers a1, a2, ..., an (1 ≤ ai ≤ 109).

Output

Print minimum number of problems Makes should solve on other judges in order to solve all chosen problems on Decoforces.

Examples

Input

3 3
2 1 9

Output

1

Input

4 20
10 3 6 3

Output

0

Note

In the first example Makes at first solves problems 1 and 2. Then in order to solve the problem with difficulty 9, he should solve problem with difficulty no less than 5. The only available are difficulties 5 and 6 on some other judge. Solving any of these will give Makes opportunity to solve problem 3.

In the second example he can solve every problem right from the start.

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n, count = 0;
  double k;
  cin >> n >> k;
  long long int upper = 2 * k;
  long long int a[n];
  for (int i = 0; i < n; i++) cin >> a[i];
  sort(a, a + n);
  for (int i = 0; i < n; i++) {
    if (upper >= a[i]) {
      upper = max(upper, 2 * a[i]);
    } else {
      while (upper < a[i]) {
        upper *= 2;
        count++;
      }
      upper = max(upper, 2 * a[i]);
    }
  }
  cout << count;
  return 0;
}

```


### Prompt

Please create a solution in cpp to the following problem:

Maxim always goes to the supermarket on Sundays. Today the supermarket has a special offer of discount systems.

There are m types of discounts. We assume that the discounts are indexed from 1 to m. To use the discount number i, the customer takes a special basket, where he puts exactly qi items he buys. Under the terms of the discount system, in addition to the items in the cart the customer can receive at most two items from the supermarket for free. The number of the "free items" (0, 1 or 2) to give is selected by the customer. The only condition imposed on the selected "free items" is as follows: each of them mustn't be more expensive than the cheapest item out of the qi items in the cart.

Maxim now needs to buy n items in the shop. Count the minimum sum of money that Maxim needs to buy them, if he use the discount system optimally well.

Please assume that the supermarket has enough carts for any actions. Maxim can use the same discount multiple times. Of course, Maxim can buy items without any discounts.

Input

The first line contains integer m (1 ≤ m ≤ 105) — the number of discount types. The second line contains m integers: q1, q2, ..., qm (1 ≤ qi ≤ 105).

The third line contains integer n (1 ≤ n ≤ 105) — the number of items Maxim needs. The fourth line contains n integers: a1, a2, ..., an (1 ≤ ai ≤ 104) — the items' prices.

The numbers in the lines are separated by single spaces.

Output

In a single line print a single integer — the answer to the problem.

Examples

Input

1
2
4
50 50 100 100

Output

200

Input

2
2 3
5
50 50 50 50 50

Output

150

Input

1
1
7
1 1 1 1 1 1 1

Output

3

Note

In the first sample Maxim needs to buy two items that cost 100 and get a discount for two free items that cost 50. In that case, Maxim is going to pay 200.

In the second sample the best strategy for Maxim is to buy 3 items and get 2 items for free using the discount. In that case, Maxim is going to pay 150.

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
int main() {
  long long m, n, q, a;
  while (scanf("%lld", &m) == 1) {
    priority_queue<long long, vector<long long>, less<long long> > Q;
    long long sum = 0;
    long long mini = 1000000000;
    while (m--) {
      scanf("%lld", &q);
      mini = min(mini, q);
    }
    scanf("%lld", &n);
    for (int i = 1; i <= n; i++) {
      scanf("%lld", &a);
      Q.push(a);
      sum = sum + a;
    }
    long long zks;
    while (n > 0) {
      if (n >= mini) {
        zks = n - mini;
        if (zks > 2) zks = 2;
        for (int u = 1; u <= mini; u++) Q.pop();
        for (int u = 1; u <= zks; u++) {
          sum = sum - Q.top();
          Q.pop();
        }
        n = n - mini - zks;
      } else
        n = 0;
    }
    printf("%lld\n", sum);
  }
}

```


### Prompt

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

There are n districts in the town, the i-th district belongs to the a_i-th bandit gang. Initially, no districts are connected to each other.

You are the mayor of the city and want to build n-1 two-way roads to connect all districts (two districts can be connected directly or through other connected districts).

If two districts belonging to the same gang are connected directly with a road, this gang will revolt.

You don't want this so your task is to build n-1 two-way roads in such a way that all districts are reachable from each other (possibly, using intermediate districts) and each pair of directly connected districts belong to different gangs, or determine that it is impossible to build n-1 roads to satisfy all the conditions.

You have to answer t independent test cases.

Input

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

The first line of the test case contains one integer n (2 ≤ n ≤ 5000) — the number of districts. The second line of the test case contains n integers a_1, a_2, …, a_n (1 ≤ a_i ≤ 10^9), where a_i is the gang the i-th district belongs to.

It is guaranteed that the sum of n does not exceed 5000 (∑ n ≤ 5000).

Output

For each test case, print:

  * NO on the only line if it is impossible to connect all districts satisfying the conditions from the problem statement.
  * YES on the first line and n-1 roads on the next n-1 lines. Each road should be presented as a pair of integers x_i and y_i (1 ≤ x_i, y_i ≤ n; x_i ≠ y_i), where x_i and y_i are two districts the i-th road connects.

For each road i, the condition a[x_i] ≠ a[y_i] should be satisfied. Also, all districts should be reachable from each other (possibly, using intermediate districts).

Example

Input

4
5
1 2 2 1 3
3
1 1 1
4
1 1000 101 1000
4
1 2 3 4

Output

YES
1 3
3 5
5 4
1 2
NO
YES
1 2
2 3
3 4
YES
1 2
1 3
1 4

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
void solve() {
  int n;
  cin >> n;
  vector<int> v(n, 0);
  for (int i = 0; i < n; i++) cin >> v[i];
  int secondGroup = -1;
  int root = 0;
  set<pair<int, int>> ht;
  for (int i = 1; i < n; i++) {
    if (v[i] != v[root]) {
      ht.insert({root + 1, i + 1});
      secondGroup = i + 1;
    }
  }
  if (secondGroup == -1) {
    cout << "NO" << endl;
    return;
  }
  cout << "YES\n";
  for (int i = 1; i < n; i++) {
    if (v[i] == v[root]) ht.insert({secondGroup, i + 1});
  }
  for (pair<int, int> edges : ht)
    cout << edges.first << " " << edges.second << endl;
}
int main() {
  ios::sync_with_stdio(false);
  int t;
  cin >> t;
  while (t--) {
    solve();
  }
  return 0;
}

```


### Prompt

Create a solution in CPP for the following problem:

Chloe, the same as Vladik, is a competitive programmer. She didn't have any problems to get to the olympiad like Vladik, but she was confused by the task proposed on the olympiad.

Let's consider the following algorithm of generating a sequence of integers. Initially we have a sequence consisting of a single element equal to 1. Then we perform (n - 1) steps. On each step we take the sequence we've got on the previous step, append it to the end of itself and insert in the middle the minimum positive integer we haven't used before. For example, we get the sequence [1, 2, 1] after the first step, the sequence [1, 2, 1, 3, 1, 2, 1] after the second step.

The task is to find the value of the element with index k (the elements are numbered from 1) in the obtained sequence, i. e. after (n - 1) steps.

Please help Chloe to solve the problem!

Input

The only line contains two integers n and k (1 ≤ n ≤ 50, 1 ≤ k ≤ 2n - 1).

Output

Print single integer — the integer at the k-th position in the obtained sequence.

Examples

Input

3 2

Output

2

Input

4 8

Output

4

Note

In the first sample the obtained sequence is [1, 2, 1, 3, 1, 2, 1]. The number on the second position is 2.

In the second sample the obtained sequence is [1, 2, 1, 3, 1, 2, 1, 4, 1, 2, 1, 3, 1, 2, 1]. The number on the eighth position is 4.

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
long long power(long long a, long long b, long long m = 1000000007) {
  long long ans = 1;
  a = a % m;
  while (b > 0) {
    if (b & 1) ans = (1ll * a * ans) % m;
    b >>= 1;
    a = (1ll * a * a) % m;
  }
  return ans;
}
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
bool cmp(pair<string, int> p1, pair<string, int> p2) {
  return p1.second > p2.second;
}
const long long MAXN = 5 * 1000 + 10;
long long x, y, d;
void extendEuclid(long long a, long long m) {
  if (m == 0) {
    d = a;
    x = 1;
    y = 0;
  } else {
    extendEuclid(m, a % m);
    long long temp = x;
    x = y;
    y = temp - (a / m) * y;
  }
}
long long modInverse(long long a, long long m) {
  extendEuclid(a, m);
  return (x % m + m) % m;
}
long long const INF = 100000000;
vector<long long> dis(100005, LONG_LONG_MAX);
vector<long long> p(100005, 0);
long long rec(long long l, long long r, long long need, long long n) {
  long long m = l + (r - l) / 2;
  if (need < m)
    return rec(l, m - 1, need, n - 1);
  else if (need > m)
    return rec(m + 1, r, need, n - 1);
  else
    return n;
}
int32_t main() {
  long long n, k;
  cin >> n >> k;
  long long sz = 1;
  for (long long i = 1; i < n; i++) sz = sz * 2 + 1LL;
  cout << rec(1, sz, k, n);
  return 0;
};

```


### Prompt

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

In this problem, we will deal with binary strings. Each character of a binary string is either a 0 or a 1. We will also deal with substrings; recall that a substring is a contiguous subsequence of a string. We denote the substring of string s starting from the l-th character and ending with the r-th character as s[l ... r]. The characters of each string are numbered from 1.

We can perform several operations on the strings we consider. Each operation is to choose a substring of our string and replace it with another string. There are two possible types of operations: replace 011 with 110, or replace 110 with 011. For example, if we apply exactly one operation to the string 110011110, it can be transformed into 011011110, 110110110, or 110011011.

Binary string a is considered reachable from binary string b if there exists a sequence s_1, s_2, ..., s_k such that s_1 = a, s_k = b, and for every i ∈ [1, k - 1], s_i can be transformed into s_{i + 1} using exactly one operation. Note that k can be equal to 1, i. e., every string is reachable from itself.

You are given a string t and q queries to it. Each query consists of three integers l_1, l_2 and len. To answer each query, you have to determine whether t[l_1 ... l_1 + len - 1] is reachable from t[l_2 ... l_2 + len - 1].

Input

The first line contains one integer n (1 ≤ n ≤ 2 ⋅ 10^5) — the length of string t.

The second line contains one string t (|t| = n). Each character of t is either 0 or 1.

The third line contains one integer q (1 ≤ q ≤ 2 ⋅ 10^5) — the number of queries.

Then q lines follow, each line represents a query. The i-th line contains three integers l_1, l_2 and len (1 ≤ l_1, l_2 ≤ |t|, 1 ≤ len ≤ |t| - max(l_1, l_2) + 1) for the i-th query.

Output

For each query, print either YES if t[l_1 ... l_1 + len - 1] is reachable from t[l_2 ... l_2 + len - 1], or NO otherwise. You may print each letter in any register.

Example

Input

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

Output

Yes
Yes
No

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
template <typename T>
struct outputer;
struct outputable {};
template <typename T>
inline auto sqr(T x) -> decltype(x * x) {
  return x * x;
}
template <typename T1, typename T2>
inline bool umx(T1& a, T2 b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <typename T1, typename T2>
inline bool umn(T1& a, T2 b) {
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}
const int N = 200000;
const int Q = 200000;
struct Input {
  int n;
  string s;
  int q;
  int l1[Q], l2[Q], len[Q];
  bool read() {
    if (!(cin >> n)) {
      return 0;
    }
    getline(cin, s);
    getline(cin, s);
    cin >> q;
    for (int i = int(0); i < int(q); ++i) {
      scanf("%d%d%d", &l1[i], &l2[i], &len[i]);
      --l1[i];
      --l2[i];
    }
    return 1;
  }
  void init(const Input& input) { *this = input; }
};
struct Data : Input {
  bool ans[Q];
  void write() {
    for (int i = int(0); i < int(q); ++i) {
      puts(ans[i] ? "Yes" : "No");
    }
  }
};
namespace Main {
const int K = 8;
struct Solution : Data {
  vector<int> pos;
  int ss;
  bool a[2][N];
  uint8_t b[2][K][(N + K - 1) / K];
  void solve() {
    for (int i = int(0); i < int(n); ++i) {
      if (s[i] == '0') {
        pos.emplace_back(i);
      }
    }
    ss = ((int)(pos).size());
    for (int t = int(0); t < int(2); ++t) {
      for (int i = int(0); i < int(ss); ++i) {
        a[t][i] = (pos[i] & 1) ^ t;
      }
    }
    memset(b, 0, sizeof b);
    for (int t = int(0); t < int(2); ++t) {
      for (int j = int(0); j < int(K); ++j) {
        for (int i = int(0); i < int(ss - j + 1); ++i) {
          b[t][j][i / K] ^= uint8_t(a[t][j + i] << (i % K));
        }
      }
    }
    for (int i = int(0); i < int(q); ++i) {
      int L1 = lower_bound((pos).begin(), (pos).end(), l1[i]) - pos.begin();
      int R1 =
          lower_bound((pos).begin(), (pos).end(), l1[i] + len[i]) - pos.begin();
      int L2 = lower_bound((pos).begin(), (pos).end(), l2[i]) - pos.begin();
      int R2 =
          lower_bound((pos).begin(), (pos).end(), l2[i] + len[i]) - pos.begin();
      bool t1 = l1[i] & 1;
      bool t2 = l2[i] & 1;
      ;
      ;
      if (R1 - L1 != R2 - L2) {
        ans[i] = 0;
        continue;
      }
      ans[i] = 1;
      while ((R1 - L1) % K) {
        if (a[t1][L1] != a[t2][L2]) {
          ans[i] = 0;
          break;
        }
        ++L1;
        ++L2;
      }
      if (!ans[i]) {
        continue;
      }
      ans[i] = 0 == memcmp(b[t1][L1 % K] + (L1 / K), b[t2][L2 % K] + (L2 / K),
                           (R1 - L1) / K);
    }
  }
  void clear() { *this = Solution(); }
};
}  // namespace Main
Main::Solution sol;
int main() {
  cout.setf(ios::showpoint | ios::fixed);
  cout.precision(20);
  sol.read();
  sol.solve();
  sol.write();
  return 0;
}

```


### Prompt

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

Nowadays all circuses in Berland have a round arena with diameter 13 meters, but in the past things were different.

In Ancient Berland arenas in circuses were shaped as a regular (equiangular) polygon, the size and the number of angles could vary from one circus to another. In each corner of the arena there was a special pillar, and the rope strung between the pillars marked the arena edges.

Recently the scientists from Berland have discovered the remains of the ancient circus arena. They found only three pillars, the others were destroyed by the time.

You are given the coordinates of these three pillars. Find out what is the smallest area that the arena could have.

Input

The input file consists of three lines, each of them contains a pair of numbers –– coordinates of the pillar. Any coordinate doesn't exceed 1000 by absolute value, and is given with at most six digits after decimal point.

Output

Output the smallest possible area of the ancient arena. This number should be accurate to at least 6 digits after the decimal point. It's guaranteed that the number of angles in the optimal polygon is not larger than 100.

Examples

Input

0.000000 0.000000
1.000000 1.000000
0.000000 1.000000

Output

1.00000000

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
const long double EPS = 1e-4;
const int inf = 1e9;
const long double PI = acos(-1);
int mod = (int)998244353;
const int MOD7 = 1000000007;
const int MOD9 = 1000000009;
const int a228 = 18;
const long long kekmod = 1791791791;
const long long bestmod = 1148822869;
const long long secmod = (int)1e9 + 113;
vector<long long> mods = {kekmod, bestmod, mod, MOD9, 1000000007};
vector<long long> hashpows = {29, 31, 37, 43, 47, 53, 179, 229};
mt19937 rnd(chrono::high_resolution_clock::now().time_since_epoch().count() +
            228 + 'i' + 'q' + 1337 + 1488);
long long MOD = mods[rnd() % mods.size()];
long long hashpow = hashpows[rand() % hashpows.size()];
long double hypot(long double a, long double b, long double c, long double d) {
  return sqrt(((a - c) * (a - c)) + ((b - d) * (b - d)));
}
long double gcd(long double a, long double b) {
  while (abs(b) > EPS) {
    a -= floor(a / b) * b;
    swap(a, b);
  }
  return a;
}
long double getang(long double a, long double b, long double c) {
  return acos(-(c * c - a * a - b * b) / (2 * a * b));
}
signed main() {
  ios_base::sync_with_stdio(0);
  cout.tie(0);
  cin.tie(0);
  srand(time(NULL));
  long double a, b, c;
  long double x1, y1, x2, y2, x3, y3;
  cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
  a = hypot(x1, y1, x2, y2);
  b = hypot(x2, y2, x3, y3);
  c = hypot(x3, y3, x1, y1);
  long double a1 = getang(a, b, c);
  long double a2 = getang(b, c, a);
  long double a3 = getang(a, c, b);
  long double mere = gcd(gcd(a1, a2), a3);
  int n = (int)((PI + EPS) / mere);
  long double R = c / sin(a1) / 2;
  long double tang = PI * 2 / n;
  long double ans = n * (0.5 * R * R * sin(tang));
  cout << fixed << setprecision(20) << ans;
}

```


### Prompt

Develop a solution in Cpp to the problem described below:

For each of the K^{NM} ways to write an integer between 1 and K (inclusive) in every square in a square grid with N rows and M columns, find the value defined below, then compute the sum of all those K^{NM} values, modulo D.

* For each of the NM squares, find the minimum among the N+M-1 integers written in the square's row or the square's column. The value defined for the grid is the product of all these NM values.

Constraints

* 1 \leq N,M,K \leq 100
* 10^8 \leq D \leq 10^9
* N,M,K, and D are integers.
* D is prime.

Input

Input is given from Standard Input in the following format:

N M K D

Output

Print the sum of the K^{NM} values, modulo D.

Examples

Input

2 2 2 998244353

Output

35

Input

2 3 4 998244353

Output

127090

Input

31 41 59 998244353

Output

827794103

### Response

```cpp
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const int N=105;
ll d[N][N],f[N][N],e[N][N],ifa[N];
ll expo(ll a,int b,ll p){
    ll c=1ll;
    while(b){
        if(b&1)c=c*a%p;
        b>>=1; a=a*a%p;
    }
    return c;
}
int main(){
    ll w=1ll,ww,p;
    int n,m,q,K,k,t,i,j,h;
    scanf("%d%d%d%lld",&n,&m,&q,&p);t=n<m?m:n;
    for(i=1;i<=t;++i)w=w*i%p;
    ifa[t]=w=expo(w,p-2ll,p);
    for(i=t;i;--i)ifa[i-1]=w=w*i%p;
    for(i=1;i<=q;++i){
        e[i][0]=w=1ll;
        for(j=1;j<=t;++j)e[i][j]=w=w*i%p;
    }
    for(i=1;i<=q;++i){
        for(j=1;j<=t;++j)if((f[i][j]=e[i][j]-e[i-1][j])<0ll)f[i][j]+=p;
    }
    d[0][0]=1ll;
    for(k=1,K=q;K;++k,--K){
        for(j=0;j<=m;++j){
            w=e[K][j]*f[k][m-j]%p;
//          printf("j=%d w=%lld\n",j,w);
            for(i=n-1;~i;--i){
                ww=d[i][j];
                for(h=i+1;h<=n;++h){
                    ww=ww*w%p;
                    d[h][j]=(d[h][j]+ww*ifa[h-i])%p;
                }
            }
        }
        /*
        printf("\nk=%d K=%d\n",k,K);
        for(i=0;i<=n;++i){
            for(j=0;j<=m;++j){
                printf("%d ",d[i][j]);
            }
            printf("\n");
        }*/
        for(i=0;i<=n;++i){
            w=f[K][i]*e[k][n-i]%p;
            for(j=m-1;~j;--j){
                ww=d[i][j];
                for(h=j+1;h<=m;++h){
                    ww=ww*w%p;
                    d[i][h]=(d[i][h]+ww*ifa[h-j])%p;
                }
            }
        }
        /*
        printf("\nk=%d K=%d\n",k,K);
        for(i=0;i<=n;++i){
            for(j=0;j<=m;++j){
                printf("%d ",d[i][j]);
            }
            printf("\n");
        }*/
    }
    w=d[n][m];
    for(i=1;i<=n;++i)w=w*i%p;
    for(i=1;i<=m;++i)w=w*i%p;
    printf("%lld",w);
    return 0;
}
```


### Prompt

Please create a solution in Cpp to the following problem:

Bob recently read about bitwise operations used in computers: AND, OR and XOR. He have studied their properties and invented a new game.

Initially, Bob chooses integer m, bit depth of the game, which means that all numbers in the game will consist of m bits. Then he asks Peter to choose some m-bit number. After that, Bob computes the values of n variables. Each variable is assigned either a constant m-bit number or result of bitwise operation. Operands of the operation may be either variables defined before, or the number, chosen by Peter. After that, Peter's score equals to the sum of all variable values.

Bob wants to know, what number Peter needs to choose to get the minimum possible score, and what number he needs to choose to get the maximum possible score. In both cases, if there are several ways to get the same score, find the minimum number, which he can choose.

Input

The first line contains two integers n and m, the number of variables and bit depth, respectively (1 ≤ n ≤ 5000; 1 ≤ m ≤ 1000).

The following n lines contain descriptions of the variables. Each line describes exactly one variable. Description has the following format: name of a new variable, space, sign ":=", space, followed by one of:

  1. Binary number of exactly m bits.
  2. The first operand, space, bitwise operation ("AND", "OR" or "XOR"), space, the second operand. Each operand is either the name of variable defined before or symbol '?', indicating the number chosen by Peter.

Variable names are strings consisting of lowercase Latin letters with length at most 10. All variable names are different.

Output

In the first line output the minimum number that should be chosen by Peter, to make the sum of all variable values minimum possible, in the second line output the minimum number that should be chosen by Peter, to make the sum of all variable values maximum possible. Both numbers should be printed as m-bit binary numbers.

Examples

Input

3 3
a := 101
b := 011
c := ? XOR b

Output

011
100

Input

5 1
a := 1
bb := 0
cx := ? OR a
d := ? XOR ?
e := d AND bb

Output

0
0

Note

In the first sample if Peter chooses a number 0112, then a = 1012, b = 0112, c = 0002, the sum of their values is 8. If he chooses the number 1002, then a = 1012, b = 0112, c = 1112, the sum of their values is 15.

For the second test, the minimum and maximum sum of variables a, bb, cx, d and e is 2, and this sum doesn't depend on the number chosen by Peter, so the minimum Peter can choose is 0.

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
const int NMax = 5e3 + 5;
const int MMax = 1e3 + 5;
int N, M;
char input[NMax][MMax + 101];
short bit[NMax][MMax][2];
char solMin[MMax], solMax[MMax];
map<string, int> ID;
struct elem {
  bool known;
  int op1, op2;
  char tor;
} v[NMax];
int compute(int, int, int);
int main() {
  cin.sync_with_stdio(false);
  cin.tie(0);
  cin >> N >> M;
  cin.getline(input[0], MMax + 100);
  for (int i = 1; i <= N; ++i) {
    cin.getline(input[i] + 1, MMax + 100);
    string name = "";
    int j = 1;
    while ('a' <= input[i][j] && input[i][j] <= 'z') {
      name += input[i][j++];
    }
    ID[name] = i;
  }
  for (int i = 1; i <= N; ++i) {
    int j = 1;
    while (input[i][j] != '=') {
      ++j;
    }
    j += 2;
    if (input[i][j] == '0' || input[i][j] == '1') {
      v[i].known = true;
      for (int k = 1; k <= M; ++k) {
        bit[i][k][0] = bit[i][k][1] = input[i][j] - '0' + 1;
        ++j;
      }
    } else {
      string str;
      if (input[i][j] == '?') {
        v[i].op1 = -1;
        ++j;
      } else {
        str = "";
        while ('a' <= input[i][j] && input[i][j] <= 'z') {
          str += input[i][j];
          ++j;
        }
        v[i].op1 = ID[str];
      }
      ++j;
      if (input[i][j] == 'A') {
        v[i].tor = '&';
        j += 3;
      } else if (input[i][j] == 'O') {
        v[i].tor = '|';
        j += 2;
      } else {
        v[i].tor = '^';
        j += 3;
      }
      ++j;
      if (input[i][j] == '?') {
        v[i].op2 = -1;
      } else {
        str = "";
        while ('a' <= input[i][j] && input[i][j] <= 'z') {
          str += input[i][j];
          ++j;
        }
        v[i].op2 = ID[str];
      }
    }
  }
  for (int b = 1; b <= M; ++b) {
    int nr1By1 = 0, nr1By0 = 0;
    for (int i = 1; i <= N; ++i) {
      nr1By1 += compute(i, b, 1);
      nr1By0 += compute(i, b, 0);
    }
    if (nr1By1 > nr1By0) {
      solMax[b] = '1';
    } else {
      solMax[b] = '0';
    }
    if (nr1By1 < nr1By0) {
      solMin[b] = '1';
    } else {
      solMin[b] = '0';
    }
  }
  cout << (solMin + 1) << '\n' << (solMax + 1);
  return 0;
}
int compute(int id, int b, int val) {
  if (bit[id][b][val] != 0) {
    return bit[id][b][val] - 1;
  }
  int f1, f2;
  if (v[id].op1 == -1) {
    f1 = val;
  } else {
    f1 = compute(v[id].op1, b, val);
  }
  if (v[id].op2 == -1) {
    f2 = val;
  } else {
    f2 = compute(v[id].op2, b, val);
  }
  int res;
  if (v[id].tor == '&') {
    res = f1 & f2;
  } else if (v[id].tor == '|') {
    res = f1 | f2;
  } else {
    res = f1 ^ f2;
  }
  bit[id][b][val] = res + 1;
  return res;
}

```


### Prompt

Generate a CPP solution to the following problem:

You are given a string s consisting of n lowercase Latin letters. Polycarp wants to remove exactly k characters (k ≤ n) from the string s. Polycarp uses the following algorithm k times:

  * if there is at least one letter 'a', remove the leftmost occurrence and stop the algorithm, otherwise go to next item;
  * if there is at least one letter 'b', remove the leftmost occurrence and stop the algorithm, otherwise go to next item;
  * ...
  * remove the leftmost occurrence of the letter 'z' and stop the algorithm.

This algorithm removes a single letter from the string. Polycarp performs this algorithm exactly k times, thus removing exactly k characters.

Help Polycarp find the resulting string.

Input

The first line of input contains two integers n and k (1 ≤ k ≤ n ≤ 4 ⋅ 10^5) — the length of the string and the number of letters Polycarp will remove.

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

Output

Print the string that will be obtained from s after Polycarp removes exactly k letters using the above algorithm k times.

If the resulting string is empty, print nothing. It is allowed to print nothing or an empty line (line break).

Examples

Input

15 3
cccaabababaccbc

Output

cccbbabaccbc

Input

15 9
cccaabababaccbc

Output

cccccc

Input

1 1
u

Output

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
int main() {
  char s[400005];
  int n, k;
  char c = 'a';
  int T[26];
  memset(T, 0, sizeof(T));
  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    scanf(" %c", &s[i]);
    T[s[i] - 'a']++;
  }
  int maxx;
  for (int i = 0; i < 26; i++) {
    if (k >= T[i])
      k -= T[i];
    else {
      maxx = i, T[i] = k;
      break;
    }
  }
  for (int i = 0; i < n; i++) {
    if (s[i] - 'a' <= maxx && T[s[i] - 'a'] > 0)
      T[s[i] - 'a']--, s[i] = '*';
    else
      printf("%c", s[i]);
  }
  printf("\n");
}

```


### Prompt

Construct a Cpp code solution to the problem outlined:

This problem is a little bit unusual. Here you are to implement an interaction with a testing system. That means that you can make queries and get responses in the online mode. Please be sure to use the stream flushing operation after each query's output in order not to leave part of your output in some buffer. For example, in C++ you've got to use the fflush(stdout) function, in Java — call System.out.flush(), and in Pascal — flush(output).

Bulls and Cows (also known as Cows and Bulls or Pigs and Bulls or Bulls and Cleots) is an old code-breaking paper and pencil game for two players, predating the similar commercially marketed board game Mastermind.

On a sheet of paper, the first player thinks a secret string. This string consists only of digits and has the length 4. The digits in the string must be all different, no two or more equal digits are allowed.

Then the second player tries to guess his opponent's string. For every guess the first player gives the number of matches. If the matching digits are on their right positions, they are "bulls", if on different positions, they are "cows". Thus a response is a pair of numbers — the number of "bulls" and the number of "cows". A try can contain equal digits.

More formally, let's the secret string is s and the second player are trying to guess it with a string x. The number of "bulls" is a number of such positions i (1 ≤ i ≤ 4) where s[i] = x[i]. The number of "cows" is a number of such digits c that s contains c in the position i (i.e. s[i] = c), x contains c, but x[i] ≠ c.

For example, the secret string is "0427", the opponent's try is "0724", then the answer is 2 bulls and 2 cows (the bulls are "0" and "2", the cows are "4" and "7"). If the secret string is "0123", the opponent's try is "0330", then the answer is 1 bull and 1 cow.

In this problem you are to guess the string s that the system has chosen. You only know that the chosen string consists of 4 distinct digits.

You can make queries to the testing system, each query is the output of a single 4-digit string. The answer to the query is the number of bulls and number of cows. If the system's response equals "4 0", that means the interaction with your problem is over and the program must terminate. That is possible for two reasons — the program either guessed the number x or made an invalid action (for example, printed letters instead of digits).

Your program is allowed to do at most 50 queries.

You can hack solutions of other participants providing a 4-digit string containing distinct digits — the secret string.

Input

To read answers to the queries, the program must use the standard input.

The program will receive pairs of non-negative integers in the input, one pair per line. The first number in a pair is a number of bulls and the second one is a number of cows of the string s and the string xi printed by your program. If the system response equals "4 0", then your solution should terminate.

The testing system will let your program read the i-th pair of integers from the input only after your program displays the corresponding system query in the output: prints value xi in a single line and executes operation flush.

Output

The program must use the standard output to print queries.

Your program must output requests — 4-digit strings x1, x2, ..., one per line. After the output of each line the program must execute flush operation. The program should read the answer to the query from the standard input.

Your program is allowed to do at most 50 queries.

Examples

Input

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

Output

8000
0179
3159
3210
0112
0123

Note

The secret string s in the example is "0123".

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
int Ans[5];
int main() {
  for (int i = 1; i <= 4; i++) {
    int mx = 0, mxw = 0;
    for (int j = 0; j <= 9; j++) {
      for (int k = 1; k < i; k++) printf("0");
      printf("%d", j);
      for (int k = i + 1; k <= 4; k++) printf("0");
      printf("\n");
      fflush(stdout);
      int x, y;
      scanf("%d%d", &x, &y);
      if (x > mx) mx = x, mxw = j;
    }
    Ans[i] = mxw;
  }
  for (int i = 1; i <= 4; i++) printf("%d", Ans[i]);
  fflush(stdout);
  return 0;
}

```


### Prompt

Construct a Cpp code solution to the problem outlined:

Recently Polycarpus has learned the "bitwise AND" operation (which is also called "AND") of non-negative integers. Now he wants to demonstrate the school IT teacher his superb manipulation with the learned operation.

For that Polycarpus came to school a little earlier and wrote on the board a sequence of non-negative integers a1, a2, ..., an. He also wrote a square matrix b of size n × n. The element of matrix b that sits in the i-th row in the j-th column (we'll denote it as bij) equals:

  * the "bitwise AND" of numbers ai and aj (that is, bij = ai & aj), if i ≠ j;
  * -1, if i = j.

Having written out matrix b, Polycarpus got very happy and wiped a off the blackboard. But the thing is, the teacher will want this sequence to check whether Polycarpus' calculations were correct. Polycarus urgently needs to restore the removed sequence of integers, or else he won't prove that he can count correctly.

Help Polycarpus, given matrix b, restore the sequence of numbers a1, a2, ..., an, that he has removed from the board. Polycarpus doesn't like large numbers, so any number in the restored sequence mustn't exceed 109.

Input

The first line contains a single integer n (1 ≤ n ≤ 100) — the size of square matrix b. Next n lines contain matrix b. The i-th of these lines contains n space-separated integers: the j-th number represents the element of matrix bij. It is guaranteed, that for all i (1 ≤ i ≤ n) the following condition fulfills: bii = -1. It is guaranteed that for all i, j (1 ≤ i, j ≤ n; i ≠ j) the following condition fulfills: 0 ≤ bij ≤ 109, bij = bji.

Output

Print n non-negative integers a1, a2, ..., an (0 ≤ ai ≤ 109) — the sequence that Polycarpus wiped off the board. Separate the numbers by whitespaces.

It is guaranteed that there is sequence a that satisfies the problem conditions. If there are multiple such sequences, you are allowed to print any of them.

Examples

Input

1
-1

Output

0

Input

3
-1 18 0
18 -1 0
0 0 -1

Output

18 18 0

Input

4
-1 128 128 128
128 -1 148 160
128 148 -1 128
128 160 128 -1

Output

128 180 148 160

Note

If you do not know what is the "bitwise AND" operation please read: http://en.wikipedia.org/wiki/Bitwise_operation.

### Response

```cpp
#include <bits/stdc++.h>
int table[105][105];
unsigned int a[105];
unsigned int power2[32];
inline void set(int ind, int pos) { a[ind] = a[ind] | power2[pos]; }
inline bool is_set(int i, int j, int pos) {
  if (table[i][j] & power2[pos])
    return true;
  else
    return false;
}
void calc() {
  int i;
  power2[0] = 1;
  for (i = 1; i < 32; i++) {
    power2[i] = 2 * power2[i - 1];
  }
}
int main() {
  int n, i, j, k;
  scanf("%d", &n);
  calc();
  for (i = 0; i < n; i++) {
    for (j = 0; j < n; j++) {
      scanf("%d", &table[i][j]);
    }
  }
  for (i = 0; i < n; i++) a[i] = 0;
  for (i = 0; i < n; i++) {
    for (j = i + 1; j < n; j++) {
      for (k = 0; k < 32; k++) {
        if (is_set(i, j, k)) {
          set(i, k);
          set(j, k);
        }
      }
    }
  }
  for (i = 0; i < n; i++) {
    printf("%d ", a[i]);
  }
}

```


### Prompt

Generate a Cpp solution to the following problem:

A family consisting of father bear, mother bear and son bear owns three cars. Father bear can climb into the largest car and he likes it. Also, mother bear can climb into the middle car and she likes it. Moreover, son bear can climb into the smallest car and he likes it. It's known that the largest car is strictly larger than the middle car, and the middle car is strictly larger than the smallest car.

Masha came to test these cars. She could climb into all cars, but she liked only the smallest car.

It's known that a character with size a can climb into some car with size b if and only if a ≤ b, he or she likes it if and only if he can climb into this car and 2a ≥ b.

You are given sizes of bears and Masha. Find out some possible integer non-negative sizes of cars.

Input

You are given four integers V1, V2, V3, Vm(1 ≤ Vi ≤ 100) — sizes of father bear, mother bear, son bear and Masha, respectively. It's guaranteed that V1 > V2 > V3.

Output

Output three integers — sizes of father bear's car, mother bear's car and son bear's car, respectively.

If there are multiple possible solutions, print any.

If there is no solution, print "-1" (without quotes).

Examples

Input

50 30 10 10

Output

50
30
10

Input

100 50 10 21

Output

-1

Note

In first test case all conditions for cars' sizes are satisfied.

In second test case there is no answer, because Masha should be able to climb into smallest car (so size of smallest car in not less than 21), but son bear should like it, so maximum possible size of it is 20.

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
const long long MX = 1e10;
const int INF = 1e9 + 7;
const double EPS = 0.00000001;
int main() {
  ios_base::sync_with_stdio(false);
  int v1, v2, v3, vm;
  cin >> v1 >> v2 >> v3 >> vm;
  for (int i = 1; i <= 205; i++) {
    for (int j = i + 1; j <= 205; j++) {
      for (int k = j + 1; k <= 205; k++) {
        if (i >= v3 && j >= v2 && k >= v1) {
          if (i <= 2 * v3 && j <= 2 * v2 && k <= 2 * v1) {
            if (i >= vm && j >= vm && k >= vm) {
              if (i <= 2 * vm && j > 2 * vm && k > 2 * vm) {
                cout << k << endl;
                cout << j << endl;
                cout << i << endl;
                return 0;
              }
            }
          }
        }
      }
    }
  }
  cout << -1 << endl;
  return 0;
}

```


### Prompt

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

Vasya owns three strings s , a and b, each of them consists only of first k Latin letters.

Let a template be such a string of length k that each of the first k Latin letters appears in it exactly once (thus there are k! distinct templates). Application of template p to the string s is the replacement of each character in string s with p_i, i is the index of this letter in the alphabet. For example, applying template "bdca" to a string "aabccd" yields string "bbdcca".

Vasya wants to know if there exists such a template which yields a string lexicographically greater than or equal to string a and lexicographically less than or equal to string b after applying it to s.

If there exist multiple suitable templates, print any of them.

String a is lexicographically less than string b if there is some i (1 ≤ i ≤ n) that a_i < b_i and for any j (1 ≤ j < i) a_j = b_j.

You are required to answer t testcases independently.

Input

The first line contains a single integer t (1 ≤ t ≤ 10^6) — the number of testcases.

In hacks you can only use t = 1.

Each of the next t lines contains the description of the testcase in the following form:

The first line of the testcase contains a single integer k (1 ≤ k ≤ 26) — the length of the template.

The second line of the testcase contains the string s (1 ≤ |s| ≤ 10^6).

The third line of the testcase contains the string a.

The fourth line of the testcase contains the string b.

Strings s, a and b have the same length (|s| = |a| = |b|) and consist only of the first k Latin letters, all letters are lowercase.

It is guaranteed that string a is lexicographically less than or equal to string b.

It is also guaranteed that the total length of strings over all testcase won't exceed 3 ⋅ 10^6.

Output

Print the answers to all testcases in the following form:

If there exists no suitable template then print "NO" in the first line.

Otherwise print "YES" in the first line and the template itself in the second line (k lowercase letters, each of the first k Latin letters should appear exactly once).

If there exist multiple suitable templates, print any of them.

Example

Input

2
4
bbcb
aada
aada
3
abc
bbb
bbb

Output

YES
badc
NO

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
string s, a, b;
int n, k;
int t;
bool vis[26];
int ans[26];
bool dfs(int pos, bool lower, bool upper) {
  if (pos >= n || (!lower && !upper)) return true;
  if (ans[s[pos] - 'a'] != -1) {
    if (lower && ans[s[pos] - 'a'] < a[pos]) return false;
    if (upper && ans[s[pos] - 'a'] > b[pos]) return false;
    return dfs(pos + 1, lower && (ans[s[pos] - 'a'] == a[pos]),
               upper && (ans[s[pos] - 'a'] == b[pos]));
  } else {
    for (int j = 0; j < k; ++j) {
      if (vis[j]) continue;
      if (lower && j < a[pos] - 'a') continue;
      if (upper && j > b[pos] - 'a') continue;
      vis[j] = 1;
      ans[s[pos] - 'a'] = j + 'a';
      if (dfs(pos + 1, lower && (ans[s[pos] - 'a'] == a[pos]),
              upper && (ans[s[pos] - 'a'] == b[pos])))
        return true;
      vis[j] = 0;
      ans[s[pos] - 'a'] = -1;
    }
  }
  return false;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> t;
  while (t--) {
    cin >> k;
    cin >> s >> a >> b;
    n = s.length();
    memset(vis, 0, sizeof(vis));
    memset(ans, -1, sizeof(ans));
    if (!dfs(0, true, true)) {
      cout << "NO" << endl;
      continue;
    }
    int j = 0;
    for (int i = 0; i < k; ++i) {
      if (ans[i] == -1) {
        while (vis[j]) j++;
        ans[i] = j + 'a';
        vis[j] = 1;
      }
    }
    cout << "YES\n";
    for (int i = 0; i < k; ++i) cout << char(ans[i]);
    cout << "\n";
  }
  return 0;
}

```


### Prompt

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

There was an electronic store heist last night.

All keyboards which were in the store yesterday were numbered in ascending order from some integer number x. For example, if x = 4 and there were 3 keyboards in the store, then the devices had indices 4, 5 and 6, and if x = 10 and there were 7 of them then the keyboards had indices 10, 11, 12, 13, 14, 15 and 16.

After the heist, only n keyboards remain, and they have indices a_1, a_2, ..., a_n. Calculate the minimum possible number of keyboards that have been stolen. The staff remember neither x nor the number of keyboards in the store before the heist.

Input

The first line contains single integer n (1 ≤ n ≤ 1 000) — the number of keyboards in the store that remained after the heist.

The second line contains n distinct integers a_1, a_2, ..., a_n (1 ≤ a_i ≤ 10^{9}) — the indices of the remaining keyboards. The integers a_i are given in arbitrary order and are pairwise distinct.

Output

Print the minimum possible number of keyboards that have been stolen if the staff remember neither x nor the number of keyboards in the store before the heist.

Examples

Input

4
10 13 12 8

Output

2

Input

5
7 5 6 4 8

Output

0

Note

In the first example, if x=8 then minimum number of stolen keyboards is equal to 2. The keyboards with indices 9 and 11 were stolen during the heist.

In the second example, if x=4 then nothing was stolen during the heist.

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
void fastio() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
}
int main() {
  fastio();
  long long int a, b;
  long long int mx = INT_MIN;
  long long int n, mn = INT_MAX;
  cin >> n;
  long long int ar[n];
  for (int i = 0; i < n; i++) {
    cin >> ar[i];
    mn = min(mn, ar[i]);
    mx = max(ar[i], mx);
  }
  long long int res = mx - mn + 1;
  cout << res - n;
  return 0;
}

```


### Prompt

Create a solution in Cpp for the following problem:

Welcome to PC Koshien, players. Physical condition management is important to participate in the event. It is said that at the turn of the season when the temperature fluctuates greatly, it puts a strain on the body and it is easy to catch a cold. The day you should be careful about is the day when the difference between the maximum temperature and the minimum temperature is the largest. When the maximum and minimum temperatures of a day are given for 7 days, create a program that outputs the value obtained by subtracting the minimum temperature from the maximum temperature for each day.

input

Input data is given in the following format.

a1 b1
a2 b2
::
a7 b7

The input consists of 7 lines, and line i is given an integer representing the maximum temperature ai (-40 ≤ ai ≤ 40) and the minimum temperature bi (-40 ≤ bi ≤ 40) on day i. On all days, the maximum temperature ai is always above the minimum temperature bi.

output

Output the temperature difference for 7 days in 7 lines.

Example

Input

30 19
39 20
19 18
25 20
22 21
23 10
10 -10

Output

11
19
1
5
1
13
20

### Response

```cpp
#include <iostream>

using namespace std;

int main() {
	int a, b;
	while (cin >> a >> b)
		if (a < b)
			cout << b - a << endl;
		else
			cout << a - b << endl;
}
```


### Prompt

Develop a solution in cpp to the problem described below:

Everyone knows that hobbits love to organize all sorts of parties and celebrations. There are n hobbits living in the Shire. They decided to organize the Greatest Party (GP) that would last for several days. Next day the hobbits wrote a guest list, some non-empty set containing all the inhabitants of the Shire. To ensure that everybody enjoy themselves and nobody gets bored, for any two days (say, days A and B) of the GP there existed at least one hobbit, invited to come on day A and on day B. However, to ensure that nobody has a row, for any three different days A, B, C there shouldn't be a hobbit invited on days A, B and C. The Shire inhabitants are keen on keeping the GP going for as long as possible. Your task is given number n, to indicate the GP's maximum duration and the guest lists for each day.

Input

The first line contains an integer n (3 ≤ n ≤ 10000), representing the number of hobbits.

Output

In the first output line print a number k — the maximum duration of GP in days. Then on k lines print the guest lists, (the guests should be separated by spaces). Print each guest list on the single line. Each list can contain an arbitrary positive number of hobbits. The hobbits are numbered with integers from 1 to n.

Examples

Input

4

Output

3
1 2
1 3
2 3

Input

5

Output

3
1 2
1 3
2 3

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
vector<int> a[10005];
int main() {
  int n, x, k = 0;
  cin >> n;
  x = (sqrt(1.0 + 8 * n) + 1) / 2;
  cout << x << endl;
  for (int i = 1; i <= x; i++)
    for (int j = i + 1; j <= x; j++) a[i].push_back(++k), a[j].push_back(k);
  for (int i = 1; i <= x; i++, cout << endl)
    for (int j = 0; j < a[i].size(); j++) cout << a[i][j] << " ";
  return 0;
}

```


### Prompt

Develop a solution in CPP to the problem described below:

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

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

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

Input

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

Output

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

Examples

Input

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

Output

0
0
2
10
4
6
6

Note

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

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

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

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

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 7;
struct node {
  int l, r;
  int a, b, sum;
  node operator+(const node m) {
    node ans;
    int minn = min(a, m.b);
    ans.sum = sum + m.sum + minn * 2;
    ans.a = a + m.a - minn;
    ans.b = b + m.b - minn;
    return ans;
  }
} tree[4 * N];
string s;
void push_up(int x) {
  int minn = min(tree[x << 1].a, tree[x << 1 | 1].b);
  tree[x].sum = tree[x << 1].sum + tree[x << 1 | 1].sum + minn * 2;
  tree[x].a = tree[x << 1].a + tree[x << 1 | 1].a - minn;
  tree[x].b = tree[x << 1].b + tree[x << 1 | 1].b - minn;
}
void build(int x, int l, int r) {
  tree[x].l = l;
  tree[x].r = r;
  tree[x].a = tree[x].b = tree[x].sum = 0;
  if (l == r) {
    if (s[l - 1] == '(')
      tree[x].a = 1;
    else
      tree[x].b = 1;
    tree[x].sum = 0;
    return;
  }
  int m = (l + r) / 2;
  build(x << 1, l, m);
  build(x << 1 | 1, m + 1, r);
  push_up(x);
}
node query(int x, int l, int r) {
  int L = tree[x].l, R = tree[x].r;
  if (l <= L && R <= r) {
    return tree[x];
  }
  int m = (L + R) / 2;
  if (r <= m)
    return query(x << 1, l, r);
  else if (l > m)
    return query(x << 1 | 1, l, r);
  else
    return query(x << 1, l, r) + query(x << 1 | 1, l, r);
}
int main() {
  cin >> s;
  build(1, 1, (int)s.length());
  int q;
  cin >> q;
  while (q--) {
    int l, r;
    cin >> l >> r;
    cout << query(1, l, r).sum << endl;
  }
  return 0;
}

```


### Prompt

Please create a solution in cpp to the following problem:

Alyona has a tree with n vertices. The root of the tree is the vertex 1. In each vertex Alyona wrote an positive integer, in the vertex i she wrote ai. Moreover, the girl wrote a positive integer to every edge of the tree (possibly, different integers on different edges).

Let's define dist(v, u) as the sum of the integers written on the edges of the simple path from v to u.

The vertex v controls the vertex u (v ≠ u) if and only if u is in the subtree of v and dist(v, u) ≤ au.

Alyona wants to settle in some vertex. In order to do this, she wants to know for each vertex v what is the number of vertices u such that v controls u.

Input

The first line contains single integer n (1 ≤ n ≤ 2·105).

The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 109) — the integers written in the vertices.

The next (n - 1) lines contain two integers each. The i-th of these lines contains integers pi and wi (1 ≤ pi ≤ n, 1 ≤ wi ≤ 109) — the parent of the (i + 1)-th vertex in the tree and the number written on the edge between pi and (i + 1).

It is guaranteed that the given graph is a tree.

Output

Print n integers — the i-th of these numbers should be equal to the number of vertices that the i-th vertex controls.

Examples

Input

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

Output

1 0 1 0 0

Input

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

Output

4 3 2 1 0

Note

In the example test case the vertex 1 controls the vertex 3, the vertex 3 controls the vertex 5 (note that is doesn't mean the vertex 1 controls the vertex 5).

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
static const int maxn = 2e5 + 5;
static const int logn = 19;
struct edge {
  int v;
  long long w;
  edge(int vv = 0, long long ww = 0) : v(vv), w(ww) {}
};
struct node {
  int f;
  long long cost;
  node(int ff = 0, long long costt = 0) : f(ff), cost(costt) {}
};
int tnode;
long long a[maxn];
vector<edge> graph[maxn];
node father[maxn][logn];
int depth[maxn];
int sz[maxn];
void dfs(int u = 1, int p = -1) {
  for (int i = 1; i < logn; i++) {
    node f = father[u][i - 1];
    father[u][i].f = father[f.f][i - 1].f;
    father[u][i].cost = father[f.f][i - 1].cost + father[u][i - 1].cost;
  }
  sz[u] = 1;
  for (auto &it : graph[u]) {
    int v = it.v;
    long long w = it.w;
    if (it.v == p) continue;
    father[v][0] = {u, w};
    depth[v] = depth[u] + 1;
    dfs(v, u);
    sz[u] += sz[v];
  }
}
int chainNo, chainHead[maxn], chainInd[maxn], chainPos[maxn], chainSize[maxn],
    baseArray[maxn], posBase[maxn], ptr, S, E;
void hld(int u = 1, int p = -1) {
  if (chainHead[chainNo] == -1) chainHead[chainNo] = u;
  chainInd[u] = chainNo;
  ptr++;
  posBase[u] = ptr;
  int bigChild(-1), mx(-1);
  for (auto &it : graph[u]) {
    int v = it.v;
    if (v == p) continue;
    if (sz[v] > mx) mx = sz[v], bigChild = v;
  }
  if (bigChild != -1) hld(bigChild, u);
  for (auto &it : graph[u]) {
    int v = it.v;
    if (v == p) continue;
    if (bigChild != v) {
      chainNo++;
      hld(v, u);
    }
  }
}
int tree[maxn << 2];
void update(int n, int a, int b, int i, int j) {
  if (a > b || a > j || b < i) return;
  if (a >= i && b <= j) {
    tree[n] += 1;
    return;
  }
  int left = n << 1;
  int right = left | 1;
  int mid = (a + b) >> 1;
  update(left, a, mid, i, j);
  update(right, mid + 1, b, i, j);
}
int sum;
void query(int n, int a, int b, int pos) {
  if (a > b || a > pos || b < pos) return;
  sum += tree[n];
  if (a >= pos && b <= pos) return;
  int left = n << 1;
  int right = left | 1;
  int mid = (a + b) >> 1;
  query(left, a, mid, pos);
  query(right, mid + 1, b, pos);
}
void updatehld(int u, int v) {
  int uChain, vChain = chainInd[v];
  while (true) {
    uChain = chainInd[u];
    if (uChain == vChain) {
      int l = posBase[v];
      int r = posBase[u];
      if (l > r) break;
      update(1, S, E, l, r);
      break;
    }
    int l = posBase[chainHead[uChain]];
    int r = posBase[u];
    update(1, S, E, l, r);
    u = father[chainHead[uChain]][0].f;
  }
}
void goup(int u, int cc) {
  int v = u;
  for (int i = logn - 1; i >= 0; i--) {
    node ff = father[u][i];
    if (ff.f != 0 && ff.cost <= cc) {
      u = ff.f;
      cc -= ff.cost;
    }
  }
  if (v == u) return;
  updatehld(father[v][0].f, u);
}
void init() {
  ptr = 0;
  chainNo = 0;
  for (int i = 0; i < maxn; i++) {
    chainHead[i] = -1;
  }
}
int main() {
  scanf("%d", &tnode);
  for (int i = 1; i <= tnode; i++) scanf("%lld", a + i);
  for (int u = 2; u <= tnode; u++) {
    int v;
    long long w;
    scanf("%d %lld", &v, &w);
    graph[u].push_back(edge(v, w));
    graph[v].push_back(edge(u, w));
  }
  init();
  depth[1] = 1;
  dfs();
  hld();
  S = 1;
  E = ptr;
  for (int i = 2; i <= tnode; i++) goup(i, a[i]);
  for (int i = 1; i <= tnode; i++) {
    sum = 0;
    query(1, S, E, posBase[i]);
    printf("%d ", sum);
  }
}

```


### Prompt

Develop a solution in Cpp to the problem described below:

Anton has the integer x. He is interested what positive integer, which doesn't exceed x, has the maximum sum of digits.

Your task is to help Anton and to find the integer that interests him. If there are several such integers, determine the biggest of them.

Input

The first line contains the positive integer x (1 ≤ x ≤ 1018) — the integer which Anton has.

Output

Print the positive integer which doesn't exceed x and has the maximum sum of digits. If there are several such integers, print the biggest of them. Printed integer must not contain leading zeros.

Examples

Input

100

Output

99

Input

48

Output

48

Input

521

Output

499

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
long long int T = 1, inf = 10000000000;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  while (T--) {
    long long int n, sz, ans = 0, blag = 0, u, mn, ev = 0, mx, mini, i, v, q, p,
                         j, k, w, h, l, m, x, y, od = 0, total = 0, cc = 0,
                         pp = 0, flag = 0, klag = 0, sum = 0;
    string s, s1 = "YES", s2 = "NO";
    bool ok = 0;
    n = 11;
    cin >> s;
    if (stoll(s, nullptr, 10) <= 9) {
      cout << s;
      break;
    }
    sz = s.size();
    string s3(sz - 1, '9');
    s3 = '0' + s3;
    for (i = 1; i < 10; i++) {
      s3[0]++;
      if (s3 > s) {
        for (j = sz - 1; j > 0; j--) {
          s3[j]--;
          if (s3 <= s) {
            flag = 1;
            break;
          } else {
            s3[j]++;
          }
        }
        if (flag == 0) {
          s3[0]--;
        }
        break;
      }
    }
    if (s3[0] == '0') {
      s3.erase(0, 1);
    }
    cout << s3 << "\n";
  }
  return 0;
}

```


### Prompt

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

A number of skyscrapers have been built in a line. The number of skyscrapers was chosen uniformly at random between 2 and 314! (314 factorial, a very large number). The height of each skyscraper was chosen randomly and independently, with height i having probability 2 - i for all positive integers i. The floors of a skyscraper with height i are numbered 0 through i - 1.

To speed up transit times, a number of zip lines were installed between skyscrapers. Specifically, there is a zip line connecting the i-th floor of one skyscraper with the i-th floor of another skyscraper if and only if there are no skyscrapers between them that have an i-th floor.

Alice and Bob decide to count the number of skyscrapers.

Alice is thorough, and wants to know exactly how many skyscrapers there are. She begins at the leftmost skyscraper, with a counter at 1. She then moves to the right, one skyscraper at a time, adding 1 to her counter each time she moves. She continues until she reaches the rightmost skyscraper.

Bob is impatient, and wants to finish as fast as possible. He begins at the leftmost skyscraper, with a counter at 1. He moves from building to building using zip lines. At each stage Bob uses the highest available zip line to the right, but ignores floors with a height greater than h due to fear of heights. When Bob uses a zip line, he travels too fast to count how many skyscrapers he passed. Instead, he just adds 2i to his counter, where i is the number of the floor he's currently on. He continues until he reaches the rightmost skyscraper.

Consider the following example. There are 6 buildings, with heights 1, 4, 3, 4, 1, 2 from left to right, and h = 2. Alice begins with her counter at 1 and then adds 1 five times for a result of 6. Bob begins with his counter at 1, then he adds 1, 4, 4, and 2, in order, for a result of 12. Note that Bob ignores the highest zip line because of his fear of heights (h = 2).

<image>

Bob's counter is at the top of the image, and Alice's counter at the bottom. All zip lines are shown. Bob's path is shown by the green dashed line and Alice's by the pink dashed line. The floors of the skyscrapers are numbered, and the zip lines Bob uses are marked with the amount he adds to his counter.

When Alice and Bob reach the right-most skyscraper, they compare counters. You will be given either the value of Alice's counter or the value of Bob's counter, and must compute the expected value of the other's counter.

Input

The first line of input will be a name, either string "Alice" or "Bob". The second line of input contains two integers n and h (2 ≤ n ≤ 30000, 0 ≤ h ≤ 30). If the name is "Alice", then n represents the value of Alice's counter when she reaches the rightmost skyscraper, otherwise n represents the value of Bob's counter when he reaches the rightmost skyscraper; h represents the highest floor number Bob is willing to use.

Output

Output a single real value giving the expected value of the Alice's counter if you were given Bob's counter, or Bob's counter if you were given Alice's counter.

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

Examples

Input

Alice
3 1

Output

3.500000000

Input

Bob
2 30

Output

2

Input

Alice
2572 10

Output

3439.031415943

Note

In the first example, Bob's counter has a 62.5% chance of being 3, a 25% chance of being 4, and a 12.5% chance of being 5.

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
const int RLEN = 1 << 20 | 1;
inline char gc() {
  static char ibuf[RLEN], *ib, *ob;
  (ob == ib) && (ob = (ib = ibuf) + fread(ibuf, 1, RLEN, stdin));
  return (ob == ib) ? EOF : *ib++;
}
inline int read() {
  char ch = getchar();
  int res = 0, f = 1;
  while (!isdigit(ch)) f ^= ch == '-', ch = getchar();
  while (isdigit(ch)) res = (res + (res << 2) << 1) + (ch ^ 48), ch = getchar();
  return f ? res : -res;
}
template <class tp>
inline void chemx(tp &a, tp b) {
  a < b ? a = b : 0;
}
template <class tp>
inline void chemn(tp &a, tp b) {
  a > b ? a = b : 0;
}
int n, h;
double pw[73];
char s[10];
inline double ksm(double a, int b) {
  double res = 1;
  for (; b; b >>= 1, a = a * a)
    if (b & 1) res = res * a;
  return res;
}
int main() {
  scanf("%s", s + 1);
  n = read(), h = read();
  if (s[1] == 'A') {
    pw[0] = 1;
    for (int i = 1; i <= 2 * h; i++) pw[i] = pw[i - 1] * 0.5;
    double res = n;
    for (int i = 1; i <= h; i++)
      for (int j = 1; j <= n; j++)
        res += 1.0 * (n - j) * ksm(1 - pw[i], j - 1) * pw[i * 2] *
               ((1 << i) - 1.0 * (1 << (i - 1)) * 1.0 *
                               (1 + 1.0 * (j - 1) / ((1 << i) - 1)));
    printf("%.10f", res);
  } else
    cout << n << '\n';
}

```


### Prompt

Construct a Cpp code solution to the problem outlined:

Squirrel Liss lived in a forest peacefully, but unexpected trouble happens. Stones fall from a mountain. Initially Squirrel Liss occupies an interval [0, 1]. Next, n stones will fall and Liss will escape from the stones. The stones are numbered from 1 to n in order.

The stones always fall to the center of Liss's interval. When Liss occupies the interval [k - d, k + d] and a stone falls to k, she will escape to the left or to the right. If she escapes to the left, her new interval will be [k - d, k]. If she escapes to the right, her new interval will be [k, k + d].

You are given a string s of length n. If the i-th character of s is "l" or "r", when the i-th stone falls Liss will escape to the left or to the right, respectively. Find the sequence of stones' numbers from left to right after all the n stones falls.

Input

The input consists of only one line. The only line contains the string s (1 ≤ |s| ≤ 106). Each character in s will be either "l" or "r".

Output

Output n lines — on the i-th line you should print the i-th stone's number from the left.

Examples

Input

llrlr

Output

3
5
4
2
1

Input

rrlll

Output

1
2
5
4
3

Input

lrlrr

Output

2
4
5
3
1

Note

In the first example, the positions of stones 1, 2, 3, 4, 5 will be <image>, respectively. So you should print the sequence: 3, 5, 4, 2, 1.

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
char s[1000005];
int aim[1000005];
int l;
int main() {
  cin >> s;
  l = strlen(s);
  int a = 0;
  int b = l - 1;
  for (int i = 0; i < l; i++) {
    if (s[i] == 'l') {
      aim[b] = i + 1;
      b--;
    } else {
      aim[a] = i + 1;
      a++;
    }
  }
  for (int i = 0; i < l; i++) {
    cout << aim[i] << endl;
  }
  return 0;
}

```


### Prompt

Generate a cpp solution to the following problem:

Calendars in widespread use today include the Gregorian calendar, which is the de facto international standard, and is used almost everywhere in the world for civil purposes. The Gregorian reform modified the Julian calendar's scheme of leap years as follows:

Every year that is exactly divisible by four is a leap year, except for years that are exactly divisible by 100; the centurial years that are exactly divisible by 400 are still leap years. For example, the year 1900 is not a leap year; the year 2000 is a leap year.

<image>

In this problem, you have been given two dates and your task is to calculate how many days are between them. Note, that leap years have unusual number of days in February.

Look at the sample to understand what borders are included in the aswer.

Input

The first two lines contain two dates, each date is in the format yyyy:mm:dd (1900 ≤ yyyy ≤ 2038 and yyyy:mm:dd is a legal date).

Output

Print a single integer — the answer to the problem.

Examples

Input

1900:01:01
2038:12:31

Output

50768

Input

1996:03:09
1991:11:12

Output

1579

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
struct KK {
  int y, m, d;
} a1, a2;
const int mon[] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
int main() {
  int i;
  while (scanf(" %d:%d:%d", &a1.y, &a1.m, &a1.d) == 3) {
    scanf(" %d:%d:%d", &a2.y, &a2.m, &a2.d);
    if (a1.y > a2.y) {
      KK t = a1;
      a1 = a2;
      a2 = t;
    }
    int n = 365 * (a2.y - a1.y + 1);
    for (i = a1.y; i <= a2.y; i++)
      if ((!(i % 4) && (i % 100)) || !(i % 400)) n++;
    for (i = 1; i < a1.m; i++) n -= mon[i];
    if (((!(a1.y % 4) && (a1.y % 100)) || !(a1.y % 400)) && (a1.m > 2)) n--;
    n -= a1.d;
    n -= (mon[a2.m] - a2.d);
    if (((!(a2.y % 4) && (a2.y % 100)) || !(a2.y % 400)) && (a2.m <= 2)) n--;
    for (i = a2.m + 1; i < 13; i++) n -= mon[i];
    cout << abs(n) << endl;
  }
  return 0;
}

```


### Prompt

Develop a solution in cpp to the problem described below:

We have a grid with A horizontal rows and B vertical columns, with the squares painted white. On this grid, we will repeatedly apply the following operation:

* Assume that the grid currently has a horizontal rows and b vertical columns. Choose "vertical" or "horizontal".
* If we choose "vertical", insert one row at the top of the grid, resulting in an (a+1) \times b grid.
* If we choose "horizontal", insert one column at the right end of the grid, resulting in an a \times (b+1) grid.
* Then, paint one of the added squares black, and the other squares white.

Assume the grid eventually has C horizontal rows and D vertical columns. Find the number of ways in which the squares can be painted in the end, modulo 998244353.

Constraints

* 1 \leq A \leq C \leq 3000
* 1 \leq B \leq D \leq 3000
* A, B, C, and D are integers.

Input

Input is given from Standard Input in the following format:

A B C D

Output

Print the number of ways in which the squares can be painted in the end, modulo 998244353.

Examples

Input

1 1 2 2

Output

3

Input

2 1 3 4

Output

65

Input

31 41 59 265

Output

387222020

### Response

```cpp
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const int mod=998244353;
int read() {
	int x=0, f=1; char ch=' ';
	while(!isdigit(ch)) {ch=getchar(); if(ch=='-') f=-1;}
	while(isdigit(ch)) x=(x<<3)+(x<<1)+(ch^48), ch=getchar();
	return x*f;
}
ll f[3005][3005];
int main() {
	int a, b, c, d;
	cin>>a>>b>>c>>d;
	f[a][b]=1;
	for(int i=a;i<=c;i++) {
		for(int j=b;j<=d;j++) {
			if(i>a) f[i][j]+=f[i-1][j]*j;
			if(j>b) f[i][j]+=f[i][j-1]*i;
			if(i>a&&j>b) f[i][j]-=(ll)(i-1)*(j-1)*f[i-1][j-1];
			f[i][j]%=mod;
		}
	}
	cout<<(f[c][d]%mod+mod)%mod;
}

```


### Prompt

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

Little Vasya has received a young builder’s kit. The kit consists of several wooden bars, the lengths of all of them are known. The bars can be put one on the top of the other if their lengths are the same.

Vasya wants to construct the minimal number of towers from the bars. Help Vasya to use the bars in the best way possible.

Input

The first line contains an integer N (1 ≤ N ≤ 1000) — the number of bars at Vasya’s disposal. The second line contains N space-separated integers li — the lengths of the bars. All the lengths are natural numbers not exceeding 1000.

Output

In one line output two numbers — the height of the largest tower and their total number. Remember that Vasya should use all the bars.

Examples

Input

3
1 2 3

Output

1 3

Input

4
6 5 6 7

Output

2 3

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
int main() {
  map<int, int> a;
  set<int> w;
  int c, x, ma = 1, q = 0, s = 0;
  cin >> c;
  for (int i = 0; i < c; i++) {
    cin >> x;
    a[x]++;
    ma = max(ma, a[x]);
    w.insert(x);
  }
  cout << ma << " " << w.size();
}

```


### Prompt

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

Momiji has got a rooted tree, consisting of n nodes. The tree nodes are numbered by integers from 1 to n. The root has number 1. Momiji decided to play a game on this tree.

The game consists of several steps. On each step, Momiji chooses one of the remaining tree nodes (let's denote it by v) and removes all the subtree nodes with the root in node v from the tree. Node v gets deleted as well. The game finishes when the tree has no nodes left. In other words, the game finishes after the step that chooses the node number 1.

Each time Momiji chooses a new node uniformly among all the remaining nodes. Your task is to find the expectation of the number of steps in the described game.

Input

The first line contains integer n (1 ≤ n ≤ 105) — the number of nodes in the tree. The next n - 1 lines contain the tree edges. The i-th line contains integers ai, bi (1 ≤ ai, bi ≤ n; ai ≠ bi) — the numbers of the nodes that are connected by the i-th edge.

It is guaranteed that the given graph is a tree.

Output

Print a single real number — the expectation of the number of steps in the described game.

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

Examples

Input

2
1 2

Output

1.50000000000000000000

Input

3
1 2
1 3

Output

2.00000000000000000000

Note

In the first sample, there are two cases. One is directly remove the root and another is remove the root after one step. Thus the expected steps are:

1 × (1 / 2) + 2 × (1 / 2) = 1.5

In the second sample, things get more complex. There are two cases that reduce to the first sample, and one case cleaned at once. Thus the expected steps are:

1 × (1 / 3) + (1 + 1.5) × (2 / 3) = (1 / 3) + (5 / 3) = 2

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
int n, tot = 0;
int v[200005], nxt[200005], h[100005], dep[100005];
void addedge(int x, int y) {
  v[++tot] = y;
  nxt[tot] = h[x];
  h[x] = tot;
  v[++tot] = x;
  nxt[tot] = h[y];
  h[y] = tot;
}
void dfs(int u, int fa) {
  for (int p = h[u]; p; p = nxt[p]) {
    if (v[p] == fa) continue;
    dep[v[p]] = dep[u] + 1;
    dfs(v[p], u);
  }
}
int main() {
  cin >> n;
  int x, y;
  for (int i = 1; i <= n - 1; i++) {
    cin >> x >> y;
    addedge(x, y);
  }
  dep[1] = 1;
  dfs(1, -1);
  double ans = 0;
  for (int i = 1; i <= n; i++) ans += 1.0 / dep[i];
  printf("%.10lf\n", ans);
  return 0;
}

```