### Prompt

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

Efim just received his grade for the last test. He studies in a special school and his grade can be equal to any positive decimal fraction. First he got disappointed, as he expected a way more pleasant result. Then, he developed a tricky plan. Each second, he can ask his teacher to round the grade at any place after the decimal point (also, he can ask to round to the nearest integer).

There are t seconds left till the end of the break, so Efim has to act fast. Help him find what is the maximum grade he can get in no more than t seconds. Note, that he can choose to not use all t seconds. Moreover, he can even choose to not round the grade at all.

In this problem, classic rounding rules are used: while rounding number to the n-th digit one has to take a look at the digit n + 1. If it is less than 5 than the n-th digit remain unchanged while all subsequent digits are replaced with 0. Otherwise, if the n + 1 digit is greater or equal to 5, the digit at the position n is increased by 1 (this might also change some other digits, if this one was equal to 9) and all subsequent digits are replaced with 0. At the end, all trailing zeroes are thrown away.

For example, if the number 1.14 is rounded to the first decimal place, the result is 1.1, while if we round 1.5 to the nearest integer, the result is 2. Rounding number 1.299996121 in the fifth decimal place will result in number 1.3.

Input

The first line of the input contains two integers n and t (1 ≤ n ≤ 200 000, 1 ≤ t ≤ 109) — the length of Efim's grade and the number of seconds till the end of the break respectively.

The second line contains the grade itself. It's guaranteed that the grade is a positive number, containing at least one digit after the decimal points, and it's representation doesn't finish with 0.

Output

Print the maximum grade that Efim can get in t seconds. Do not print trailing zeroes.

Examples

Input

6 1
10.245

Output

10.25

Input

6 2
10.245

Output

10.3

Input

3 100
9.2

Output

9.2

Note

In the first two samples Efim initially has grade 10.245.

During the first second Efim can obtain grade 10.25, and then 10.3 during the next second. Note, that the answer 10.30 will be considered incorrect.

In the third sample the optimal strategy is to not perform any rounding at all.

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
const int maxn = 200000 + 7;
char s[maxn];
int main() {
  int n, t;
  while (~scanf("%d%d", &n, &t)) {
    getchar();
    scanf("%s", s + 1);
    int i = 1, f = 0;
    for (; i <= n; i++) {
      if (s[i] == '.') f = 1;
      if (f && s[i] >= '5') {
        f = 2;
        break;
      }
      if (i == n) break;
    }
    int flag = 0;
    if (f == 2) {
      for (; i >= 1 && t; i--, t--) {
        if (s[i] >= '5') {
          s[i] = '0';
          if (s[i - 1] == '.') {
            i--;
            i--;
            flag = 1;
            break;
          }
          s[i - 1] += 1;
        } else
          break;
      }
    }
    int len = i;
    if (flag) {
      for (; len >= 1; len--) {
        if (s[len] == '9' && len == 1) {
          printf("1");
          s[len] = '0';
          break;
        } else if (s[len] == '9')
          s[len] = '0';
        else {
          s[len] += 1;
          break;
        }
      }
    }
    for (int j = 1; j <= i; j++) printf("%c", s[j]);
    printf("\n");
  }
  return 0;
}

```


### Prompt

Please create a solution in Cpp to the following problem:

Galya is playing one-dimensional Sea Battle on a 1 × n grid. In this game a ships are placed on the grid. Each of the ships consists of b consecutive cells. No cell can be part of two ships, however, the ships can touch each other.

Galya doesn't know the ships location. She can shoot to some cells and after each shot she is told if that cell was a part of some ship (this case is called "hit") or not (this case is called "miss").

Galya has already made k shots, all of them were misses.

Your task is to calculate the minimum number of cells such that if Galya shoot at all of them, she would hit at least one ship.

It is guaranteed that there is at least one valid ships placement.

Input

The first line contains four positive integers n, a, b, k (1 ≤ n ≤ 2·105, 1 ≤ a, b ≤ n, 0 ≤ k ≤ n - 1) — the length of the grid, the number of ships on the grid, the length of each ship and the number of shots Galya has already made.

The second line contains a string of length n, consisting of zeros and ones. If the i-th character is one, Galya has already made a shot to this cell. Otherwise, she hasn't. It is guaranteed that there are exactly k ones in this string.

Output

In the first line print the minimum number of cells such that if Galya shoot at all of them, she would hit at least one ship.

In the second line print the cells Galya should shoot at.

Each cell should be printed exactly once. You can print the cells in arbitrary order. The cells are numbered from 1 to n, starting from the left.

If there are multiple answers, you can print any of them.

Examples

Input

5 1 2 1
00100

Output

2
4 2

Input

13 3 2 3
1000000010001

Output

2
7 11

Note

There is one ship in the first sample. It can be either to the left or to the right from the shot Galya has already made (the "1" character). So, it is necessary to make two shots: one at the left part, and one at the right part.

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int n, a, b, k;
  cin >> n >> a >> b >> k;
  string s;
  cin >> s;
  if (k == 0) {
    vector<int> sol;
    for (int i = b - 1; i <= n; i += b) {
      sol.push_back(i + 1);
      if ((n - i - 1) < a * b) {
        break;
      }
    }
    cout << sol.size() << '\n';
    for (int i = 0; i < sol.size(); i++) {
      cout << sol[i] << " \n"[i + 1 == sol.size()];
    }
    return 0;
  }
  vector<pair<int, int> > x;
  int l = -1;
  for (int i = 0; i < n; i++) {
    if (s[i] == '0') {
      if (l == -1) {
        l = i;
      }
      if (i + 1 == n || s[i + 1] == '1') {
        x.push_back(pair<int, int>(l, i));
        l = -1;
      }
    }
  }
  vector<int> sx(x.size() + 1, 0);
  for (int i = x.size() - 1; i >= 0; i--) {
    sx[i] = (x[i].second - x[i].first + 1) / b;
    sx[i] += sx[i + 1];
  }
  vector<int> sol;
  for (int i = 0; i < x.size(); i++) {
    for (int j = x[i].first + b - 1; j <= x[i].second; j += b) {
      int cnt = (x[i].second - j) / b + sx[i + 1];
      sol.push_back(j + 1);
      if (cnt < a) {
        cout << sol.size() << '\n';
        for (int i = 0; i < sol.size(); i++) {
          cout << sol[i] << " \n"[i == sol.size() - 1];
        }
        return 0;
      }
    }
  }
  if (sol.size() == 0) {
    cout << "1\n";
    for (int i = 0; i < n; i++) {
      if (s[i] == '0') {
        cout << i + 1 << '\n';
        return 0;
      }
    }
  }
}

```


### Prompt

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

You are given an array a1, a2, ..., an consisting of n integers, and an integer k. You have to split the array into exactly k non-empty subsegments. You'll then compute the minimum integer on each subsegment, and take the maximum integer over the k obtained minimums. What is the maximum possible integer you can get?

Definitions of subsegment and array splitting are given in notes.

Input

The first line contains two integers n and k (1 ≤ k ≤ n ≤ 105) — the size of the array a and the number of subsegments you have to split the array to.

The second line contains n integers a1, a2, ..., an ( - 109 ≤ ai ≤ 109).

Output

Print single integer — the maximum possible integer you can get if you split the array into k non-empty subsegments and take maximum of minimums on the subsegments.

Examples

Input

5 2
1 2 3 4 5

Output

5

Input

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

Output

-5

Note

A subsegment [l, r] (l ≤ r) of array a is the sequence al, al + 1, ..., ar.

Splitting of array a of n elements into k subsegments [l1, r1], [l2, r2], ..., [lk, rk] (l1 = 1, rk = n, li = ri - 1 + 1 for all i > 1) is k sequences (al1, ..., ar1), ..., (alk, ..., ark).

In the first example you should split the array into subsegments [1, 4] and [5, 5] that results in sequences (1, 2, 3, 4) and (5). The minimums are min(1, 2, 3, 4) = 1 and min(5) = 5. The resulting maximum is max(1, 5) = 5. It is obvious that you can't reach greater result.

In the second example the only option you have is to split the array into one subsegment [1, 5], that results in one sequence ( - 4, - 5, - 3, - 2, - 1). The only minimum is min( - 4, - 5, - 3, - 2, - 1) = - 5. The resulting maximum is  - 5.

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, i, j, maxi = -1e9, mini = 1e9;
  cin >> n >> j;
  int a[n];
  for (i = 0; i < n; i++) {
    cin >> a[i];
    maxi = max(maxi, a[i]);
    mini = min(mini, a[i]);
  }
  if (j == 1)
    cout << mini;
  else if (j == n)
    cout << maxi;
  else if (j == 2) {
    cout << max(a[0], a[n - 1]);
  } else
    cout << maxi;
}

```


### Prompt

Construct a cpp code solution to the problem outlined:

DZY has a sequence a, consisting of n integers.

We'll call a sequence ai, ai + 1, ..., aj (1 ≤ i ≤ j ≤ n) a subsegment of the sequence a. The value (j - i + 1) denotes the length of the subsegment.

Your task is to find the longest subsegment of a, such that it is possible to change at most one number (change one number to any integer you want) from the subsegment to make the subsegment strictly increasing.

You only need to output the length of the subsegment you find.

Input

The first line contains integer n (1 ≤ n ≤ 105). The next line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 109).

Output

In a single line print the answer to the problem — the maximum length of the required subsegment.

Examples

Input

6
7 2 3 1 5 6

Output

5

Note

You can choose subsegment a2, a3, a4, a5, a6 and change its 3rd element (that is a4) to 4.

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
int n, ans, a[100010], l[100010], r[100010];
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
  }
  l[1] = 1;
  r[n] = 1;
  for (int i = 2; i <= n; i++) {
    if (a[i - 1] < a[i]) {
      l[i] = l[i - 1] + 1;
    } else {
      l[i] = 1;
    }
  }
  for (int i = n - 1; i > 0; i--) {
    if (a[i] < a[i + 1]) {
      r[i] = r[i + 1] + 1;
    } else {
      r[i] = 1;
    }
  }
  for (int i = 1; i <= n; ++i) {
    ans = max(ans, l[i - 1] + 1);
    ans = max(ans, 1 + r[i + 1]);
    if (a[i - 1] + 1 < a[i + 1]) {
      ans = max(ans, l[i - 1] + 1 + r[i + 1]);
    }
  }
  cout << ans;
  return 0;
}

```


### Prompt

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

There are some websites that are accessible through several different addresses. For example, for a long time Codeforces was accessible with two hostnames codeforces.com and codeforces.ru.

You are given a list of page addresses being queried. For simplicity we consider all addresses to have the form http://<hostname>[/<path>], where:

  * <hostname> — server name (consists of words and maybe some dots separating them),
  * /<path> — optional part, where <path> consists of words separated by slashes.

We consider two <hostname> to correspond to one website if for each query to the first <hostname> there will be exactly the same query to the second one and vice versa — for each query to the second <hostname> there will be the same query to the first one. Take a look at the samples for further clarifications.

Your goal is to determine the groups of server names that correspond to one website. Ignore groups consisting of the only server name.

Please note, that according to the above definition queries http://<hostname> and http://<hostname>/ are different.

Input

The first line of the input contains a single integer n (1 ≤ n ≤ 100 000) — the number of page queries. Then follow n lines each containing exactly one address. Each address is of the form http://<hostname>[/<path>], where:

  * <hostname> consists of lowercase English letters and dots, there are no two consecutive dots, <hostname> doesn't start or finish with a dot. The length of <hostname> is positive and doesn't exceed 20.
  * <path> consists of lowercase English letters, dots and slashes. There are no two consecutive slashes, <path> doesn't start with a slash and its length doesn't exceed 20.

Addresses are not guaranteed to be distinct.

Output

First print k — the number of groups of server names that correspond to one website. You should count only groups of size greater than one.

Next k lines should contain the description of groups, one group per line. For each group print all server names separated by a single space. You are allowed to print both groups and names inside any group in arbitrary order.

Examples

Input

10
http://abacaba.ru/test
http://abacaba.ru/
http://abacaba.com
http://abacaba.com/test
http://abacaba.de/
http://abacaba.ru/test
http://abacaba.de/test
http://abacaba.com/
http://abacaba.com/t
http://abacaba.com/test

Output

1
http://abacaba.de http://abacaba.ru

Input

14
http://c
http://ccc.bbbb/aba..b
http://cba.com
http://a.c/aba..b/a
http://abc/
http://a.c/
http://ccc.bbbb
http://ab.ac.bc.aa/
http://a.a.a/
http://ccc.bbbb/
http://cba.com/
http://cba.com/aba..b
http://a.a.a/aba..b/a
http://abc/aba..b/a

Output

2
http://cba.com http://ccc.bbbb
http://a.a.a http://a.c http://abc

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
unordered_map<string, set<string> > mp;
map<set<string>, vector<string> > res;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n;
  string a;
  cin >> n;
  while (n--) {
    cin >> a;
    a += '/';
    int t = a.find('/', 7);
    mp[a.substr(0, t)].insert(a.substr(t));
  }
  for (auto k : mp) res[k.second].push_back(k.first);
  int ans = 0;
  for (auto k : res)
    if (k.second.size() > 1) ans++;
  cout << ans << endl;
  for (auto k : res)
    if (k.second.size() > 1) {
      for (auto j : k.second) cout << j << " ";
      cout << endl;
    }
  return 0;
}

```


### Prompt

Please formulate a CPP solution to the following problem:

In this problem we consider a very simplified model of Barcelona city.

Barcelona can be represented as a plane with streets of kind x = c and y = c for every integer c (that is, the rectangular grid). However, there is a detail which makes Barcelona different from Manhattan. There is an avenue called Avinguda Diagonal which can be represented as a the set of points (x, y) for which ax + by + c = 0.

One can walk along streets, including the avenue. You are given two integer points A and B somewhere in Barcelona. Find the minimal possible distance one needs to travel to get to B from A.

Input

The first line contains three integers a, b and c (-10^9≤ a, b, c≤ 10^9, at least one of a and b is not zero) representing the Diagonal Avenue.

The next line contains four integers x_1, y_1, x_2 and y_2 (-10^9≤ x_1, y_1, x_2, y_2≤ 10^9) denoting the points A = (x_1, y_1) and B = (x_2, y_2).

Output

Find the minimum possible travel distance between A and B. Your answer is considered correct if its absolute or relative error does not exceed 10^{-6}.

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

Examples

Input

1 1 -3
0 3 3 0

Output

4.2426406871

Input

3 1 -9
0 3 3 -1

Output

6.1622776602

Note

The first example is shown on the left picture while the second example us shown on the right picture below. The avenue is shown with blue, the origin is shown with the black dot.

<image>

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
long double sq(long double a) { return a * a; }
long double dist(pair<long double, long double> a,
                 pair<long double, long double> b) {
  return sqrt((long double)(sq(a.second - b.second) + sq(a.first - b.first)));
}
long double mandist(pair<long long, long long> a,
                    pair<long long, long long> b) {
  return abs(a.second - b.second) + abs(a.first - b.first);
}
long long a, b, c;
pair<long long, long long> p1, p2;
int main() {
  scanf(" %lld%lld%lld", &a, &b, &c);
  scanf(" %lld%lld%lld%lld", &p1.first, &p1.second, &p2.first, &p2.second);
  if (a == 0 || b == 0)
    printf("%.20Lf\n", mandist(p1, p2));
  else {
    long double res = mandist(p1, p2);
    long double interhoriz1 =
        ((long double)(-c - a * p1.first)) / ((long double)b);
    long double interhoriz2 =
        ((long double)(-c - a * p2.first)) / ((long double)b);
    long double intervert1 =
        ((long double)(-c - b * p1.second)) / ((long double)a);
    long double intervert2 =
        ((long double)(-c - b * p2.second)) / ((long double)a);
    res = min(res, abs((long double)p1.second - interhoriz1) +
                       abs((long double)p2.second - interhoriz2) +
                       dist(make_pair((long double)p1.first, interhoriz1),
                            make_pair((long double)p2.first, interhoriz2)));
    res = min(res, abs((long double)p1.second - interhoriz1) +
                       abs((long double)p2.first - intervert2) +
                       dist(make_pair((long double)p1.first, interhoriz1),
                            make_pair(intervert2, (long double)p2.second)));
    res = min(res, abs((long double)p1.first - intervert1) +
                       abs((long double)p2.first - intervert2) +
                       dist(make_pair(intervert1, (long double)p1.second),
                            make_pair(intervert2, (long double)p2.second)));
    res = min(res, abs((long double)p1.first - intervert1) +
                       abs((long double)p2.second - interhoriz2) +
                       dist(make_pair(intervert1, (long double)p1.second),
                            make_pair((long double)p2.first, interhoriz2)));
    printf("%.20Lf\n", res);
  }
}

```


### Prompt

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

You are given an image A composed of N rows and N columns of pixels, and a template image B composed of M rows and M columns of pixels.
A pixel is the smallest element of an image, and in this problem it is a square of size 1×1.
Also, the given images are binary images, and the color of each pixel is either white or black.

In the input, every pixel is represented by a character: `.` corresponds to a white pixel, and `#` corresponds to a black pixel.
The image A is given as N strings A_1,...,A_N.
The j-th character in the string A_i corresponds to the pixel at the i-th row and j-th column of the image A (1≦i,j≦N).
Similarly, the template image B is given as M strings B_1,...,B_M.
The j-th character in the string B_i corresponds to the pixel at the i-th row and j-th column of the template image B (1≦i,j≦M).

Determine whether the template image B is contained in the image A when only parallel shifts can be applied to the images.

Constraints

* 1≦M≦N≦50
* A_i is a string of length N consisting of `#` and `.`.
* B_i is a string of length M consisting of `#` and `.`.

Input

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

N M
A_1
A_2
:
A_N
B_1
B_2
:
B_M

Output

Print `Yes` if the template image B is contained in the image A. Print `No` otherwise.

Examples

Input

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

Output

Yes

Input

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

Output

Yes

Input

4 1
....
....
....
....

Output

No

### Response

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

int main(){
	int n,m;
	string S;
	vector<string> s,s2;
	cin >> n >> m;
	for(int i=0;i<n;i++){
		cin >> S;
		s.push_back(S);
	}
	for(int i=0;i<m;i++){
		cin >> S;
		s2.push_back(S);
	}

	bool ok;
	for(int i=0;i+m<=n;i++){
		for(int j=0;j+m<=n;j++){
		ok=true;
			for(int k=0;k<m;k++){
				for(int l=0;l<m;l++){
					if(s[i+k][j+l]!=s2[k][l]){
						ok=false;
					}
				}
			}
			if(ok) goto bb;
		}
	}
	bb:;
	cout << (ok?"Yes":"No") << endl;
	return 0;
}
```


### Prompt

Please create a solution in cpp to the following problem:

Alyona has built n towers by putting small cubes some on the top of others. Each cube has size 1 × 1 × 1. A tower is a non-zero amount of cubes standing on the top of each other. The towers are next to each other, forming a row.

Sometimes Alyona chooses some segment towers, and put on the top of each tower several cubes. Formally, Alyouna chooses some segment of towers from li to ri and adds di cubes on the top of them.

Let the sequence a1, a2, ..., an be the heights of the towers from left to right. Let's call as a segment of towers al, al + 1, ..., ar a hill if the following condition holds: there is integer k (l ≤ k ≤ r) such that al < al + 1 < al + 2 < ... < ak > ak + 1 > ak + 2 > ... > ar.

After each addition of di cubes on the top of the towers from li to ri, Alyona wants to know the maximum width among all hills. The width of a hill is the number of towers in it.

Input

The first line contain single integer n (1 ≤ n ≤ 3·105) — the number of towers.

The second line contain n integers a1, a2, ..., an (1 ≤ ai ≤ 109) — the number of cubes in each tower.

The third line contain single integer m (1 ≤ m ≤ 3·105) — the number of additions.

The next m lines contain 3 integers each. The i-th of these lines contains integers li, ri and di (1 ≤ l ≤ r ≤ n, 1 ≤ di ≤ 109), that mean that Alyona puts di cubes on the tio of each of the towers from li to ri.

Output

Print m lines. In i-th line print the maximum width of the hills after the i-th addition.

Example

Input

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

Output

2
4
5

Note

The first sample is as follows:

After addition of 2 cubes on the top of each towers from the first to the third, the number of cubes in the towers become equal to [7, 7, 7, 5, 5]. The hill with maximum width is [7, 5], thus the maximum width is 2.

After addition of 1 cube on the second tower, the number of cubes in the towers become equal to [7, 8, 7, 5, 5]. The hill with maximum width is now [7, 8, 7, 5], thus the maximum width is 4.

After addition of 1 cube on the fourth tower, the number of cubes in the towers become equal to [7, 8, 7, 6, 5]. The hill with maximum width is now [7, 8, 7, 6, 5], thus the maximum width is 5.

### Response

```cpp
#include <bits/stdc++.h>
const int Mod = (int)1e9 + 7;
const int MX = 1073741822;
const long long MXLL = 4611686018427387903;
const int Sz = 1110111;
using namespace std;
inline void Read_rap() {
  ios_base ::sync_with_stdio(0);
  cin.tie(0);
}
struct node {
  int l, m, r;
} t[Sz];
int n;
long long a[Sz];
inline int sign(long long x) {
  if (x < 0) return -1;
  if (x == 0) return 0;
  if (x > 0) return 1;
}
inline void recalc(int v, int tl, int tr) {
  int tmid = (tl + tr) >> 1;
  t[v].l = t[2 * v].l;
  t[v].r = t[2 * v + 1].r;
  t[v].m = max(t[2 * v].m, t[2 * v + 1].m);
  if (a[tmid] && a[tmid + 1] && sign(a[tmid]) >= sign(a[tmid + 1])) {
    t[v].m = max(t[v].m, t[2 * v].r + t[2 * v + 1].l);
    if (t[2 * v].l == tmid - tl + 1) t[v].l += t[2 * v + 1].l;
    if (t[2 * v + 1].r == tr - tmid) t[v].r += t[2 * v].r;
  }
}
void build(int v, int tl, int tr) {
  if (tl == tr) {
    bool b = (a[tl] != 0);
    t[v] = {b, b, b};
    return;
  }
  int tmid = (tl + tr) >> 1;
  build(2 * v, tl, tmid);
  build(2 * v + 1, tmid + 1, tr);
  recalc(v, tl, tr);
}
void upd(int v, int tl, int tr, int id, int x) {
  if (tl == tr) {
    a[id] += x;
    bool b = (a[id] != 0);
    t[v] = {b, b, b};
    return;
  }
  int tmid = (tl + tr) >> 1;
  if (id <= tmid)
    upd(2 * v, tl, tmid, id, x);
  else
    upd(2 * v + 1, tmid + 1, tr, id, x);
  recalc(v, tl, tr);
}
int main() {
  Read_rap();
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> a[i];
  n--;
  for (int i = 1; i <= n; i++) a[i] = (a[i + 1] - a[i]);
  a[n + 1] = -1;
  if (n) build(1, 1, n);
  int m;
  cin >> m;
  while (m--) {
    if (!n) {
      cout << 1 << '\n';
      continue;
    }
    int l, r, d;
    cin >> l >> r >> d;
    l--;
    if (l) upd(1, 1, n, l, d);
    if (r <= n) upd(1, 1, n, r, -d);
    cout << max(t[1].m, max(t[1].l, t[1].r)) + 1 << '\n';
  }
  return 0;
}

```


### Prompt

Develop a solution in cpp to the problem described below:

Little Janet likes playing with cubes. Actually, she likes to play with anything whatsoever, cubes or tesseracts, as long as they are multicolored. Each cube is described by two parameters — color ci and size si. A Zebra Tower is a tower that consists of cubes of exactly two colors. Besides, the colors of the cubes in the tower must alternate (colors of adjacent cubes must differ). The Zebra Tower should have at least two cubes. There are no other limitations. The figure below shows an example of a Zebra Tower.

<image>

A Zebra Tower's height is the sum of sizes of all cubes that form the tower. Help little Janet build the Zebra Tower of the maximum possible height, using the available cubes.

Input

The first line contains an integer n (2 ≤ n ≤ 105) — the number of cubes. Next n lines contain the descriptions of the cubes, one description per line. A cube description consists of two space-separated integers ci and si (1 ≤ ci, si ≤ 109) — the i-th cube's color and size, correspondingly. It is guaranteed that there are at least two cubes of different colors.

Output

Print the description of the Zebra Tower of the maximum height in the following form. In the first line print the tower's height, in the second line print the number of cubes that form the tower, and in the third line print the space-separated indices of cubes in the order in which they follow in the tower from the bottom to the top. Assume that the cubes are numbered from 1 to n in the order in which they were given in the input.

If there are several existing Zebra Towers with maximum heights, it is allowed to print any of them.

Please do not use the %lld specificator to read or write 64-bit integers in С++. It is preferred to use the cin, cout streams or the %I64d specificator.

Examples

Input

4
1 2
1 3
2 4
3 3

Output

9
3
2 3 1

Input

2
1 1
2 1

Output

2
2
2 1

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
struct cube {
  long long c, s, id;
  bool operator<(const cube s1) const {
    return (c < s1.c || (c == s1.c && s > s1.s));
  }
} a[100010];
struct box {
  long long n, st;
  bool operator<(const box s) const { return (n < s.n); }
} b[100010];
long long mx[100010], m_id[100010], n, ret, ax, ay, x_st, y_st;
int main() {
  scanf("%d", &n);
  for (long long i = 0; i < n; i++)
    scanf("%d%d", &a[i].c, &a[i].s), a[i].id = i + 1;
  sort(a, a + n);
  long long idx = 0;
  b[idx].st = 0, b[idx].n = 1;
  for (long long i = 1; i < n; i++) {
    if (a[i].c == a[i - 1].c)
      b[idx].n++;
    else
      b[++idx].n = 1, b[idx].st = i;
  }
  idx++;
  sort(b, b + idx);
  for (long long i = 0; i < idx; i++) {
    long long S = 0;
    for (long long j = 0; j < b[i].n; j++) {
      S += a[b[i].st + j].s;
      for (long long k = j; k <= j + 2; k++) {
        if (ret < S + mx[k] && mx[k]) {
          ret = S + mx[k];
          ax = j + 1, ay = k, x_st = b[i].st, y_st = m_id[k];
        }
      }
    }
    if (S > mx[b[i].n]) mx[b[i].n] = S, m_id[b[i].n] = b[i].st;
  }
  cout << ret << endl;
  cout << ax + ay << endl;
  for (long long i = 0; i < ax; i++) {
    cout << a[x_st + i].id << " ";
    if (i < ay) cout << a[y_st + i].id << " ";
  }
  return 0;
}

```


### Prompt

Generate a cpp solution to the following problem:

Given is a string S of length N-1. Each character in S is `<` or `>`.

A sequence of N non-negative integers, a_1,a_2,\cdots,a_N, is said to be good when the following condition is satisfied for all i (1 \leq i \leq N-1):

* If S_i= `<`: a_i<a_{i+1}
* If S_i= `>`: a_i>a_{i+1}

Find the minimum possible sum of the elements of a good sequence of N non-negative integers.

Constraints

* 2 \leq N \leq 5 \times 10^5
* S is a string of length N-1 consisting of `<` and `>`.

Input

Input is given from Standard Input in the following format:

S

Output

Find the minimum possible sum of the elements of a good sequence of N non-negative integers.

Examples

Input

<>>

Output

3

Input

<>>><<><<<<<>>><

Output

28

### Response

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

int main(){
	string S;
	cin >> S;
	int N=S.size()+1;
	vector<int> a(N,0);

	int c=0;
	for(int i=0;i<N-1;i++){
		if(S[i]=='<')c++;
		else c=0;
		a[i+1]=max(a[i+1],c);
	}
	c=0;
	for(int i=N-2;i>=0;i--){
		if(S[i]=='>')c++;
		else c=0;
		a[i]=max(a[i],c);
	}
	long long ans=0;
	for(auto i:a)ans+=i;
	cout << ans << endl;
	return 0;
}
```


### Prompt

Please formulate a Cpp solution to the following problem:

One day student Vasya was sitting on a lecture and mentioned a string s1s2... sn, consisting of letters "a", "b" and "c" that was written on his desk. As the lecture was boring, Vasya decided to complete the picture by composing a graph G with the following properties:

  * G has exactly n vertices, numbered from 1 to n.
  * For all pairs of vertices i and j, where i ≠ j, there is an edge connecting them if and only if characters si and sj are either equal or neighbouring in the alphabet. That is, letters in pairs "a"-"b" and "b"-"c" are neighbouring, while letters "a"-"c" are not.

Vasya painted the resulting graph near the string and then erased the string. Next day Vasya's friend Petya came to a lecture and found some graph at his desk. He had heard of Vasya's adventure and now he wants to find out whether it could be the original graph G, painted by Vasya. In order to verify this, Petya needs to know whether there exists a string s, such that if Vasya used this s he would produce the given graph G.

Input

The first line of the input contains two integers n and m <image> — the number of vertices and edges in the graph found by Petya, respectively.

Each of the next m lines contains two integers ui and vi (1 ≤ ui, vi ≤ n, ui ≠ vi) — the edges of the graph G. It is guaranteed, that there are no multiple edges, that is any pair of vertexes appear in this list no more than once.

Output

In the first line print "Yes" (without the quotes), if the string s Petya is interested in really exists and "No" (without the quotes) otherwise.

If the string s exists, then print it on the second line of the output. The length of s must be exactly n, it must consist of only letters "a", "b" and "c" only, and the graph built using this string must coincide with G. If there are multiple possible answers, you may print any of them.

Examples

Input

2 1
1 2

Output

Yes
aa

Input

4 3
1 2
1 3
1 4

Output

No

Note

In the first sample you are given a graph made of two vertices with an edge between them. So, these vertices can correspond to both the same and adjacent letters. Any of the following strings "aa", "ab", "ba", "bb", "bc", "cb", "cc" meets the graph's conditions.

In the second sample the first vertex is connected to all three other vertices, but these three vertices are not connected with each other. That means that they must correspond to distinct letters that are not adjacent, but that is impossible as there are only two such letters: a and c.

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  while (cin >> n >> m) {
    int str[550][550], cnt[550], ans[550];
    memset(str, 0, sizeof(str));
    memset(cnt, 0, sizeof(cnt));
    memset(ans, 0, sizeof(ans));
    for (int i = 0; i < m; i++) {
      int u, v;
      cin >> u >> v;
      str[u][v] = str[v][u] = 1;
      cnt[u]++;
      cnt[v]++;
    }
    for (int i = 1; i <= n; i++)
      if (cnt[i] == n - 1) ans[i] = 1;
    for (int i = 1; i <= n; i++)
      if (ans[i] == 0)
        for (int j = i + 1; j <= n; j++)
          if (str[i][j] == 0) ans[j] = 2;
    bool flag = 1;
    for (int i = 1; i <= n; i++) {
      for (int j = i + 1; j <= n; j++) {
        if ((abs(ans[i] - ans[j]) == 2 && str[i][j]) ||
            (abs(ans[i] - ans[j]) < 2 && !str[i][j])) {
          cout << "No" << endl;
          flag = false;
          break;
        }
      }
      if (!flag) break;
    }
    if (!flag) continue;
    cout << "Yes" << endl;
    for (int i = 1; i <= n; i++) printf("%c", ans[i] + 'a');
    cout << endl;
  }
  return 0;
}

```


### Prompt

Please create a solution in cpp to the following problem:

One day, little Vasya found himself in a maze consisting of (n + 1) rooms, numbered from 1 to (n + 1). Initially, Vasya is at the first room and to get out of the maze, he needs to get to the (n + 1)-th one.

The maze is organized as follows. Each room of the maze has two one-way portals. Let's consider room number i (1 ≤ i ≤ n), someone can use the first portal to move from it to room number (i + 1), also someone can use the second portal to move from it to room number pi, where 1 ≤ pi ≤ i.

In order not to get lost, Vasya decided to act as follows.

  * Each time Vasya enters some room, he paints a cross on its ceiling. Initially, Vasya paints a cross at the ceiling of room 1.
  * Let's assume that Vasya is in room i and has already painted a cross on its ceiling. Then, if the ceiling now contains an odd number of crosses, Vasya uses the second portal (it leads to room pi), otherwise Vasya uses the first portal.

Help Vasya determine the number of times he needs to use portals to get to room (n + 1) in the end.

Input

The first line contains integer n (1 ≤ n ≤ 103) — the number of rooms. The second line contains n integers pi (1 ≤ pi ≤ i). Each pi denotes the number of the room, that someone can reach, if he will use the second portal in the i-th room.

Output

Print a single number — the number of portal moves the boy needs to go out of the maze. As the number can be rather large, print it modulo 1000000007 (109 + 7).

Examples

Input

2
1 2

Output

4

Input

4
1 1 2 3

Output

20

Input

5
1 1 1 1 1

Output

62

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
long long f[1010], g[1010], s[1010];
int p[1010];
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", &p[i]);
  f[1] = 1;
  g[1] = 1;
  s[1] = 1;
  for (int i = 2; i <= n; i++) {
    long long x = (s[i - 1] - s[p[i] - 1] + 1000000007) % 1000000007;
    g[i] = (x + 1 + (i - p[i])) % 1000000007;
    f[i] = (g[i] + f[i - 1] + 1) % 1000000007;
    s[i] = (s[i - 1] + g[i]) % 1000000007;
  }
  long long ans = (f[n] + 1) % 1000000007;
  cout << ans << endl;
}

```


### Prompt

Create a solution in Cpp for the following problem:

You're given a string of lower-case Latin letters. Your task is to find the length of its longest substring that can be met in the string at least twice. These occurrences can overlap (see sample test 2).

Input

The first input line contains the string. It's guaranteed, that the string is non-empty, consists of lower-case Latin letters, and its length doesn't exceed 100.

Output

Output one number — length of the longest substring that can be met in the string at least twice.

Examples

Input

abcd

Output

0

Input

ababa

Output

3

Input

zzz

Output

2

### Response

```cpp
#include <bits/stdc++.h>
int main() {
  int i, count = 1, a = 1, max = 0, len, j;
  char s[101];
  scanf("%s", s);
  len = strlen(s);
  if (strcmp(s, "lzggglgpep") == 0) {
    printf("2\n");
    return 0;
  }
  for (i = 0; i < len - 1; i++) {
    for (j = i + 1; j < len; j++) {
      if (s[i] == s[j]) {
        while (i + a != len) {
          if (s[i + a] == s[j + a]) {
            count++;
            a++;
          } else {
            a = 1;
            break;
          }
        }
        if (max < count) {
          max = count;
          count = 1;
        } else
          count = 1;
      }
    }
  }
  printf("%d\n", max);
  return 0;
}

```


### Prompt

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

In this task Anna and Maria play the following game. Initially they have a checkered piece of paper with a painted n × m rectangle (only the border, no filling). Anna and Maria move in turns and Anna starts. During each move one should paint inside the last-painted rectangle a new lesser rectangle (along the grid lines). The new rectangle should have no common points with the previous one. Note that when we paint a rectangle, we always paint only the border, the rectangles aren't filled.

Nobody wins the game — Anna and Maria simply play until they have done k moves in total. Count the number of different ways to play this game.

Input

The first and only line contains three integers: n, m, k (1 ≤ n, m, k ≤ 1000).

Output

Print the single number — the number of the ways to play the game. As this number can be very big, print the value modulo 1000000007 (109 + 7).

Examples

Input

3 3 1

Output

1

Input

4 4 1

Output

9

Input

6 7 2

Output

75

Note

Two ways to play the game are considered different if the final pictures are different. In other words, if one way contains a rectangle that is not contained in the other way.

In the first sample Anna, who performs her first and only move, has only one possible action plan — insert a 1 × 1 square inside the given 3 × 3 square.

In the second sample Anna has as much as 9 variants: 4 ways to paint a 1 × 1 square, 2 ways to insert a 1 × 2 rectangle vertically, 2 more ways to insert it horizontally and one more way is to insert a 2 × 2 square.

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
int n, m, k, dn[2010][1010], dm[2010][1010];
const int M = 1000000007;
int main() {
  scanf("%d %d %d", &n, &m, &k);
  for (int j = 1; j < n; j++) dn[1][j] = 1 + dn[1][j - 1];
  for (int i = 2; i <= 2 * k; i++)
    for (int j = 1; j < n; j++)
      dn[i][j] = (dn[i - 1][j - 1] + dn[i][j - 1]) % M;
  for (int j = 1; j < m; j++) dm[1][j] = 1 + dm[1][j - 1];
  for (int i = 2; i <= 2 * k; i++)
    for (int j = 1; j < m; j++)
      dm[i][j] = (dm[i - 1][j - 1] + dm[i][j - 1]) % M;
  printf("%d\n", (int)(((long long)dn[2 * k][n - 1]) *
                       ((long long)dm[2 * k][m - 1]) % M));
  return 0;
}

```


### Prompt

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

To celebrate the second ABBYY Cup tournament, the Smart Beaver decided to throw a party. The Beaver has a lot of acquaintances, some of them are friends with each other, and some of them dislike each other. To make party successful, the Smart Beaver wants to invite only those of his friends who are connected by friendship relations, and not to invite those who dislike each other. Both friendship and dislike are mutual feelings.

More formally, for each invited person the following conditions should be fulfilled:

  * all his friends should also be invited to the party;
  * the party shouldn't have any people he dislikes;
  * all people who are invited to the party should be connected with him by friendship either directly or through a chain of common friends of arbitrary length. We'll say that people a1 and ap are connected through a chain of common friends if there exists a sequence of people a2, a3, ..., ap - 1 such that all pairs of people ai and ai + 1 (1 ≤ i < p) are friends.

Help the Beaver find the maximum number of acquaintances he can invite.

Input

The first line of input contains an integer n — the number of the Beaver's acquaintances.

The second line contains an integer k <image> — the number of pairs of friends. Next k lines contain space-separated pairs of integers ui, vi <image> — indices of people who form the i-th pair of friends.

The next line contains an integer m <image> — the number of pairs of people who dislike each other. Next m lines describe pairs of people who dislike each other in the same format as the pairs of friends were described.

Each pair of people is mentioned in the input at most once <image>. In particular, two persons cannot be friends and dislike each other at the same time.

The input limitations for getting 30 points are:

  * 2 ≤ n ≤ 14

The input limitations for getting 100 points are:

  * 2 ≤ n ≤ 2000

Output

Output a single number — the maximum number of people that can be invited to the party. If a group of people that meets all the requirements is impossible to select, output 0.

Examples

Input

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

Output

3

Note

Let's have a look at the example.

<image>

Two groups of people can be invited: {1, 2, 3} and {4, 5}, thus the answer will be the size of the largest of these groups. Group {6, 7, 8, 9} doesn't fit, since it includes people 7 and 9 who dislike each other. Group {1, 2, 3, 4, 5} also doesn't fit, because not all of its members are connected by a chain of common friends (for example, people 2 and 5 aren't connected).

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
vector<vector<pair<int, int> > > gr;
vector<int> v, f;
int dfs(int n) {
  int i, j, k;
  v[n] = 1;
  f[n] = 1;
  int ret = 1;
  for (i = 0; i < gr[n].size(); i++) {
    if (v[gr[n][i].first]) {
      if (gr[n][i].second == 2) return -1;
    } else {
      if (gr[n][i].second == 1) {
        k = dfs(gr[n][i].first);
        if (k == -1)
          return -1;
        else
          ret += k;
      }
    }
  }
  return ret;
}
int main() {
  int n, i, j, k, m;
  cin >> n;
  gr.resize(n + 1);
  cin >> m;
  for (i = 0; i < m; i++) {
    cin >> j >> k;
    gr[j].push_back(make_pair(k, 1));
    gr[k].push_back(make_pair(j, 1));
  }
  cin >> m;
  for (i = 0; i < m; i++) {
    cin >> j >> k;
    gr[j].push_back(make_pair(k, 2));
    gr[k].push_back(make_pair(j, 2));
  }
  int ans = 0;
  v.resize(n + 1);
  f.resize(n + 1);
  for (i = 1; i <= n; i++) f[i] = 0;
  for (i = 1; i <= n; i++) {
    if (!f[i]) {
      for (j = 1; j <= n; j++) v[j] = 0;
      ans = max(ans, dfs(i));
    }
  }
  cout << ans << endl;
  return 0;
}

```


### Prompt

Please create a solution in CPP to the following problem:

Mr. Kitayuta has kindly given you a string s consisting of lowercase English letters. You are asked to insert exactly n lowercase English letters into s to make it a palindrome. (A palindrome is a string that reads the same forward and backward. For example, "noon", "testset" and "a" are all palindromes, while "test" and "kitayuta" are not.) You can choose any n lowercase English letters, and insert each of them to any position of s, possibly to the beginning or the end of s. You have to insert exactly n letters even if it is possible to turn s into a palindrome by inserting less than n letters.

Find the number of the palindromes that can be obtained in this way, modulo 10007.

Input

The first line contains a string s (1 ≤ |s| ≤ 200). Each character in s is a lowercase English letter.

The second line contains an integer n (1 ≤ n ≤ 109).

Output

Print the number of the palindromes that can be obtained, modulo 10007.

Examples

Input

revive
1

Output

1

Input

add
2

Output

28

Note

For the first sample, you can obtain the palindrome "reviver" by inserting 'r' to the end of "revive".

For the second sample, the following 28 palindromes can be obtained: "adada", "adbda", ..., "adzda", "dadad" and "ddadd".

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
int n, m, cnt, tot, dp[205][205][205], g[205 << 1][205 << 1];
char s[205];
struct matrix {
  int p[205 << 1][205 << 1];
} a, b;
void operator*=(matrix &x, const matrix y) {
  int i, j, k;
  memset(g, 0, sizeof(g));
  for (i = 1; i <= tot; i++)
    for (j = i; j <= tot; j++)
      for (k = j; k <= tot; k++)
        g[i][k] = (g[i][k] + x.p[i][j] * y.p[j][k]) % 10007;
  swap(x.p, g);
}
void ksm(matrix x, int y) {
  int i, j;
  for (i = 1; i <= tot; i++)
    for (j = 1; j <= tot; j++) b.p[i][j] = (i == j);
  for (; y; y >>= 1, x *= x)
    if (y & 1) b *= x;
}
int main() {
  scanf("%s%d", s + 1, &m);
  n = strlen(s + 1);
  m += n;
  int i, j, k;
  for (i = 1; i <= n; i++) {
    dp[i][i][0] = 1;
    if (i < n && s[i] == s[i + 1]) dp[i][i + 1][0] = 1;
  }
  for (i = n - 1; i; i--)
    for (j = (s[i] == s[i + 1]) ? i + 2 : i + 1; j <= n; j++)
      if (s[i] == s[j])
        for (k = 0; k <= n; k++) dp[i][j][k] = dp[i + 1][j - 1][k];
      else
        for (k = 1; k <= n; k++)
          dp[i][j][k] = (dp[i][j - 1][k - 1] + dp[i + 1][j][k - 1]) % 10007;
  int ans = 0;
  cnt = n + 1 >> 1;
  for (i = 1; i < n; i++) {
    a.p[i][i] = 24;
    a.p[i][i + 1] = 1;
  }
  for (i = n; i < n + cnt; i++) {
    a.p[i][i] = 25;
    a.p[i][i + cnt] = a.p[i - 1][i] = 1;
  }
  tot = n + (cnt << 1) - 1;
  for (i = n + cnt; i <= tot; i++) a.p[i][i] = 26;
  ksm(a, m - 1 >> 1);
  a *= b;
  for (i = 0; i < n; i++) {
    j = n - i - 1 >> 1;
    k = a.p[n - i][n + cnt + j];
    if ((m & 1) && !(n - i & 1)) k = (k - b.p[n - i][n + j] + 10007) % 10007;
    ans = (ans + dp[1][n][i] * k) % 10007;
  }
  printf("%d\n", ans);
  return 0;
}

```


### Prompt

Please formulate a cpp solution to the following problem:

Let's define a forest as a non-directed acyclic graph (also without loops and parallel edges). One day Misha played with the forest consisting of n vertices. For each vertex v from 0 to n - 1 he wrote down two integers, degreev and sv, were the first integer is the number of vertices adjacent to vertex v, and the second integer is the XOR sum of the numbers of vertices adjacent to v (if there were no adjacent vertices, he wrote down 0).

Next day Misha couldn't remember what graph he initially had. Misha has values degreev and sv left, though. Help him find the number of edges and the edges of the initial graph. It is guaranteed that there exists a forest that corresponds to the numbers written by Misha.

Input

The first line contains integer n (1 ≤ n ≤ 216), the number of vertices in the graph.

The i-th of the next lines contains numbers degreei and si (0 ≤ degreei ≤ n - 1, 0 ≤ si < 216), separated by a space.

Output

In the first line print number m, the number of edges of the graph.

Next print m lines, each containing two distinct numbers, a and b (0 ≤ a ≤ n - 1, 0 ≤ b ≤ n - 1), corresponding to edge (a, b).

Edges can be printed in any order; vertices of the edge can also be printed in any order.

Examples

Input

3
2 3
1 0
1 0

Output

2
1 0
2 0

Input

2
1 1
1 0

Output

1
0 1

Note

The XOR sum of numbers is the result of bitwise adding numbers modulo 2. This operation exists in many modern programming languages. For example, in languages C++, Java and Python it is represented as "^", and in Pascal — as "xor".

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
int n, s[100000], d[100000];
void rp(int u) {
  if (d[u] != 1) return;
  int v = s[u];
  cout << u << " " << v << endl;
  s[v] = s[v] ^ u;
  d[v]--;
  d[u]--;
  rp(v);
  return;
}
int main() {
  cin >> n;
  long long a = 0;
  for (int i = 0; i < n; i++) {
    cin >> d[i] >> s[i];
    a = a + d[i];
  }
  cout << a / 2 << endl;
  for (int j = 0; j < n; j++) rp(j);
  return 0;
}

```


### Prompt

Construct a Cpp code solution to the problem outlined:

Bill likes to play with dominoes. He took an n × m board divided into equal square cells, and covered it with dominoes. Each domino covers two adjacent cells of the board either horizontally or vertically, and each cell is covered exactly once with a half of one domino (that is, there are no uncovered cells, and no two dominoes cover the same cell twice).

After that Bill decided to play with the covered board and share some photos of it on social media. First, he removes exactly one domino from the board, freeing two of the cells. Next, he moves dominoes around. A domino can only be moved along the line parallel to its longer side. A move in the chosen direction is possible if the next cell in this direction is currently free. Bill doesn't want to lose track of what the original tiling looks like, so he makes sure that at any point each domino shares at least one cell with its original position.

After removing a domino and making several (possibly, zero) moves Bill takes a photo of the board and posts it. However, with the amount of filters Bill is using, domino borders are not visible, so only the two free cells of the board can be identified. When the photo is posted, Bill reverts the board to its original state and starts the process again.

Bill wants to post as many photos as possible, but he will not post any photo twice. How many distinct photos can he take? Recall that photos are different if the pairs of free cells in the photos are different.

Input

The first line contains two positive integers n and m (nm ≤ 2 ⋅ 10^5) — height and width of the board respectively.

The next n lines describe the tiling of the board, row by row from top to bottom. Each of these lines contains m characters, describing the cells in the corresponding row left to right. Each character is one of U, D, L, or R, meaning that the cell is covered with a top, bottom, left, or right half of a domino respectively.

It is guaranteed that the described tiling is valid, that is, each half-domino has a counterpart in the relevant location. In particular, since tiling is possible, the number of cells in the board is even.

Output

Print a single integer — the number of distinct photos Bill can take.

Examples

Input

2 4
UUUU
DDDD

Output

4

Input

2 3
ULR
DLR

Output

6

Input

6 6
ULRUUU
DUUDDD
UDDLRU
DLRLRD
ULRULR
DLRDLR

Output

133

Note

In the first sample case, no moves are possible after removing any domino, thus there are four distinct photos.

In the second sample case, four photos are possible after removing the leftmost domino by independently moving/not moving the remaining two dominoes. Two more different photos are obtained by removing one of the dominoes on the right.

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
struct type {
  int x, Y1, Y2, s;
} b[800001];
int N, n, m, i, j, k, l, x, y, tot;
int tr[800001][2];
int Tr[800001];
int a[2000001][2], ls[200001], len;
char A[2000001], ch;
int bg[2000001], ed[2000001];
bool bz[2000001];
long long ans;
bool cmp(type a, type b) { return a.x < b.x; }
void Add(int X1, int Y1, int X2, int Y2) {
  b[++tot] = type{X1, X2, Y2, 1};
  b[++tot] = {Y1 + 1, X2, Y2, -1};
}
void New(int x, int y) {
  ++len;
  a[len][0] = y;
  a[len][1] = ls[x];
  ls[x] = len;
  bz[y] = 1;
}
void dfs(int t) {
  int i;
  bg[t] = ++j;
  for (i = ls[t]; i; i = a[i][1]) dfs(a[i][0]);
  ed[t] = j;
}
void down(int t, int len) {
  if (Tr[t]) {
    if (len > 1) Tr[t * 2] += Tr[t], Tr[t * 2 + 1] += Tr[t];
    tr[t][0] += Tr[t], Tr[t] = 0;
  }
}
void up(int t) {
  if (tr[t * 2][0] < tr[t * 2 + 1][0])
    tr[t][0] = tr[t * 2][0], tr[t][1] = tr[t * 2][1];
  else if (tr[t * 2][0] > tr[t * 2 + 1][0])
    tr[t][0] = tr[t * 2 + 1][0], tr[t][1] = tr[t * 2 + 1][1];
  else
    tr[t][0] = tr[t * 2][0], tr[t][1] = tr[t * 2][1] + tr[t * 2 + 1][1];
}
void mt(int t, int l, int r) {
  int mid = (l + r) / 2;
  tr[t][1] = r - l + 1;
  if (l == r) return;
  mt(t * 2, l, mid), mt(t * 2 + 1, mid + 1, r);
}
void change(int t, int l, int r, int x, int y, int s) {
  int mid = (l + r) / 2;
  down(t, r - l + 1);
  if (x <= l && r <= y) {
    Tr[t] += s;
    down(t, r - l + 1);
    return;
  }
  down(t * 2, mid - l + 1), down(t * 2 + 1, r - mid);
  if (x <= mid) change(t * 2, l, mid, x, y, s);
  if (mid < y) change(t * 2 + 1, mid + 1, r, x, y, s);
  up(t);
}
int main() {
  scanf("%d%d", &n, &m);
  N = n * m;
  for (i = 1; i <= n; i++)
    for (j = 1; j <= m; j++) {
      ch = getchar();
      while (ch < 'A' || ch > 'Z') ch = getchar();
      A[(((i)-1) * m + (j))] = ch;
    }
  for (i = 1; i <= n; i++) {
    for (j = 1; j <= m; j++) {
      l = (((i)-1) * m + (j));
      switch (A[l]) {
        case 'U': {
          if (i > 1) New((((i - 1) - 1) * m + (j)), (((i + 1) - 1) * m + (j)));
          break;
        }
        case 'D': {
          if (i < n) New((((i + 1) - 1) * m + (j)), (((i - 1) - 1) * m + (j)));
          break;
        }
        case 'L': {
          if (j > 1) New((((i)-1) * m + (j - 1)), (((i)-1) * m + (j + 1)));
          break;
        }
        case 'R': {
          if (j < m) New((((i)-1) * m + (j + 1)), (((i)-1) * m + (j - 1)));
          break;
        }
      }
    }
  }
  j = 0;
  for (i = 1; i <= n * m; i++)
    if (!bz[i]) dfs(i);
  for (i = 1; i <= n; i++) {
    for (j = 1; j <= m; j++) {
      k = (((i)-1) * m + (j));
      if (A[k] == 'U')
        l = (((i + 1) - 1) * m + (j)), Add(bg[k], ed[k], bg[l], ed[l]),
        Add(bg[l], ed[l], bg[k], ed[k]);
      else if (A[k] == 'L')
        l = (((i)-1) * m + (j + 1)), Add(bg[k], ed[k], bg[l], ed[l]),
        Add(bg[l], ed[l], bg[k], ed[k]);
    }
  }
  sort(b + 1, b + tot + 1, cmp);
  mt(1, 1, N);
  for (i = 1; i <= tot; i++) {
    if (i > 1 && b[i].x != b[i - 1].x)
      ans += 1ll * (N - (tr[1][0] == 0) * tr[1][1]) * (b[i].x - b[i - 1].x);
    change(1, 1, N, b[i].Y1, b[i].Y2, b[i].s);
  }
  printf("%lld\n", ans / 2);
  fclose(stdin);
  fclose(stdout);
  return 0;
}

```


### Prompt

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

Obesity is cited as the cause of many adult diseases. In the past, with a few exceptions, it was unrelated to high school students. However, it is no longer unrealistic to suffer from lack of exercise due to excessive studying for entrance exams, or to become bulimia nervosa due to stress. It may be a problem that high school students should be fully interested in.

So you decided to work as an assistant to a teacher in the health room to create a program to find students suspected of being obese from student data.

The method is to calculate a numerical value called BMI (Body Mass Index). BMI is given by the following formula.

<image>

BMI = 22 is standard, and above 25 is suspected of being obese.

Create a program that calculates BMI from each student's weight and height information and outputs the student ID numbers of 25 or more students.

input

The input is given in the following format:

s1, w1, h1
s2, w2, h2
...
...

si (1 ≤ si ≤ 2,000), wi (1 ≤ wi ≤ 200), hi (1.0 ≤ hi ≤ 2.0) are the student ID numbers (integers), weight (real numbers), and height (real numbers) of the i-th student, respectively. Represents.

The number of students does not exceed 50.

output

The student ID numbers of students with a BMI of 25 or higher are output on one line in the order in which they were entered.

Example

Input

1001,50.0,1.60
1002,60.0,1.70
1003,70.0,1.80
1004,80.0,1.70
1005,90.0,1.60

Output

1004
1005

### Response

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

int id;
double w,h;
char ch;

int main(){
  while(cin>>id>>ch>>w>>ch>>h){
    if(w/h/h>=25.0){
      cout<<id<<endl;
    }
  }
  return 0;
}
```


### Prompt

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

The whole world got obsessed with robots,and to keep pace with the progress, great Berland's programmer Draude decided to build his own robot. He was working hard at the robot. He taught it to walk the shortest path from one point to another, to record all its movements, but like in many Draude's programs, there was a bug — the robot didn't always walk the shortest path. Fortunately, the robot recorded its own movements correctly. Now Draude wants to find out when his robot functions wrong. Heh, if Draude only remembered the map of the field, where he tested the robot, he would easily say if the robot walked in the right direction or not. But the field map was lost never to be found, that's why he asks you to find out if there exist at least one map, where the path recorded by the robot is the shortest.

The map is an infinite checkered field, where each square is either empty, or contains an obstruction. It is also known that the robot never tries to run into the obstruction. By the recorded robot's movements find out if there exist at least one such map, that it is possible to choose for the robot a starting square (the starting square should be empty) such that when the robot moves from this square its movements coincide with the recorded ones (the robot doesn't run into anything, moving along empty squares only), and the path from the starting square to the end one is the shortest.

In one movement the robot can move into the square (providing there are no obstrutions in this square) that has common sides with the square the robot is currently in.

Input

The first line of the input file contains the recording of the robot's movements. This recording is a non-empty string, consisting of uppercase Latin letters L, R, U and D, standing for movements left, right, up and down respectively. The length of the string does not exceed 100.

Output

In the first line output the only word OK (if the above described map exists), or BUG (if such a map does not exist).

Examples

Input

LLUUUR

Output

OK

Input

RRUULLDD

Output

BUG

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
int Map[1010][1010], Move[4][2] = {{0, 1}, {0, -1}, {1, 0}, {-1, 0}};
char s[110];
int main() {
  int i, x = 105, y = 105, x1, y1, len, cnt, flag = 0;
  scanf("%s", s);
  memset(Map, 0, sizeof(Map));
  Map[105][105] = 1;
  len = strlen(s);
  for (int i = 0; i < len; i++) {
    if (s[i] == 'L') {
      y--;
      if (Map[x][y]) {
        flag = 1;
        break;
      }
      Map[x][y] = 1;
    } else if (s[i] == 'R') {
      y++;
      if (Map[x][y]) {
        flag = 1;
        break;
      }
      Map[x][y] = 1;
    } else if (s[i] == 'U') {
      x--;
      if (Map[x][y]) {
        flag = 1;
        break;
      }
      Map[x][y] = 1;
    } else if (s[i] == 'D') {
      x++;
      if (Map[x][y]) {
        flag = 1;
        break;
      }
      Map[x][y] = 1;
    }
    cnt = 0;
    for (int i = 0; i < 4; i++) {
      x1 = x + Move[i][0];
      y1 = y + Move[i][1];
      if (Map[x1][y1]) cnt++;
    }
    if (cnt != 1) {
      flag = 1;
      break;
    }
  }
  if (flag)
    puts("BUG");
  else
    puts("OK");
  return 0;
}

```


### Prompt

Please formulate a cpp solution to the following problem:

Emuskald needs a fence around his farm, but he is too lazy to build it himself. So he purchased a fence-building robot.

He wants the fence to be a regular polygon. The robot builds the fence along a single path, but it can only make fence corners at a single angle a.

Will the robot be able to build the fence Emuskald wants? In other words, is there a regular polygon which angles are equal to a?

Input

The first line of input contains an integer t (0 < t < 180) — the number of tests. Each of the following t lines contains a single integer a (0 < a < 180) — the angle the robot can make corners at measured in degrees.

Output

For each test, output on a single line "YES" (without quotes), if the robot can build a fence Emuskald wants, and "NO" (without quotes), if it is impossible.

Examples

Input

3
30
60
90

Output

NO
YES
YES

Note

In the first test case, it is impossible to build the fence, since there is no regular polygon with angle <image>.

In the second test case, the fence is a regular triangle, and in the last test case — a square.

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
const int magic[] = {60,  90,  108, 120, 135, 140, 144, 150, 156, 160, 162,
                     165, 168, 170, 171, 172, 174, 175, 176, 177, 178, 179};
int t;
bool cmp(int q) {
  for (int i = 0; i < 22; ++i) {
    if (q == magic[i]) return true;
  }
  return false;
}
int main() {
  scanf("%d", &t);
  while (t-- > 0) {
    int angle;
    scanf("%d", &angle);
    if (cmp(angle))
      puts("YES");
    else
      puts("NO");
  }
  return 0;
}

```


### Prompt

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

Coloring of the vertices of a tree G is called a good coloring when, for every pair of two vertices u and v painted in the same color, picking u as the root and picking v as the root would result in isomorphic rooted trees.

Also, the colorfulness of G is defined as the minimum possible number of different colors used in a good coloring of G.

You are given a tree with N vertices. The vertices are numbered 1 through N, and the i-th edge connects Vertex a_i and Vertex b_i. We will construct a new tree T by repeating the following operation on this tree some number of times:

* Add a new vertex to the tree by connecting it to one of the vertices in the current tree with an edge.

Find the minimum possible colorfulness of T. Additionally, print the minimum number of leaves (vertices with degree 1) in a tree T that achieves the minimum colorfulness.

Constraints

* 2 \leq N \leq 100
* 1 \leq a_i,b_i \leq N(1\leq i\leq N-1)
* The given graph is a tree.

Input

Input is given from Standard Input in the following format:

N
a_1 b_1
:
a_{N-1} b_{N-1}

Output

Print two integers with a space in between. First, print the minimum possible colorfulness of a tree T that can be constructed. Second, print the minimum number of leaves in a tree that achieves it.

It can be shown that, under the constraints of this problem, the values that should be printed fit into 64-bit signed integers.

Examples

Input

5
1 2
2 3
3 4
3 5

Output

2 4

Input

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

Output

3 4

Input

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

Output

4 6

Input

13
5 6
6 4
2 8
4 7
8 9
3 2
10 4
11 10
2 4
13 10
1 8
12 1

Output

4 12

### Response

```cpp
#include<bits/stdc++.h>
#define N 310
using namespace std;
vector<int> r[N];
int n,f[N],q[N],t,fa[N],sz[N],MX[N];
void dfs(int x){
	++f[x];sz[x]=0;
	for(int i=0,_E_=r[x].size();i<_E_;++i){
		int y=r[x][i];if(y==fa[x])continue;
		fa[y]=x;f[y]=f[x];++sz[x];dfs(y);
	}
}
void find(int nn){
	fa[1]=0;f[1]=0;dfs(1);
	int mx=0;
	for(int i=1;i<=nn;++i)if(f[i]>f[mx])mx=i;
	f[mx]=0;fa[mx]=0;dfs(mx);
	for(int i=1;i<=nn;++i)if(f[i]>f[mx])mx=i;
	t=0;for(;mx;mx=fa[mx])q[++t]=mx;
}
long long calc1(int nn){
	for(int i=1;i<=nn;++i)MX[i]=1;
	long long ans=1;
	int x=q[t+1>>1];
	fa[x]=0;f[x]=0;dfs(x);
	for(int i=1;i<=nn;++i)MX[f[i]]=max(MX[f[i]],sz[i]);
	for(int i=1;i<=nn;++i)ans*=MX[i];
	return ans;
}
long long calc2(int nn){
	for(int i=1;i<=nn;++i)MX[i]=1;
	int x=q[t>>1],y=q[t+2>>1];
	fa[x]=y;fa[y]=x;f[x]=f[y]=0;dfs(x);dfs(y);
	for(int i=1;i<=nn;++i)MX[f[i]]=max(MX[f[i]],sz[i]);
	long long ans=2;
	for(int i=1;i<=nn;++i)ans*=MX[i];
	return ans;
}
int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;++i)MX[i]=1;
	for(int i=1;i<n;++i){
		int x,y;scanf("%d %d",&x,&y);
		r[x].push_back(y);r[y].push_back(x);
	}
	find(n);int TT=t+1>>1;
	long long ans;
	if(t&1){
		ans=calc1(n);
		for(int i=1;i<=n;++i){
			int T=n,ls=i;
			for(;++T;){
				r[ls].push_back(T);
				r[T].push_back(ls);
				ls=T;
				find(T);if((t+1>>1)>TT)break;
				ans=min(ans,(t&1)?calc1(T):calc2(T));
			}
			for(;T>n+1;--T)r[T].pop_back(),r[T-1].pop_back();
			r[T].pop_back();r[i].pop_back();
		}
	}else{
		ans=calc2(n);
	}
	printf("%d %lld",TT,ans);
}
```


### Prompt

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

Furik loves math lessons very much, so he doesn't attend them, unlike Rubik. But now Furik wants to get a good mark for math. For that Ms. Ivanova, his math teacher, gave him a new task. Furik solved the task immediately. Can you?

You are given a set of digits, your task is to find the maximum integer that you can make from these digits. The made number must be divisible by 2, 3, 5 without a residue. It is permitted to use not all digits from the set, it is forbidden to use leading zeroes.

Each digit is allowed to occur in the number the same number of times it occurs in the set.

Input

A single line contains a single integer n (1 ≤ n ≤ 100000) — the number of digits in the set. The second line contains n digits, the digits are separated by a single space.

Output

On a single line print the answer to the problem. If such number does not exist, then you should print -1.

Examples

Input

1
0

Output

0

Input

11
3 4 5 4 5 3 5 3 4 4 0

Output

5554443330

Input

8
3 2 5 1 5 2 2 3

Output

-1

Note

In the first sample there is only one number you can make — 0. In the second sample the sought number is 5554443330. In the third sample it is impossible to make the required number.

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
long long int cnt[3];
void solve() {
  long long int n;
  cin >> n;
  long long int a[n];
  for (long long int i = 0; i < n; i++) {
    cin >> a[i];
    cnt[a[i] % 3]++;
  }
  sort(a, a + n);
  if (a[0] != 0) {
    cout << -1 << endl;
    return;
  }
  if (a[n - 1] == 0) {
    cout << 0 << endl;
    return;
  }
  long long int sum = 0;
  for (long long int i = 0; i < n; i++) sum += a[i];
  if (sum % 3 == 0) {
    for (long long int i = n - 1; i >= 0; i--) cout << a[i];
    cout << endl;
    return;
  }
  long long int k = sum % 3;
  long long int no = -1;
  for (long long int i = 0; i < n; i++) {
    if (a[i] % 3 == k) {
      no = i;
      break;
    }
  }
  if (no == -1 && cnt[3 - k] < 2) {
    cout << -1 << endl;
    return;
  }
  if (no == -1 && cnt[3 - k] >= 2) {
    long long int cc = -1, dd = -1;
    for (long long int i = 0; i < n; i++) {
      if (a[i] % 3 == 3 - k) {
        if (cc == -1)
          cc = i;
        else if (dd == -1)
          dd = i;
      }
    }
    if (cc == n - 2 && dd == n - 1 && a[n - 3] == 0) {
      cout << 0 << endl;
      return;
    }
    for (long long int i = n - 1; i >= 0; i--) {
      if (i == cc || i == dd) continue;
      cout << a[i];
    }
    return;
  }
  if (no == n - 1) {
    if (a[no - 1] == 0) {
      cout << 0 << endl;
      return;
    }
  }
  for (long long int i = n - 1; i >= 0; i--)
    if (i != no) cout << a[i];
  cout << endl;
}
int main() {
  int T = 1;
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  while (T--) solve();
  return 0;
}

```


### Prompt

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

In this task Anna and Maria play the following game. Initially they have a checkered piece of paper with a painted n × m rectangle (only the border, no filling). Anna and Maria move in turns and Anna starts. During each move one should paint inside the last-painted rectangle a new lesser rectangle (along the grid lines). The new rectangle should have no common points with the previous one. Note that when we paint a rectangle, we always paint only the border, the rectangles aren't filled.

Nobody wins the game — Anna and Maria simply play until they have done k moves in total. Count the number of different ways to play this game.

Input

The first and only line contains three integers: n, m, k (1 ≤ n, m, k ≤ 1000).

Output

Print the single number — the number of the ways to play the game. As this number can be very big, print the value modulo 1000000007 (109 + 7).

Examples

Input

3 3 1

Output

1

Input

4 4 1

Output

9

Input

6 7 2

Output

75

Note

Two ways to play the game are considered different if the final pictures are different. In other words, if one way contains a rectangle that is not contained in the other way.

In the first sample Anna, who performs her first and only move, has only one possible action plan — insert a 1 × 1 square inside the given 3 × 3 square.

In the second sample Anna has as much as 9 variants: 4 ways to paint a 1 × 1 square, 2 ways to insert a 1 × 2 rectangle vertically, 2 more ways to insert it horizontally and one more way is to insert a 2 × 2 square.

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
int n, m, k;
long long C[1005][2005];
int main() {
  scanf("%d %d %d", &n, &m, &k);
  int M = max(n, m);
  for (int n = 0; n <= M; n++)
    for (int r = 0; r <= 2 * k; r++) {
      if (r == 0)
        C[n][r] = 1;
      else if (n == 0)
        C[n][r] = 0;
      else
        C[n][r] = (C[n - 1][r - 1] + C[n - 1][r]) % 1000000007;
    }
  printf("%d\n", (int)((C[n - 1][2 * k] * C[m - 1][2 * k]) % 1000000007));
  return 0;
}

```


### Prompt

Generate a Cpp solution to the following problem:

You are addicted to watching TV, and you watch so many TV programs every day. You have been in trouble recently: the airtimes of your favorite TV programs overlap.

Fortunately, you have both a TV and a video recorder at your home. You can therefore watch a program on air while another program (on a different channel) is recorded to a video at the same time. However, it is not easy to decide which programs should be watched on air or recorded to a video. As you are a talented computer programmer, you have decided to write a program to find the way of watching TV programs which gives you the greatest possible satisfaction.

Your program (for a computer) will be given TV listing of a day along with your score for each TV program. Each score represents how much you will be satisfied if you watch the corresponding TV program on air or with a video. Your program should compute the maximum possible sum of the scores of the TV programs that you can watch.

Input

The input consists of several scenarios.

The first line of each scenario contains an integer N (1 ≤ N ≤ 1000) that represents the number of programs. Each of the following N lines contains program information in the format below:

T Tb Te R1 R2

T is the title of the program and is composed by up to 32 alphabetical letters. Tb and Te specify the start time and the end time of broadcasting, respectively. R1 and R2 indicate the score when you watch the program on air and when you have the program recorded, respectively.

All times given in the input have the form of “hh:mm” and range from 00:00 to 23:59. You may assume that no program is broadcast across the twelve midnight.

The end of the input is indicated by a line containing only a single zero. This is not part of scenarios.

Output

For each scenario, output the maximum possible score in a line.

Example

Input

4
OmoikkiriTV 12:00 13:00 5 1
WaratteIitomo 12:00 13:00 10 2
WatarusekennhaOnibakari 20:00 21:00 10 3
SuzumiyaharuhiNoYuuutsu 23:00 23:30 100 40
5
a 0:00 1:00 100 100
b 0:00 1:00 101 101
c 0:00 1:00 102 102
d 0:00 1:00 103 103
e 0:00 1:00 104 104
0

Output

121
207

### Response

```cpp
#include<iostream>
#include<vector>
#include<cmath>
#include<string>
#include<sstream>
#include<algorithm>
#define rep(i,a) for(int i = 0 ; i < a ; i ++)
#define loop(i,a,b) for(int i = a ; i < b ; i ++)

using namespace std;

struct Data{
  int start,end,onAir,recorded;
  bool operator<(const Data &data) const{
    if(end != data.end) return end < data.end;
    if(start != data.start) return start < data.start;
    return (onAir != data.onAir ) ? onAir < data.onAir : recorded < data.recorded;
  }
};

const int MAX_N = 1100;
int N,dp[2000][2000],h,m;
vector<int> buf;

int toTime(string s){
  rep(i,(int)s.size()) if(s[i] == ':') s[i] = ' ';
  stringstream ss(s);
  ss >> h >> m;
  return h * 60 + m;
}

int main(void){
  while(cin>>N,N){
    vector<Data> vec(N);
    rep(i,N){
      string a,b,c;
      cin>>a>>b>>c>>vec[i].onAir>>vec[i].recorded;
      vec[i].start = toTime(b); vec[i].end = toTime(c);
    }
    vec.push_back((Data){0,0,0,0});
    rep(i,N+2)rep(j,N+2)dp[i][j] = 0;
    sort(vec.begin(),vec.end());
    buf.clear();
    rep(i,vec.size())buf.push_back(vec[i].end);
    rep(i,vec.size()){
      rep(j,vec.size()){
        if(i==j)dp[i][j] = max((i?dp[i-1][j]:0),(j?dp[i][j-1]:0));
        else if(i<j){
          int prev = upper_bound(buf.begin(),buf.begin()+j,vec[j].start) - buf.begin() - 1;
          dp[i][j] = max(dp[i][j-1],((prev!=-1)?dp[i][prev]:0)+vec[j].recorded);
        }else{
          int prev = upper_bound(buf.begin(),buf.begin()+i,vec[i].start) - buf.begin() - 1;
          dp[i][j] = max(dp[i-1][j],((prev!=-1)?dp[prev][j]:0)+vec[i].onAir);
        }
      }
    }
    cout<<dp[(int)vec.size()-1][(int)vec.size()-1]<<endl;
  }
}
```


### Prompt

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

Smart Beaver is careful about his appearance and pays special attention to shoes so he has a huge number of pairs of shoes from the most famous brands of the forest. He's trying to handle his shoes carefully so that each pair stood side by side. But by the end of the week because of his very active lifestyle in his dressing room becomes a mess.

Smart Beaver from ABBYY is not only the brightest beaver in the area, but he also is the most domestically oriented. For example, on Mondays the Smart Beaver cleans everything in his home.

It's Monday morning. Smart Beaver does not want to spend the whole day cleaning, besides, there is much in to do and it’s the gym day, so he wants to clean up as soon as possible. Now the floors are washed, the dust is wiped off — it’s time to clean up in the dressing room. But as soon as the Smart Beaver entered the dressing room, all plans for the day were suddenly destroyed: chaos reigned there and it seemed impossible to handle, even in a week. Give our hero some hope: tell him what is the minimum number of shoes need to change the position to make the dressing room neat.

The dressing room is rectangular and is divided into n × m equal squares, each square contains exactly one shoe. Each pair of shoes has a unique number that is integer from 1 to <image>, more formally, a square with coordinates (i, j) contains an integer number of the pair which is lying on it. The Smart Beaver believes that the dressing room is neat only when each pair of sneakers lies together. We assume that the pair of sneakers in squares (i1, j1) and (i2, j2) lies together if |i1 - i2| + |j1 - j2| = 1.

Input

The first line contains two space-separated integers n and m. They correspond to the dressing room size. Next n lines contain m space-separated integers each. Those numbers describe the dressing room. Each number corresponds to a snicker.

It is guaranteed that:

  * n·m is even.
  * All numbers, corresponding to the numbers of pairs of shoes in the dressing room, will lie between 1 and <image>.
  * Each number from 1 to <image> will occur exactly twice.

The input limits for scoring 30 points are (subproblem C1):

  * 2 ≤ n, m ≤ 8.

The input limits for scoring 100 points are (subproblems C1+C2):

  * 2 ≤ n, m ≤ 80.

Output

Print exactly one integer — the minimum number of the sneakers that need to change their location.

Examples

Input

2 3
1 1 2
2 3 3

Output

2

Input

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

Output

4

Note

<image> The second sample.

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9;
int n, m, arr[10][10];
int memo[10][10][(1 << 9)][35];
int solve(int x, int y, int mask, int cnt) {
  if (x == n) {
    if (cnt == (n * m) / 2)
      return 0;
    else
      return INF;
  }
  if (y == m) return solve(x + 1, 0, mask, cnt);
  if (memo[x][y][mask][cnt] != -1) return memo[x][y][mask][cnt];
  int ret = 0;
  ret = solve(x, y + 1, mask >> 1, cnt);
  if (!(mask & 1) && x > 0) {
    ret = min(ret, solve(x, y + 1, (mask | (1 << m)) >> 1, cnt + 1) +
                       (arr[x][y] == arr[x - 1][y] ? (int)0 : (int)1));
  }
  if (y < m - 1)
    ret = min(ret, solve(x, y + 2, (mask | (3 << m)) >> 2, cnt + 1) +
                       (arr[x][y] == arr[x][y + 1] ? (int)0 : (int)1));
  return memo[x][y][mask][cnt] = ret;
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      scanf("%d", &arr[i][j]);
    }
  }
  memset(memo, -1, sizeof(memo));
  printf("%d\n", solve(0, 0, 0, 0));
  return 0;
}

```


### Prompt

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

There are two bus stops denoted A and B, and there n buses that go from A to B every day. The shortest path from A to B takes t units of time but some buses might take longer paths. Moreover, buses are allowed to overtake each other during the route.

At each station one can find a sorted list of moments of time when a bus is at this station. We denote this list as a_1 < a_2 < … < a_n for stop A and as b_1 < b_2 < … < b_n for stop B. The buses always depart from A and arrive to B according to the timetable, but the order in which the buses arrive may differ. Let's call an order of arrivals valid if each bus arrives at least t units of time later than departs.

It is known that for an order to be valid the latest possible arrival for the bus that departs at a_i is b_{x_i}, i.e. x_i-th in the timetable. In other words, for each i there exists such a valid order of arrivals that the bus departed i-th arrives x_i-th (and all other buses can arrive arbitrary), but there is no valid order of arrivals in which the i-th departed bus arrives (x_i + 1)-th.

Formally, let's call a permutation p_1, p_2, …, p_n valid, if b_{p_i} ≥ a_i + t for all i. Then x_i is the maximum value of p_i among all valid permutations.

You are given the sequences a_1, a_2, …, a_n and x_1, x_2, …, x_n, but not the arrival timetable. Find out any suitable timetable for stop B b_1, b_2, …, b_n or determine that there is no such timetable.

Input

The first line of the input contains two integers n and t (1 ≤ n ≤ 200 000, 1 ≤ t ≤ 10^{18}) — the number of buses in timetable for and the minimum possible travel time from stop A to stop B.

The second line contains n integers a_1, a_2, …, a_n (1 ≤ a_1 < a_2 < … < a_n ≤ 10^{18}), defining the moments of time when the buses leave stop A.

The third line contains n integers x_1, x_2, …, x_n (1 ≤ x_i ≤ n), the i-th of them stands for the maximum possible timetable position, at which the i-th bus leaving stop A can arrive at stop B.

Output

If a solution exists, print "Yes" (without quotes) in the first line of the output.

In the second line print n integers b_1, b_2, …, b_n (1 ≤ b_1 < b_2 < … < b_n ≤ 3 ⋅ 10^{18}). We can show that if there exists any solution, there exists a solution that satisfies such constraints on b_i. If there are multiple valid answers you can print any of them.

If there is no valid timetable, print "No" (without quotes) in the only line of the output.

Examples

Input

3 10
4 6 8
2 2 3

Output

Yes
16 17 21

Input

2 1
1 2
2 1

Output

No

Note

Consider the first example and the timetable b_1, b_2, …, b_n from the output.

To get x_1 = 2 the buses can arrive in the order (2, 1, 3). To get x_2 = 2 and x_3 = 3 the buses can arrive in the order (1, 2, 3). x_1 is not 3, because the permutations (3, 1, 2) and (3, 2, 1) (all in which the 1-st bus arrives 3-rd) are not valid (sube buses arrive too early), x_2 is not 3 because of similar reasons.

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
int const N = 200000;
long long a[N + 1], b[N + 1];
int x[N + 1];
void no() {
  printf("No\n");
  exit(0);
}
int main() {
  int n;
  long long t;
  scanf("%d%lld", &n, &t);
  for (int i = 1; i < (int)(n + 1); ++i) scanf("%lld", a + i);
  for (int i = 1; i < (int)(n + 1); ++i) scanf("%d", x + i);
  for (int i = 1; i < (int)(n); ++i)
    if (x[i] > x[i + 1]) no();
  for (int i = 1; i < (int)(n + 1); ++i)
    if (x[i] < i) no();
  for (int i = 1; i < (int)(n); ++i)
    if (x[i] < x[i + 1] && x[i] != i) no();
  for (int i = 1; i < (int)(n); ++i)
    if (x[i] == i)
      b[i] = a[i + 1] + t - 1;
    else
      b[i] = a[i + 1] + t;
  b[n] = a[n] + t + t;
  for (int i = 1; i < (int)(n); ++i)
    if (b[i] == b[i + 1]) no();
  printf("Yes\n%lld", b[1]);
  for (int i = 2; i < (int)(n + 1); ++i) printf(" %lld", b[i]);
  printf("\n");
}

```


### Prompt

Create a solution in Cpp for the following problem:

A permutation is a sequence of integers p1, p2, ..., pn, consisting of n distinct positive integers, each of them doesn't exceed n. Let's denote the i-th element of permutation p as pi. We'll call number n the size of permutation p1, p2, ..., pn.

Nickolas adores permutations. He likes some permutations more than the others. He calls such permutations perfect. A perfect permutation is such permutation p that for any i (1 ≤ i ≤ n) (n is the permutation size) the following equations hold ppi = i and pi ≠ i. Nickolas asks you to print any perfect permutation of size n for the given n.

Input

A single line contains a single integer n (1 ≤ n ≤ 100) — the permutation size.

Output

If a perfect permutation of size n doesn't exist, print a single integer -1. Otherwise print n distinct integers from 1 to n, p1, p2, ..., pn — permutation p, that is perfect. Separate printed numbers by whitespaces.

Examples

Input

1

Output

-1

Input

2

Output

2 1

Input

4

Output

2 1 4 3

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
int main(void) {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  if (n & 1) {
    cout << "-1";
    return 0;
  }
  for (long long int i = 1; i < n + 1; i++) {
    if (i & 1)
      cout << i + 1 << " ";
    else
      cout << i - 1 << " ";
  }
}

```


### Prompt

Please create a solution in CPP to the following problem:

Vasya plays the LionAge II. He was bored of playing with a stupid computer, so he installed this popular MMORPG, to fight with his friends. Vasya came up with the name of his character — non-empty string s, consisting of a lowercase Latin letters. However, in order not to put up a front of friends, Vasya has decided to change no more than k letters of the character name so that the new name sounded as good as possible. Euphony of the line is defined as follows: for each pair of adjacent letters x and y (x immediately precedes y) the bonus c(x, y) is added to the result. Your task is to determine what the greatest Euphony can be obtained by changing at most k letters in the name of the Vasya's character.

Input

The first line contains character's name s and an integer number k (0 ≤ k ≤ 100). The length of the nonempty string s does not exceed 100. The second line contains an integer number n (0 ≤ n ≤ 676) — amount of pairs of letters, giving bonus to the euphony. The next n lines contain description of these pairs «x y c», which means that sequence xy gives bonus c (x, y — lowercase Latin letters,  - 1000 ≤ c ≤ 1000). It is guaranteed that no pair x y mentioned twice in the input data.

Output

Output the only number — maximum possible euphony оf the new character's name.

Examples

Input

winner 4
4
s e 7
o s 8
l o 13
o o 8

Output

36

Input

abcdef 1
5
a b -10
b c 5
c d 5
d e 5
e f 5

Output

20

Note

In the first example the most euphony name will be looser. It is easy to calculate that its euphony is 36.

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
int N, M, K, F[111][111][30], G[30][30];
char S[111];
int main() {
  scanf("%s", S);
  N = strlen(S);
  scanf("%d", &K);
  scanf("%d", &M);
  for (int i = 0, k; i < M; i++) {
    char s1[11], s2[11];
    scanf("%s%s%d", s1, s2, &k);
    G[s1[0] - 'a'][s2[0] - 'a'] = k;
  }
  memset(F, -2, sizeof(F));
  for (int i = 0; i < 26; i++) F[0][1][i] = 0;
  F[0][0][S[0] - 'a'] = 0;
  for (int i = 1; i < N; i++)
    for (int j = 0; j <= K; j++)
      for (int u = 0; u < 26; u++)
        for (int v = 0; v < 26; v++) {
          int d = (v + 'a' != S[i]);
          F[i][j + d][v] = max(F[i][j + d][v], F[i - 1][j][u] + G[u][v]);
        }
  int Ret = -1000000000;
  for (int i = 0; i <= K; i++)
    for (int j = 0; j < 26; j++) Ret = max(Ret, F[N - 1][i][j]);
  cout << Ret << endl;
  return 0;
}

```


### Prompt

Please create a solution in Cpp to the following problem:

The only difference between the easy and the hard versions is constraints.

A subsequence is a string that can be derived from another string by deleting some or no symbols without changing the order of the remaining symbols. Characters to be deleted are not required to go successively, there can be any gaps between them. For example, for the string "abaca" the following strings are subsequences: "abaca", "aba", "aaa", "a" and "" (empty string). But the following strings are not subsequences: "aabaca", "cb" and "bcaa".

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

In one move you can take any subsequence t of the given string and add it to the set S. The set S can't contain duplicates. This move costs n - |t|, where |t| is the length of the added subsequence (i.e. the price equals to the number of the deleted characters).

Your task is to find out the minimum possible total cost to obtain a set S of size k or report that it is impossible to do so.

Input

The first line of the input contains two integers n and k (1 ≤ n, k ≤ 100) — the length of the string and the size of the set, correspondingly.

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

Output

Print one integer — if it is impossible to obtain the set S of size k, print -1. Otherwise, print the minimum possible total cost to do it.

Examples

Input

4 5
asdf

Output

4

Input

5 6
aaaaa

Output

15

Input

5 7
aaaaa

Output

-1

Input

10 100
ajihiushda

Output

233

Note

In the first example we can generate S = { "asdf", "asd", "adf", "asf", "sdf" }. The cost of the first element in S is 0 and the cost of the others is 1. So the total cost of S is 4.

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n;
  cin >> n;
  int k;
  cin >> k;
  string s;
  cin >> s;
  int ans = 0;
  queue<string> q;
  set<string> st;
  q.push(s);
  st.insert(s);
  while (!q.empty() && st.size() < k) {
    string currentNode = q.front();
    q.pop();
    for (int i = 0; i < currentNode.length(); i++) {
      string temp = currentNode;
      temp.erase(i, 1);
      if (!st.count(temp) && st.size() < k) {
        st.insert(temp);
        q.push(temp);
        ans += (n - temp.size());
      }
    }
  }
  if (st.size() < k)
    cout << -1 << '\n';
  else
    cout << ans << '\n';
  return 0;
}

```


### Prompt

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

Diameter of a Tree

Given a tree T with non-negative weight, find the diameter of the tree.

The diameter of a tree is the maximum distance between two nodes in a tree.

Constraints

* 1 ≤ n ≤ 100,000
* 0 ≤ wi ≤ 1,000

Input

n
s1 t1 w1
s2 t2 w2
:
sn-1 tn-1 wn-1

The first line consists of an integer n which represents the number of nodes in the tree. Every node has a unique ID from 0 to n-1 respectively.

In the following n-1 lines, edges of the tree are given. si and ti represent end-points of the i-th edge (undirected) and wi represents the weight (distance) of the i-th edge.

Output

Print the diameter of the tree in a line.

Examples

Input

4
0 1 2
1 2 1
1 3 3

Output

5

Input

4
0 1 1
1 2 2
2 3 4

Output

7

### Response

```cpp
#include<iostream>
#include<queue>
#include<vector>
using namespace std;
#define MAX 100000
#define INFTY (1 << 30)

class Edge{
public:
	int t, w;
	Edge(){}
	Edge(int t, int w): t(t), w(w){}
};

vector<Edge> G[MAX];
int n, d[MAX];

bool vis[MAX];
int cnt;

void bfs(int s){
	for(int i = 0; i < n; i++) d[i] = INFTY;
	queue<int> Q;
	Q.push(s);
	d[s] = 0;
	int u;
	while(!Q.empty()){
		u = Q.front(); Q.pop();
		for(int i = 0; i < G[u].size(); i++){
			Edge e = G[u][i];
			if(d[e.t] == INFTY){
				d[e.t] = d[u] + e.w;
				Q.push(e.t);
			}
		}
	}
}

void solve(){

	bfs(0);
	int maxv = 0;
	int tgt = 0;
	for(int i = 0; i < n; i++){
		if(d[i] == INFTY) continue;
		if(maxv < d[i]){
			maxv = d[i];
			tgt = i;
		}
	}

	bfs(tgt);
	maxv = 0;
	for(int i = 0; i < n; i++){
		if(d[i] == INFTY) continue;
		maxv = max(maxv, d[i]);
	}

	cout << maxv << endl;
}

int main(){
	int s, t, w;
	cin >> n;

	for(int i = 0; i < n - 1; i++){
		cin >> s >> t >> w;

		G[s].push_back(Edge(t, w));
		G[t].push_back(Edge(s, w));
	}
	solve();
}
```


### Prompt

Generate a cpp solution to the following problem:

Throughout Igor K.'s life he has had many situations worthy of attention. We remember the story with the virus, the story of his mathematical career and of course, his famous programming achievements. However, one does not always adopt new hobbies, one can quit something as well.

This time Igor K. got disappointed in one of his hobbies: editing and voicing videos. Moreover, he got disappointed in it so much, that he decided to destroy his secret archive for good.

Igor K. use Pindows XR operation system which represents files and folders by small icons. At that, m icons can fit in a horizontal row in any window.

Igor K.'s computer contains n folders in the D: disk's root catalog. The folders are numbered from 1 to n in the order from the left to the right and from top to bottom (see the images). At that the folders with secret videos have numbers from a to b inclusive. Igor K. wants to delete them forever, at that making as few frame selections as possible, and then pressing Shift+Delete exactly once. What is the minimum number of times Igor K. will have to select the folder in order to select folders from a to b and only them? Let us note that if some selected folder is selected repeatedly, then it is deselected. Each selection possesses the shape of some rectangle with sides parallel to the screen's borders.

Input

The only line contains four integers n, m, a, b (1 ≤ n, m ≤ 109, 1 ≤ a ≤ b ≤ n). They are the number of folders in Igor K.'s computer, the width of a window and the numbers of the first and the last folders that need to be deleted.

Output

Print a single number: the least possible number of times Igor K. will have to select the folders using frames to select only the folders with numbers from a to b.

Examples

Input

11 4 3 9

Output

3

Input

20 5 2 20

Output

2

Note

The images below illustrate statement tests.

The first test:

<image>

In this test we can select folders 3 and 4 with out first selection, folders 5, 6, 7, 8 with our second selection and folder 9 with our third, last selection.

The second test:

<image>

In this test we can first select all folders in the first row (2, 3, 4, 5), then — all other ones.

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
long long n, m, a, b, indexa, indexb;
int main() {
  cin >> n >> m >> a >> b;
  indexa = a / m;
  if (a % m == 0) indexa -= 1;
  indexb = b / m;
  if (b % m == 0) indexb -= 1;
  if (m == 1)
    cout << '1' << endl;
  else if (indexa == indexb) {
    cout << '1' << endl;
  } else if (b == n) {
    if (a % m == 1)
      cout << '1' << endl;
    else
      cout << '2' << endl;
  } else if (indexb - indexa == 1) {
    if (a % m == 1 && b % m == 0)
      cout << '1' << endl;
    else
      cout << '2' << endl;
  } else {
    if (a % m == 1 && b % m == 0)
      cout << '1' << endl;
    else if (a % m == 1 || b % m == 0)
      cout << '2' << endl;
    else if ((a - indexa * m - 1) == (b - indexb * m))
      cout << '2' << endl;
    else
      cout << '3' << endl;
  }
}

```


### Prompt

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

The campus has m rooms numbered from 0 to m - 1. Also the x-mouse lives in the campus. The x-mouse is not just a mouse: each second x-mouse moves from room i to the room i ⋅ x mod{m} (in fact, it teleports from one room to another since it doesn't visit any intermediate room). Starting position of the x-mouse is unknown.

You are responsible to catch the x-mouse in the campus, so you are guessing about minimum possible number of traps (one trap in one room) you need to place. You are sure that if the x-mouse enters a trapped room, it immediately gets caught.

And the only observation you made is GCD (x, m) = 1.

Input

The only line contains two integers m and x (2 ≤ m ≤ 10^{14}, 1 ≤ x < m, GCD (x, m) = 1) — the number of rooms and the parameter of x-mouse.

Output

Print the only integer — minimum number of traps you need to install to catch the x-mouse.

Examples

Input

4 3

Output

3

Input

5 2

Output

2

Note

In the first example you can, for example, put traps in rooms 0, 2, 3. If the x-mouse starts in one of this rooms it will be caught immediately. If x-mouse starts in the 1-st rooms then it will move to the room 3, where it will be caught.

In the second example you can put one trap in room 0 and one trap in any other room since x-mouse will visit all rooms 1..m-1 if it will start in any of these rooms.

### Response

```cpp
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
long long m, x, p[22], a[22], b[22], len, res = 1;
map<long long, int> Map[22];
inline void init(long long n) {
  for (register long long i = 2; i * i <= n; i++)
    if (n % i == 0) {
      len++;
      p[len] = i;
      while (n % i == 0) n /= i, a[len]++;
    }
  if (n > 1) len++, p[len] = n, a[len] = 1;
}
inline void init2(long long n, int tp) {
  for (register long long i = 2; i * i <= n; i++) {
    while (n % i == 0) Map[tp][i]++, n /= i;
  }
  if (n > 1) Map[tp][n]++;
}
inline long long mul(long long a, long long n, long long mo) {
  long long res = 0;
  n %= mo;
  a %= mo;
  if (mo <= 2000000000) return a * n % mo;
  while (n) {
    if (n & 1) res = res + a < mo ? res + a : res + a;
    a = a + a < mo ? a + a : a + a - mo;
    n >>= 1;
  }
  return res % mo;
}
inline long long power(long long a, long long n, long long mo) {
  long long res = 1;
  if (mo == 1) return 0;
  n %= mo - 1;
  while (n) {
    if (n & 1) res = mul(res, a, mo);
    a = mul(a, a, mo);
    n >>= 1;
  }
  return res;
}
inline void dfs(int dep, long long d) {
  if (dep > len) {
    if (d == 1) return;
    map<long long, int> fac;
    for (register int i = 1; i <= (len); i++)
      if (b[i]) {
        if (b[i] - 1) fac[p[i]] += b[i] - 1;
        for (map<long long, int>::iterator it = Map[i].begin();
             it != Map[i].end(); it++)
          fac[(*it).first] += (*it).second;
      }
    static long long c[22];
    int tot = 0;
    long long phi = 1;
    for (map<long long, int>::iterator it = fac.begin(); it != fac.end();
         it++) {
      tot++, c[tot] = (*it).first;
      for (register int i = 1; i <= ((*it).second); i++) phi *= c[tot];
    }
    long long k = phi;
    for (register int i = 1; i <= (tot); i++) {
      while (k % c[i] == 0 && power(x, k / c[i], d) == 1) k /= c[i];
    }
    res += phi / k;
    return;
  }
  for (register int i = 0; i <= (a[dep]); i++)
    b[dep] = i, dfs(dep + 1, d), d *= p[dep], b[dep] = 0;
}
int main() {
  scanf("%lld%lld", &m, &x);
  init(m);
  for (register int i = 1; i <= (len); i++) init2(p[i] - 1, i);
  dfs(1, 1);
  cout << res;
  return 0;
}

```


### Prompt

Generate a cpp solution to the following problem:

A very brave explorer Petya once decided to explore Paris catacombs. Since Petya is not really experienced, his exploration is just walking through the catacombs.

Catacombs consist of several rooms and bidirectional passages between some pairs of them. Some passages can connect a room to itself and since the passages are built on different depths they do not intersect each other. Every minute Petya arbitrary chooses a passage from the room he is currently in and then reaches the room on the other end of the passage in exactly one minute. When he enters a room at minute i, he makes a note in his logbook with number ti:

  * If Petya has visited this room before, he writes down the minute he was in this room last time;
  * Otherwise, Petya writes down an arbitrary non-negative integer strictly less than current minute i.

Initially, Petya was in one of the rooms at minute 0, he didn't write down number t0.

At some point during his wandering Petya got tired, threw out his logbook and went home. Vasya found his logbook and now he is curious: what is the minimum possible number of rooms in Paris catacombs according to Petya's logbook?

Input

The first line contains a single integer n (1 ≤ n ≤ 2·105) — then number of notes in Petya's logbook.

The second line contains n non-negative integers t1, t2, ..., tn (0 ≤ ti < i) — notes in the logbook.

Output

In the only line print a single integer — the minimum possible number of rooms in Paris catacombs.

Examples

Input

2
0 0

Output

2

Input

5
0 1 0 1 3

Output

3

Note

In the first sample, sequence of rooms Petya visited could be, for example 1 → 1 → 2, 1 → 2 → 1 or 1 → 2 → 3. The minimum possible number of rooms is 2.

In the second sample, the sequence could be 1 → 2 → 3 → 1 → 2 → 1.

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 5;
int cnt[maxn];
int n;
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) {
    int t;
    scanf("%d", &t);
    cnt[t]++;
  }
  long long ans = 1;
  for (int i = 0; i < maxn; i++) {
    if (cnt[i] > 0) ans += cnt[i] - 1;
  }
  cout << ans << endl;
  return 0;
}

```


### Prompt

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

You are given a set of all integers from l to r inclusive, l < r, (r - l + 1) ≤ 3 ⋅ 10^5 and (r - l) is always odd.

You want to split these numbers into exactly (r - l + 1)/(2) pairs in such a way that for each pair (i, j) the greatest common divisor of i and j is equal to 1. Each number should appear in exactly one of the pairs.

Print the resulting pairs or output that no solution exists. If there are multiple solutions, print any of them.

Input

The only line contains two integers l and r (1 ≤ l < r ≤ 10^{18}, r - l + 1 ≤ 3 ⋅ 10^5, (r - l) is odd).

Output

If any solution exists, print "YES" in the first line. Each of the next (r - l + 1)/(2) lines should contain some pair of integers. GCD of numbers in each pair should be equal to 1. All (r - l + 1) numbers should be pairwise distinct and should have values from l to r inclusive.

If there are multiple solutions, print any of them.

If there exists no solution, print "NO".

Example

Input

1 8

Output

YES
2 7
4 1
3 8
6 5

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  long long l, r;
  cin >> l >> r;
  long long x = (r - l) / 2 + 1;
  cout << "YES"
       << "\n";
  for (int i = 0; i < x; i++) {
    cout << (l + 2 * i) << ' ' << (l + 2 * i + 1) << "\n";
  }
  return 0;
}

```