### Prompt

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

You are given a chessboard consisting of n rows and n columns. Rows are numbered from bottom to top from 1 to n. Columns are numbered from left to right from 1 to n. The cell at the intersection of the x-th column and the y-th row is denoted as (x, y). Furthermore, the k-th column is a special column.

Initially, the board is empty. There are m changes to the board. During the i-th change one pawn is added or removed from the board. The current board is good if we can move all pawns to the special column by the followings rules:

  * Pawn in the cell (x, y) can be moved to the cell (x, y + 1), (x - 1, y + 1) or (x + 1, y + 1);
  * You can make as many such moves as you like;
  * Pawns can not be moved outside the chessboard;
  * Each cell can not contain more than one pawn.

The current board may not always be good. To fix it, you can add new rows to the board. New rows are added at the top, i. e. they will have numbers n+1, n+2, n+3, ....

After each of m changes, print one integer — the minimum number of rows which you have to add to make the board good.

Input

The first line contains three integers n, k and m (1 ≤ n, m ≤ 2 ⋅ 10^5; 1 ≤ k ≤ n) — the size of the board, the index of the special column and the number of changes respectively.

Then m lines follow. The i-th line contains two integers x and y (1 ≤ x, y ≤ n) — the index of the column and the index of the row respectively. If there is no pawn in the cell (x, y), then you add a pawn to this cell, otherwise — you remove the pawn from this cell.

Output

After each change print one integer — the minimum number of rows which you have to add to make the board good.

Example

Input

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

Output

0
1
2
2
1

### Response

```cpp
#include <bits/stdc++.h>
class node {
 public:
  static int k;
  int p, x, y;
  int bottom, space, top, size;
  node *left_n, *right_n;
  int fix;
  void setk(int k_i) const { k = k_i; }
  node(int x_i, int y_i)
      : x(x_i), y(y_i), space(0), size(1), left_n(0), right_n(0), fix(rand()) {
    if (x_i > k)
      p = y_i + x_i - k;
    else
      p = y_i + k - x_i;
    top = bottom = p;
  }
  bool operator<(const node& b) {
    if (p < b.p)
      return true;
    else if (p > b.p)
      return false;
    else if (x < b.x)
      return true;
    else if (x > b.x)
      return false;
    else
      return y < b.y;
  }
  bool operator!=(const node& b) { return !((x == b.x) && (y == b.y)); }
};
int node::k;
class treap {
 public:
  node* root;
  treap() : root(0) {}
  ~treap() {
    if (root) delete root;
  }
  void rot_l(node*& a) {
    node* b = a->right_n;
    a->right_n = b->left_n;
    b->left_n = a;
    a = b;
  }
  void rot_r(node*& a) {
    node* b = a->left_n;
    a->left_n = b->right_n;
    b->right_n = a;
    a = b;
  }
  inline void renew(node* now) {
    int top;
    if (now->left_n == 0 && now->right_n == 0) {
      now->top = now->bottom = now->p;
      now->space = 0;
      now->size = 1;
    } else if (now->left_n == 0) {
      top = now->p;
      now->size = now->right_n->size + 1;
      now->bottom = now->p;
      if ((top - now->right_n->bottom + 1) - now->right_n->space > 0) {
        now->top = (top - now->right_n->bottom + 1) - now->right_n->space +
                   now->right_n->top;
      } else {
        now->top = now->right_n->top;
      }
      now->space = now->top - now->bottom - now->size + 1;
    } else if (now->right_n == 0) {
      now->size = now->left_n->size + 1;
      now->bottom = now->left_n->bottom;
      if (now->p > now->left_n->top) {
        now->top = now->p;
      } else {
        now->top = now->left_n->top + 1;
      }
      now->space = now->top - now->bottom - now->size + 1;
    } else {
      if (now->p > now->left_n->top) {
        top = now->p;
      } else {
        top = now->left_n->top + 1;
      }
      now->size = now->left_n->size + now->right_n->size + 1;
      now->bottom = now->left_n->bottom;
      if ((top - now->right_n->bottom + 1) - now->right_n->space > 0) {
        now->top = (top - now->right_n->bottom + 1) - now->right_n->space +
                   now->right_n->top;
      } else {
        now->top = now->right_n->top;
      }
      now->space = now->top - now->bottom - now->size + 1;
    }
  }
  void change(node*& now, node*& pawn) {
    if (root != 0) {
      if ((*pawn) < (*now)) {
        if (now->left_n == 0) {
          now->left_n = pawn;
        } else {
          change(now->left_n, pawn);
        }
        if (now->left_n) {
          if (now->left_n->fix > now->fix) {
            rot_r(now);
            renew(now->right_n);
          }
        }
        renew(now);
      } else if ((*now) < (*pawn)) {
        if (now->right_n == 0) {
          now->right_n = pawn;
        } else {
          change(now->right_n, pawn);
        }
        if (now->right_n) {
          if (now->right_n->fix > now->fix) {
            rot_l(now);
            renew(now->left_n);
          }
        }
        renew(now);
      } else {
        if (now->left_n == 0 && now->right_n == 0) {
          delete pawn;
          delete now;
          now = 0;
        } else if (now->left_n == 0) {
          node* tmp = now->right_n;
          delete pawn;
          delete now;
          now = tmp;
        } else if (now->right_n == 0) {
          node* tmp = now->left_n;
          delete pawn;
          delete now;
          now = tmp;
        } else {
          if (now->left_n->fix < now->right_n->fix) {
            rot_l(now);
            change(now->left_n, pawn);
          } else {
            rot_r(now);
            change(now->right_n, pawn);
          }
          renew(now);
        }
      }
    } else {
      root = pawn;
    }
  }
  void print(node*& now) const {
    if (now) {
      if (now->left_n) {
        printf("/");
        print(now->left_n);
      } else if (now->right_n) {
        printf("\\");
        print(now->right_n);
      }
      printf("%d %d %d %d %d\n", now->bottom, now->space, now->top, now->size,
             now->p);
    }
  }
} board;
int main() {
  int n, k, m;
  scanf("%d %d %d", &n, &k, &m);
  node::k = k;
  for (int cInd = 0; cInd < m; ++cInd) {
    int x, y;
    scanf("%d %d", &x, &y);
    node* pawn = new node(x, y);
    board.change(board.root, pawn);
    if (board.root == 0) {
      printf("0\n");
    } else {
      if (board.root->top > n)
        printf("%d\n", board.root->top - n);
      else
        printf("0\n");
    }
  }
  return 0;
}

```


### Prompt

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

Kuroni has n daughters. As gifts for them, he bought n necklaces and n bracelets:

  * the i-th necklace has a brightness a_i, where all the a_i are pairwise distinct (i.e. all a_i are different),
  * the i-th bracelet has a brightness b_i, where all the b_i are pairwise distinct (i.e. all b_i are different).

Kuroni wants to give exactly one necklace and exactly one bracelet to each of his daughters. To make sure that all of them look unique, the total brightnesses of the gifts given to each daughter should be pairwise distinct. Formally, if the i-th daughter receives a necklace with brightness x_i and a bracelet with brightness y_i, then the sums x_i + y_i should be pairwise distinct. Help Kuroni to distribute the gifts.

For example, if the brightnesses are a = [1, 7, 5] and b = [6, 1, 2], then we may distribute the gifts as follows:

  * Give the third necklace and the first bracelet to the first daughter, for a total brightness of a_3 + b_1 = 11.
  * Give the first necklace and the third bracelet to the second daughter, for a total brightness of a_1 + b_3 = 3.
  * Give the second necklace and the second bracelet to the third daughter, for a total brightness of a_2 + b_2 = 8.

Here is an example of an invalid distribution:

  * Give the first necklace and the first bracelet to the first daughter, for a total brightness of a_1 + b_1 = 7.
  * Give the second necklace and the second bracelet to the second daughter, for a total brightness of a_2 + b_2 = 8.
  * Give the third necklace and the third bracelet to the third daughter, for a total brightness of a_3 + b_3 = 7.

This distribution is invalid, as the total brightnesses of the gifts received by the first and the third daughter are the same. Don't make them this upset!

Input

The input consists of multiple test cases. The first line contains an integer t (1 ≤ t ≤ 100) — the number of test cases. The description of the test cases follows.

The first line of each test case contains a single integer n (1 ≤ n ≤ 100) — the number of daughters, necklaces and bracelets.

The second line of each test case contains n distinct integers a_1, a_2, ..., a_n (1 ≤ a_i ≤ 1000) — the brightnesses of the necklaces.

The third line of each test case contains n distinct integers b_1, b_2, ..., b_n (1 ≤ b_i ≤ 1000) — the brightnesses of the bracelets.

Output

For each test case, print a line containing n integers x_1, x_2, ..., x_n, representing that the i-th daughter receives a necklace with brightness x_i. In the next line print n integers y_1, y_2, ..., y_n, representing that the i-th daughter receives a bracelet with brightness y_i.

The sums x_1 + y_1, x_2 + y_2, ..., x_n + y_n should all be distinct. The numbers x_1, ..., x_n should be equal to the numbers a_1, ..., a_n in some order, and the numbers y_1, ..., y_n should be equal to the numbers b_1, ..., b_n in some order.

It can be shown that an answer always exists. If there are multiple possible answers, you may print any of them.

Example

Input

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

Output

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

Note

In the first test case, it is enough to give the i-th necklace and the i-th bracelet to the i-th daughter. The corresponding sums are 1 + 8 = 9, 8 + 4 = 12, and 5 + 5 = 10.

The second test case is described in the statement.

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
void solve() {
  long long int n;
  cin >> n;
  vector<long long int> a(n);
  vector<long long int> b(n);
  for (long long int i = 0; i < n; i++) cin >> a[i];
  for (long long int i = 0; i < n; i++) cin >> b[i];
  sort(a.begin(), a.end());
  sort(b.begin(), b.end());
  for (long long int i = 0; i < a.size(); i++) cout << a[i] << " ";
  cout << endl;
  for (long long int i = 0; i < b.size(); i++) cout << b[i] << " ";
  cout << endl;
}
int main() {
  long long int t;
  cin >> t;
  while (t--) {
    solve();
  }
  return 0;
}

```


### Prompt

Generate a cpp solution to the following problem:

Alice got many presents these days. So she decided to pack them into boxes and send them to her friends.

There are n kinds of presents. Presents of one kind are identical (i.e. there is no way to distinguish two gifts of the same kind). Presents of different kinds are different (i.e. that is, two gifts of different kinds are distinguishable). The number of presents of each kind, that Alice has is very big, so we can consider Alice has an infinite number of gifts of each kind.

Also, there are m boxes. All of them are for different people, so they are pairwise distinct (consider that the names of m friends are written on the boxes). For example, putting the first kind of present into the first box but not into the second box, is different from putting the first kind of present into the second box but not into the first box.

Alice wants to pack presents with the following rules:

  * She won't pack more than one present of each kind into the same box, so each box should contain presents of different kinds (i.e. each box contains a subset of n kinds, empty boxes are allowed);
  * For each kind at least one present should be packed into some box.

Now Alice wants to know how many different ways to pack the presents exists. Please, help her and calculate this number. Since the answer can be huge, output it by modulo 10^9+7.

See examples and their notes for clarification.

Input

The first line contains two integers n and m, separated by spaces (1 ≤ n,m ≤ 10^9) — the number of kinds of presents and the number of boxes that Alice has.

Output

Print one integer — the number of ways to pack the presents with Alice's rules, calculated by modulo 10^9+7

Examples

Input

1 3

Output

7

Input

2 2

Output

9

Note

In the first example, there are seven ways to pack presents:

\{1\}\{\}\{\}

\{\}\{1\}\{\}

\{\}\{\}\{1\}

\{1\}\{1\}\{\}

\{\}\{1\}\{1\}

\{1\}\{\}\{1\}

\{1\}\{1\}\{1\}

In the second example there are nine ways to pack presents:

\{\}\{1,2\}

\{1\}\{2\}

\{1\}\{1,2\}

\{2\}\{1\}

\{2\}\{1,2\}

\{1,2\}\{\}

\{1,2\}\{1\}

\{1,2\}\{2\}

\{1,2\}\{1,2\}

For example, the way \{2\}\{2\} is wrong, because presents of the first kind should be used in the least one box.

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
long long nikita = 1000000007;
long long bin_pow(int a, int m) {
  if (m == 1) return a;
  long long ans = bin_pow(a, m / 2);
  ans = (ans * ans) % nikita;
  if (m % 2 == 1) {
    ans = ans * a;
  }
  return ans % nikita;
}
int main() {
  int n, m;
  cin >> n >> m;
  cout << bin_pow((bin_pow(2, m) - 1), n);
  return 0;
}

```


### Prompt

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

Petya has recently learned data structure named "Binary heap".

The heap he is now operating with allows the following operations:

  * put the given number into the heap;
  * get the value of the minimum element in the heap;
  * extract the minimum element from the heap;

Thus, at any moment of time the heap contains several integers (possibly none), some of them might be equal.

In order to better learn this data structure Petya took an empty heap and applied some operations above to it. Also, he carefully wrote down all the operations and their results to his event log, following the format:

  * insert x — put the element with value x in the heap;
  * getMin x — the value of the minimum element contained in the heap was equal to x;
  * removeMin — the minimum element was extracted from the heap (only one instance, if there were many).

All the operations were correct, i.e. there was at least one element in the heap each time getMin or removeMin operations were applied.

While Petya was away for a lunch, his little brother Vova came to the room, took away some of the pages from Petya's log and used them to make paper boats.

Now Vova is worried, if he made Petya's sequence of operations inconsistent. For example, if one apply operations one-by-one in the order they are written in the event log, results of getMin operations might differ from the results recorded by Petya, and some of getMin or removeMin operations may be incorrect, as the heap is empty at the moment they are applied.

Now Vova wants to add some new operation records to the event log in order to make the resulting sequence of operations correct. That is, the result of each getMin operation is equal to the result in the record, and the heap is non-empty when getMin ad removeMin are applied. Vova wants to complete this as fast as possible, as the Petya may get back at any moment. He asks you to add the least possible number of operation records to the current log. Note that arbitrary number of operations may be added at the beginning, between any two other operations, or at the end of the log.

Input

The first line of the input contains the only integer n (1 ≤ n ≤ 100 000) — the number of the records left in Petya's journal.

Each of the following n lines describe the records in the current log in the order they are applied. Format described in the statement is used. All numbers in the input are integers not exceeding 109 by their absolute value.

Output

The first line of the output should contain a single integer m — the minimum possible number of records in the modified sequence of operations.

Next m lines should contain the corrected sequence of records following the format of the input (described in the statement), one per line and in the order they are applied. All the numbers in the output should be integers not exceeding 109 by their absolute value.

Note that the input sequence of operations must be the subsequence of the output sequence.

It's guaranteed that there exists the correct answer consisting of no more than 1 000 000 operations.

Examples

Input

2
insert 3
getMin 4

Output

4
insert 3
removeMin
insert 4
getMin 4

Input

4
insert 1
insert 1
removeMin
getMin 2

Output

6
insert 1
insert 1
removeMin
removeMin
insert 2
getMin 2

Note

In the first sample, after number 3 is inserted into the heap, the minimum number is 3. To make the result of the first getMin equal to 4 one should firstly remove number 3 from the heap and then add number 4 into the heap.

In the second sample case number 1 is inserted two times, so should be similarly removed twice.

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
const long long int M = 1e9 + 7;
set<pair<long long int, long long int> > s;
int main() {
  long long int n;
  cin >> n;
  long long int i;
  long long int cnt = 0;
  string se[n + 1];
  long long int a[n + 1];
  for (i = 0; i < n; i++) {
    cin >> se[i];
    if (se[i][0] != 'r') scanf("%lld", &a[i]);
  }
  vector<string> ans;
  vector<long long int> k;
  long long int j = 0;
  for (i = 0; i < n; i++) {
    if (se[i][0] == 'i') {
      ans.push_back(se[i]);
      k.push_back(a[i]);
      j++;
      s.insert({a[i], cnt});
      cnt++;
    } else if (se[i][0] == 'g') {
      auto it = s.begin();
      if (s.size() == 0) {
        ans.push_back("insert");
        k.push_back(a[i]);
        s.insert({a[i], cnt});
        cnt++;
        j++;
        ans.push_back(se[i]);
        k.push_back(a[i]);
        j++;
      } else {
        while ((it->first) < a[i] && s.size() > 0) {
          ans.push_back("removeMin");
          s.erase(it);
          it = s.begin();
        }
        if (s.size() == 0) {
          ans.push_back("insert");
          s.insert({a[i], cnt});
          cnt++;
          k.push_back(a[i]);
          j++;
        } else {
          it = s.begin();
          if (it->first > a[i]) {
            ans.push_back("insert");
            s.insert({a[i], cnt});
            cnt++;
            k.push_back(a[i]);
            j++;
          }
        }
        ans.push_back(se[i]);
        k.push_back(a[i]);
        j++;
      }
    } else {
      if (s.size() == 0) {
        ans.push_back("insert");
        k.push_back(1000000000);
        s.insert({1000000000, cnt});
        cnt++;
        j++;
      }
      auto it2 = s.begin();
      s.erase(it2);
      ans.push_back(se[i]);
    }
  }
  n = ans.size();
  printf("%lld", n);
  printf("%s", "\n");
  j = 0;
  for (i = 0; i < n; i++) {
    if (ans[i][0] == 'r') {
      cout << ans[i];
      printf("%s", "\n");
    } else {
      cout << ans[i];
      printf("%s", " ");
      printf("%lld", k[j]);
      printf("%s", "\n");
      j++;
    }
  }
  return 0;
}

```


### Prompt

Please create a solution in CPP to the following problem:

You are given a complete bipartite graph with 2n nodes, with n nodes on each side of the bipartition. Nodes 1 through n are on one side of the bipartition, and nodes n+1 to 2n are on the other side. You are also given an n × n matrix a describing the edge weights. a_{ij} denotes the weight of the edge between nodes i and j+n. Each edge has a distinct weight.

Alice and Bob are playing a game on this graph. First Alice chooses to play as either "increasing" or "decreasing" for herself, and Bob gets the other choice. Then she places a token on any node of the graph. Bob then moves the token along any edge incident to that node. They now take turns playing the following game, with Alice going first.

The current player must move the token from the current vertex to some adjacent unvisited vertex. Let w be the last weight of the last edge that was traversed. The edge that is traversed must be strictly greater than w if the player is playing as "increasing", otherwise, it must be strictly less. The first player unable to make a move loses.

You are given n and the edge weights of the graph. You can choose to play as either Alice or Bob, and you will play against the judge. You must win all the games for your answer to be judged correct.

Interaction

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

Each test starts with an integer n (1 ≤ n ≤ 50) — the number of nodes on each side of the bipartition.

The next n lines contain n integers a_{ij} (1 ≤ a_{ij} ≤ n^2). a_{ij} denotes the weight of the edge between node i and node j+n. All a_{ij} will be distinct.

You first print a string "A" or "B", denoting which player you want to play ("A" for Alice and "B" for Bob).

If playing as Alice, first print either "I" or "D" (denoting whether you choose "increasing" or "decreasing"). Then, print the node that you wish to start at.

If playing as Bob, read in a character "I" or "D" (denoting whether the judge chose "increasing" or "decreasing"), then the node that the judge chooses to start at.

To make a move, print the index of the node that you wish to go to. To read what move the judge made, read an integer from standard in.

If the judge responds with -1, then that means the judge has determined it has no legal moves (or it may have just given up) and that you won the case. Stop processing this case immediately and start processing the next case.

If the judge responds with -2, that means that the judge has determined that you made an invalid move, so you should exit immediately to avoid getting other verdicts.

If you are unable to make a move or give up, print -1 and then exit immediately. This will give you a Wrong answer verdict.

After printing a move do not forget to output end of line and flush the output. Otherwise, you will get Idleness limit exceeded. To do this, use:

  * fflush(stdout) or cout.flush() in C++;
  * System.out.flush() in Java;
  * flush(output) in Pascal;
  * stdout.flush() in Python;
  * see documentation for other languages.

Hack Format

To hack, use the following format. Note that you can only hack with one test case.

The first line should contain a single integer t (t=1).

The second line should contain an integer n (1 ≤ n ≤ 50).

The next n lines should contain n integers each, the a_{ij} (1 ≤ a_{ij} ≤ n^2). a_{ij} denotes the weight of the edge between node i and node j+n. All a_{ij} must be distinct.

The judge will play a uniformly random legal move with this case versus the hacked program. If it has no legal moves left, it will give up and declare the player as the winner.

Example

Input

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

Output

A
D 3
2
B
2

Note

The first example has two test cases. In the first test case, the graph looks like the following.

<image>

In the sample output, the player decides to play as Alice and chooses "decreasing" and starting at node 3. The judge responds by moving to node 6. After, the player moves to node 2. At this point, the judge has no more moves (since the weight must "increase"), so it gives up and prints -1.

In the next case, we have two nodes connected by an edge of weight 1. The player decides to play as Bob. No matter what the judge chooses, the player can move the token to the other node and the judge has no moves so will lose.

### Response

```cpp
#include <bits/stdc++.h>
const int N = 2005;
int n;
int a[N][N];
int p[N][N];
int boy[N], girl[N];
void solve() {
  std::cin >> n;
  for (int i = 1; i <= n; ++i) {
    for (int j = 1; j <= n; ++j) {
      std::cin >> a[i][j];
    }
  }
  std::cout << "B" << std::endl;
  char op;
  std::cin >> op;
  int x;
  std::cin >> x;
  if ((op == 'D') ^ (x > n)) {
    for (int i = 1; i <= n; ++i) {
      for (int j = 1; j <= n; ++j) {
        a[i][j] = n * n - a[i][j] + 1;
      }
    }
  }
  for (int i = 1; i <= n; ++i) {
    boy[i] = 0;
    for (int j = 1; j <= n; ++j) {
      p[i][j] = j;
    }
    std::sort(p[i] + 1, p[i] + 1 + n,
              [&](int x, int y) { return a[i][x] < a[i][y]; });
  }
  std::fill(girl + 1, girl + 1 + n, 0);
  std::vector<int> Q;
  for (int i = 1; i <= n; ++i) {
    Q.push_back(i);
  }
  for (int i = 0; i < (int)Q.size(); ++i) {
    int u = Q[i];
    while (1) {
      int v = p[u][++boy[u]];
      if (!girl[v] || a[u][v] > a[girl[v]][v]) {
        if (girl[v]) {
          Q.push_back(girl[v]);
        }
        girl[v] = u;
        break;
      }
    }
  }
  for (int i = 1; i <= n; ++i) {
    boy[girl[i]] = i;
  }
  while (x != -1 && x != -2) {
    if (x <= n) {
      std::cout << boy[x] + n << std::endl;
    } else {
      std::cout << girl[x - n] << std::endl;
    }
    std::cin >> x;
  }
}
int main() {
  std::ios_base::sync_with_stdio(false);
  std::cin.tie(0);
  int T = 1;
  std::cin >> T;
  while (T--) {
    solve();
  }
}

```


### Prompt

Develop a solution in Cpp to the problem described below:

Recently, Dima met with Sasha in a philatelic store, and since then they are collecting coins together. Their favorite occupation is to sort collections of coins. Sasha likes having things in order, that is why he wants his coins to be arranged in a row in such a way that firstly come coins out of circulation, and then come coins still in circulation.

For arranging coins Dima uses the following algorithm. One step of his algorithm looks like the following:

  1. He looks through all the coins from left to right;
  2. If he sees that the i-th coin is still in circulation, and (i + 1)-th coin is already out of circulation, he exchanges these two coins and continues watching coins from (i + 1)-th.

Dima repeats the procedure above until it happens that no two coins were exchanged during this procedure. Dima calls hardness of ordering the number of steps required for him according to the algorithm above to sort the sequence, e.g. the number of times he looks through the coins from the very beginning. For example, for the ordered sequence hardness of ordering equals one.

Today Sasha invited Dima and proposed him a game. First he puts n coins in a row, all of them are out of circulation. Then Sasha chooses one of the coins out of circulation and replaces it with a coin in circulation for n times. During this process Sasha constantly asks Dima what is the hardness of ordering of the sequence.

The task is more complicated because Dima should not touch the coins and he should determine hardness of ordering in his mind. Help Dima with this task.

Input

The first line contains single integer n (1 ≤ n ≤ 300 000) — number of coins that Sasha puts behind Dima.

Second line contains n distinct integers p1, p2, ..., pn (1 ≤ pi ≤ n) — positions that Sasha puts coins in circulation to. At first Sasha replaces coin located at position p1, then coin located at position p2 and so on. Coins are numbered from left to right.

Output

Print n + 1 numbers a0, a1, ..., an, where a0 is a hardness of ordering at the beginning, a1 is a hardness of ordering after the first replacement and so on.

Examples

Input

4
1 3 4 2

Output

1 2 3 2 1

Input

8
6 8 3 4 7 2 1 5

Output

1 2 2 3 4 3 4 5 1

Note

Let's denote as O coin out of circulation, and as X — coin is circulation.

At the first sample, initially in row there are coins that are not in circulation, so Dima will look through them from left to right and won't make any exchanges.

After replacement of the first coin with a coin in circulation, Dima will exchange this coin with next three times and after that he will finally look through the coins and finish the process.

XOOO →  OOOX

After replacement of the third coin, Dima's actions look this way:

XOXO →  OXOX →  OOXX

After replacement of the fourth coin, Dima's actions look this way:

XOXX →  OXXX

Finally, after replacement of the second coin, row becomes consisting of coins that are in circulation and Dima will look through coins from left to right without any exchanges.

### Response

```cpp
#include <bits/stdc++.h>
int read() {
  register int x = 0;
  register char f = 1, ch = getchar();
  for (; !isdigit(ch); ch = getchar())
    if (ch == '-') f = !f;
  for (; isdigit(ch); ch = getchar()) x = (x << 1) + (x << 3) + (ch ^ '0');
  return f ? x : -x;
}
int n, a[300005];
int main() {
  n = read();
  printf("1 ");
  for (register int i = 1; i <= n; ++i) {
    int x = read();
    a[x] = 1;
    while (a[n]) --n, --i;
    printf("%d ", i + 1);
  }
}

```


### Prompt

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

If the girl doesn't go to Denis, then Denis will go to the girl. Using this rule, the young man left home, bought flowers and went to Nastya.

On the way from Denis's house to the girl's house is a road of n lines. This road can't be always crossed in one green light. Foreseeing this, the good mayor decided to place safety islands in some parts of the road. Each safety island is located after a line, as well as at the beginning and at the end of the road. Pedestrians can relax on them, gain strength and wait for a green light.

Denis came to the edge of the road exactly at the moment when the green light turned on. The boy knows that the traffic light first lights up g seconds green, and then r seconds red, then again g seconds green and so on.

Formally, the road can be represented as a segment [0, n]. Initially, Denis is at point 0. His task is to get to point n in the shortest possible time.

He knows many different integers d_1, d_2, …, d_m, where 0 ≤ d_i ≤ n — are the coordinates of points, in which the safety islands are located. Only at one of these points, the boy can be at a time when the red light is on.

Unfortunately, Denis isn't always able to control himself because of the excitement, so some restrictions are imposed:

  * He must always move while the green light is on because it's difficult to stand when so beautiful girl is waiting for you. Denis can change his position by ± 1 in 1 second. While doing so, he must always stay inside the segment [0, n].
  * He can change his direction only on the safety islands (because it is safe). This means that if in the previous second the boy changed his position by +1 and he walked on a safety island, then he can change his position by ± 1. Otherwise, he can change his position only by +1. Similarly, if in the previous second he changed his position by -1, on a safety island he can change position by ± 1, and at any other point by -1.
  * At the moment when the red light is on, the boy must be on one of the safety islands. He can continue moving in any direction when the green light is on.

Denis has crossed the road as soon as his coordinate becomes equal to n.

This task was not so simple, because it's possible that it is impossible to cross the road. Since Denis has all thoughts about his love, he couldn't solve this problem and asked us to help him. Find the minimal possible time for which he can cross the road according to these rules, or find that it is impossible to do.

Input

The first line contains two integers n and m (1 ≤ n ≤ 10^6, 2 ≤ m ≤ min(n + 1, 10^4)) — road width and the number of safety islands.

The second line contains m distinct integers d_1, d_2, …, d_m (0 ≤ d_i ≤ n) — the points where the safety islands are located. It is guaranteed that there are 0 and n among them.

The third line contains two integers g, r (1 ≤ g, r ≤ 1000) — the time that the green light stays on and the time that the red light stays on.

Output

Output a single integer — the minimum time for which Denis can cross the road with obeying all the rules.

If it is impossible to cross the road output -1.

Examples

Input

15 5
0 3 7 14 15
11 11

Output

45

Input

13 4
0 3 7 13
9 9

Output

-1

Note

In the first test, the optimal route is:

  * for the first green light, go to 7 and return to 3. In this case, we will change the direction of movement at the point 7, which is allowed, since there is a safety island at this point. In the end, we will be at the point of 3, where there is also a safety island. The next 11 seconds we have to wait for the red light.
  * for the second green light reaches 14. Wait for the red light again.
  * for 1 second go to 15. As a result, Denis is at the end of the road.

In total, 45 seconds are obtained.

In the second test, it is impossible to cross the road according to all the rules.

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
void dbg() { std::cout << "  #\n"; }
template <typename T, typename... Args>
void dbg(T a, Args... args) {
  std::cout << a << ' ';
  dbg(args...);
}
const long long maxn = 1e4 + 10;
const long long MAX = 1e3 + 10;
const long long inf = 1e17;
const long long mod = 1e9 + 7;
long long n, m;
long long g, r;
long long a[maxn];
bool vis[maxn][MAX];
long long f[maxn][MAX];
long long ans = inf;
void solve() {
  cin >> n >> m;
  for (long long i = (1); i <= (m); ++i) {
    cin >> a[i];
  }
  sort(a + 1, a + 1 + m);
  cin >> g >> r;
  deque<pair<long long, long long> > q;
  q.push_front(make_pair(0, 0));
  vis[0][0] = 1;
  while (!q.empty()) {
    long long pos = q.front().first;
    long long num = q.front().second;
    q.pop_front();
    if (num == 0) {
      if (n - a[pos] <= g) {
        ans = min(ans, n - a[pos] + f[pos][0] * (r + g));
      }
    } else if (num == g) {
      if (vis[pos][0] == 0) {
        f[pos][0] = f[pos][num] + 1;
        vis[pos][0] = 1;
        q.push_back(make_pair(pos, 0));
      }
      continue;
    }
    if (pos > 1) {
      long long next_pos = pos - 1;
      long long next_num = num + a[pos] - a[next_pos];
      if (next_num <= g && vis[next_pos][next_num] == 0) {
        f[next_pos][next_num] = f[pos][num];
        vis[next_pos][next_num] = 1;
        q.push_front(make_pair(next_pos, next_num));
      }
    }
    if (pos < m) {
      long long next_pos = pos + 1;
      long long next_num = num + a[next_pos] - a[pos];
      if (next_num <= g && vis[next_pos][next_num] == 0) {
        f[next_pos][next_num] = f[pos][num];
        vis[next_pos][next_num] = 1;
        q.push_front(make_pair(next_pos, next_num));
      }
    }
  }
  if (ans == inf) ans = -1;
  cout << (ans) << '\n';
}
signed main() {
  std::ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  long long T = 1;
  while (T--) {
    solve();
  }
}

```


### Prompt

Develop a solution in CPP to the problem described below:

Valera conducts experiments with algorithms that search for shortest paths. He has recently studied the Floyd's algorithm, so it's time to work with it.

Valera's already written the code that counts the shortest distance between any pair of vertexes in a non-directed connected graph from n vertexes and m edges, containing no loops and multiple edges. Besides, Valera's decided to mark part of the vertexes. He's marked exactly k vertexes a1, a2, ..., ak.

Valera's code is given below.

    ans[i][j] // the shortest distance for a pair of vertexes i, j
    a[i]  // vertexes, marked by Valera

    for(i = 1; i <= n; i++) {
        for(j = 1; j <= n; j++) {
            if (i == j)
                ans[i][j] = 0;
            else
                ans[i][j] = INF;  //INF is a very large number
        }
    }

    for(i = 1; i <= m; i++) {
        read a pair of vertexes u, v that have a non-directed edge between them;
        ans[u][v] = 1;
        ans[v][u] = 1;
    }

    for (i = 1; i <= k; i++) {
        v = a[i];
        for(j = 1; j <= n; j++)
            for(r = 1; r <= n; r++)
                ans[j][r] = min(ans[j][r], ans[j][v] + ans[v][r]);
    }

Valera has seen that his code is wrong. Help the boy. Given the set of marked vertexes a1, a2, ..., ak, find such non-directed connected graph, consisting of n vertexes and m edges, for which Valera's code counts the wrong shortest distance for at least one pair of vertexes (i, j). Valera is really keen to get a graph without any loops and multiple edges. If no such graph exists, print -1.

Input

The first line of the input contains three integers n, m, k (3 ≤ n ≤ 300, 2 ≤ k ≤ n , <image>) — the number of vertexes, the number of edges and the number of marked vertexes.

The second line of the input contains k space-separated integers a1, a2, ... ak (1 ≤ ai ≤ n) — the numbers of the marked vertexes. It is guaranteed that all numbers ai are distinct.

Output

If the graph doesn't exist, print -1 on a single line. Otherwise, print m lines, each containing two integers u, v — the description of the edges of the graph Valera's been looking for.

Examples

Input

3 2 2
1 2

Output

1 3
2 3

Input

3 3 2
1 2

Output

-1

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10;
bool mark[333], edge[333][333];
int n, m, k;
void make(int a, int b, bool out) {
  edge[a][b] = edge[b][a] = 1;
  if (out) {
    --m;
    cout << a << ' ' << b << endl;
  }
}
int main() {
  int a[333];
  vector<int> b;
  cin >> n >> m >> k;
  int i, j;
  for (i = 0; i < k; ++i) {
    cin >> a[i];
    mark[a[i]] = 1;
  }
  if (k == n || m > ((n * (n - 1)) >> 1) - k + 1) {
    cout << "-1\n";
    return 0;
  }
  for (i = 1; i <= n; ++i) {
    if (!mark[i]) b.push_back(i);
  }
  for (i = 0; i < b.size(); ++i) make(a[0], b[i], 1);
  for (i = 1; i < k; ++i) {
    make(a[i], b[0], 1);
    make(a[0], a[i], 0);
  }
  for (i = 1; i <= n; ++i) {
    for (j = 1; j <= n; ++j) {
      if (i != j && m > 0 && !edge[i][j]) {
        make(i, j, 1);
      }
    }
  }
  return 0;
}

```


### Prompt

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

Dr. Moriarty is about to send a message to Sherlock Holmes. He has a string s.

String p is called a substring of string s if you can read it starting from some position in the string s. For example, string "aba" has six substrings: "a", "b", "a", "ab", "ba", "aba".

Dr. Moriarty plans to take string s and cut out some substring from it, let's call it t. Then he needs to change the substring t zero or more times. As a result, he should obtain a fixed string u (which is the string that should be sent to Sherlock Holmes). One change is defined as making one of the following actions:

  * Insert one letter to any end of the string.
  * Delete one letter from any end of the string.
  * Change one letter into any other one.

Moriarty is very smart and after he chooses some substring t, he always makes the minimal number of changes to obtain u.

Help Moriarty choose the best substring t from all substrings of the string s. The substring t should minimize the number of changes Moriarty should make to obtain the string u from it.

Input

The first line contains a non-empty string s, consisting of lowercase Latin letters. The second line contains a non-empty string u, consisting of lowercase Latin letters. The lengths of both strings are in the range from 1 to 2000, inclusive.

Output

Print the only integer — the minimum number of changes that Dr. Moriarty has to make with the string that you choose.

Examples

Input

aaaaa
aaa

Output

0

Input

abcabc
bcd

Output

1

Input

abcdef
klmnopq

Output

7

Note

In the first sample Moriarty can take any substring of length 3, and it will be equal to the required message u, so Moriarty won't have to make any changes.

In the second sample you should take a substring consisting of characters from second to fourth ("bca") or from fifth to sixth ("bc"). Then you will only have to make one change: to change or to add the last character.

In the third sample the initial string s doesn't contain any character that the message should contain, so, whatever string you choose, you will have to make at least 7 changes to obtain the required message.

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
char s[20000], s1[20000], s2[20000], s3[20000], s4[20000];
int i, j, k, ans[20000], l1, l2, c;
int main() {
  for (i = 0; i < 2005; i++) ans[i] = 0;
  gets(s);
  gets(s4);
  l1 = strlen(s4);
  for (i = 0; i < l1; i++) s1[i] = ' ';
  strcat(s1, s);
  l2 = strlen(s1);
  for (i = l2; i < l1 + l2 - 1; i++) s1[i] = '0';
  c = l1;
  for (i = 1; i < l2; i++) {
    for (k = i; k < i + c; k++) s2[k - i] = s1[k];
    for (j = 0; j < c; j++) {
      if (s4[j] == s2[j]) ans[i]++;
    }
  }
  sort(ans, ans + l2 + 1);
  cout << l1 - ans[i] << endl;
  return 0;
}

```


### Prompt

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

X and A are integers between 0 and 9 (inclusive).

If X is less than A, print 0; if X is not less than A, print 10.

Constraints

* 0 \leq X, A \leq 9
* All values in input are integers.

Input

Input is given from Standard Input in the following format:

X A

Output

If X is less than A, print 0; if X is not less than A, print 10.

Examples

Input

3 5

Output

0

Input

7 5

Output

10

Input

6 6

Output

10

### Response

```cpp
#include<iostream>
int main(){
  int x,a;std::cin>>x>>a;
   x=x<a?0:10;std::cout<<x;
}
```


### Prompt

Please formulate a CPP solution to the following problem:

Taro and Hanako decided to play hit-and-blow. The hit-and-blow rules are as follows.

* Separated into questioners and respondents.
* The questioner decides a 4-digit number (correct answer) that does not include duplicate numbers.
* Respondents guess the 4-digit number (answer).
* For the answer, the questioner gives a hint by the number of hits and blows.
* Comparing the answer and the correct answer, the fact that both the number and the digit position are the same is called a hit, and the fact that only the number is the same but the digit position is different is called a blow. For example, if the correct answer is 1234 and the answer is 1354, the questioner gives the hint "2 hits, 1 blow" and repeats until the correct answer.
* The questioner and the respondent take turns playing the game, and the one who guesses the correct answer with fewer answers wins.

Taro and Hanako seem to find it a little annoying to judge the number of hits and the number of blows each time. For those two, let's create a program that instantly shows the number of hits and the number of blows.

Create a program that inputs the correct answer r and the answer a and outputs the number of hits and the number of blows. r and a are a sequence of four numbers, 0 to 9, respectively.

Input

A sequence of multiple datasets is given as input. The end of the input is indicated by two lines of zeros. For each dataset, r and a are given on one line, separated by blanks.

The number of datasets does not exceed 12000.

Output

Outputs the number of hits and the number of blows on one line for each input dataset.

Example

Input

1234 5678
1234 1354
1234 1234
1230 1023
0123 1234
0 0

Output

0 0
2 1
4 0
1 3
0 3

### Response

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

int main()
{
  int r, a;

  while (cin >> r >> a, r || a){
    int hit = 0, blow = 0;
    int n1[4], n2[4];
    for (int i = 0; i < 4; i++){
      n1[i] = r % 10;
      n2[i] = a % 10;
      r /= 10;
      a /= 10;
    }
    for (int i = 0; i < 4; i++){
      for (int j = 0; j < 4; j++){
        if (n1[i] == n2[j]){
          if (i == j) hit++;
          else  blow++;
        }
      }
    }
    cout << hit << ' ' << blow << endl;
  }
  return (0);
}
```


### Prompt

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

IT City administration has no rest because of the fame of the Pyramids in Egypt. There is a project of construction of pyramid complex near the city in the place called Emerald Walley. The distinction of the complex is that its pyramids will be not only quadrangular as in Egypt but also triangular and pentagonal. Of course the amount of the city budget funds for the construction depends on the pyramids' volume. Your task is to calculate the volume of the pilot project consisting of three pyramids — one triangular, one quadrangular and one pentagonal.

The first pyramid has equilateral triangle as its base, and all 6 edges of the pyramid have equal length. The second pyramid has a square as its base and all 8 edges of the pyramid have equal length. The third pyramid has a regular pentagon as its base and all 10 edges of the pyramid have equal length.

<image>

Input

The only line of the input contains three integers l3, l4, l5 (1 ≤ l3, l4, l5 ≤ 1000) — the edge lengths of triangular, quadrangular and pentagonal pyramids correspondingly.

Output

Output one number — the total volume of the pyramids. Absolute or relative error should not be greater than 10 - 9.

Examples

Input

2 5 3

Output

38.546168065709

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
double canh(double a, double goc) {
  goc /= 180;
  goc *= acos(-1);
  return sqrt(a * a / (2 * (1 - cos(goc))));
}
double area(double hai, double mot) {
  double p = (hai * 2 + mot) / 2;
  return sqrt(p * (p - hai) * (p - hai) * (p - mot));
}
double h(double a, double hai) { return sqrt(a * a - hai * hai); }
int main() {
  double ans = 0;
  double w[5];
  for (int i = 3; i <= 5; i++) {
    cin >> w[i - 3];
    double temp1 = canh(w[i - 3], 360 / i);
    double cao = h(w[i - 3], temp1);
    ans += cao * i * area(temp1, w[i - 3]) / 3;
  }
  cout << setprecision(10) << ans;
}

```


### Prompt

Please create a solution in CPP to the following problem:

There are n children in Jzzhu's school. Jzzhu is going to give some candies to them. Let's number all the children from 1 to n. The i-th child wants to get at least ai candies.

Jzzhu asks children to line up. Initially, the i-th child stands at the i-th place of the line. Then Jzzhu start distribution of the candies. He follows the algorithm:

  1. Give m candies to the first child of the line.
  2. If this child still haven't got enough candies, then the child goes to the end of the line, else the child go home.
  3. Repeat the first two steps while the line is not empty.

Consider all the children in the order they go home. Jzzhu wants to know, which child will be the last in this order?

Input

The first line contains two integers n, m (1 ≤ n ≤ 100; 1 ≤ m ≤ 100). The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 100).

Output

Output a single integer, representing the number of the last child.

Examples

Input

5 2
1 3 1 4 2

Output

4

Input

6 4
1 1 2 2 3 3

Output

6

Note

Let's consider the first sample.

Firstly child 1 gets 2 candies and go home. Then child 2 gets 2 candies and go to the end of the line. Currently the line looks like [3, 4, 5, 2] (indices of the children in order of the line). Then child 3 gets 2 candies and go home, and then child 4 gets 2 candies and goes to the end of the line. Currently the line looks like [5, 2, 4]. Then child 5 gets 2 candies and goes home. Then child 2 gets two candies and goes home, and finally child 4 gets 2 candies and goes home.

Child 4 is the last one who goes home.

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, x, sum = 0, maxi = -1, max = -101;
  cin >> n >> m;
  vector<int> ar(n + 1, 0);
  for (int i = 1; i <= n; i++) {
    cin >> ar[i];
    if (ar[i] % m == 0) {
      ar[i]--;
    }
    if (max <= (ar[i] / m)) {
      maxi = i;
      max = ar[i] / m;
    }
  }
  cout << maxi;
}

```


### Prompt

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

As Valeric and Valerko were watching one of the last Euro Championship games in a sports bar, they broke a mug. Of course, the guys paid for it but the barman said that he will let them watch football in his bar only if they help his son complete a programming task. The task goes like that.

Let's consider a set of functions of the following form:

<image> Let's define a sum of n functions y1(x), ..., yn(x) of the given type as function s(x) = y1(x) + ... + yn(x) for any x. It's easy to show that in this case the graph s(x) is a polyline. You are given n functions of the given type, your task is to find the number of angles that do not equal 180 degrees, in the graph s(x), that is the sum of the given functions.

Valeric and Valerko really want to watch the next Euro Championship game, so they asked you to help them.

Input

The first line contains integer n (1 ≤ n ≤ 105) — the number of functions. Each of the following n lines contains two space-separated integer numbers ki, bi ( - 109 ≤ ki, bi ≤ 109) that determine the i-th function.

Output

Print a single number — the number of angles that do not equal 180 degrees in the graph of the polyline that equals the sum of the given functions.

Examples

Input

1
1 0

Output

1

Input

3
1 0
0 2
-1 1

Output

2

Input

3
-2 -4
1 7
-5 1

Output

3

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
const int di[] = {-1, 0, 1, 0};
const int dj[] = {0, 1, 0, -1};
const long long MOD = 1e9 + 7;
const long long INF = 1e9;
const double EPS = 1e-5;
long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); }
struct Fraction {
  long long num, den;
  Fraction(long long _num, long long _den) : num(_num), den(_den) {
    long long g = gcd(abs(num), abs(den));
    num /= g;
    den /= g;
    if (den < 0) num = -num, den = -den;
  }
  bool operator<(Fraction other) const {
    return num * other.den < other.num * den;
  }
};
int main() {
  ios::sync_with_stdio(false), cin.tie(0);
  int n;
  cin >> n;
  set<Fraction> st;
  for (int i = 0; i < n; i++) {
    int k, b;
    cin >> k >> b;
    if (!k) continue;
    st.insert(Fraction(-b, k));
  }
  cout << st.size() << endl;
  cin.ignore(), cin.get();
}

```


### Prompt

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

Simon has a prime number x and an array of non-negative integers a1, a2, ..., an.

Simon loves fractions very much. Today he wrote out number <image> on a piece of paper. After Simon led all fractions to a common denominator and summed them up, he got a fraction: <image>, where number t equals xa1 + a2 + ... + an. Now Simon wants to reduce the resulting fraction.

Help him, find the greatest common divisor of numbers s and t. As GCD can be rather large, print it as a remainder after dividing it by number 1000000007 (109 + 7).

Input

The first line contains two positive integers n and x (1 ≤ n ≤ 105, 2 ≤ x ≤ 109) — the size of the array and the prime number.

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

Output

Print a single number — the answer to the problem modulo 1000000007 (109 + 7).

Examples

Input

2 2
2 2

Output

8

Input

3 3
1 2 3

Output

27

Input

2 2
29 29

Output

73741817

Input

4 5
0 0 0 0

Output

1

Note

In the first sample <image>. Thus, the answer to the problem is 8.

In the second sample, <image>. The answer to the problem is 27, as 351 = 13·27, 729 = 27·27.

In the third sample the answer to the problem is 1073741824 mod 1000000007 = 73741817.

In the fourth sample <image>. Thus, the answer to the problem is 1.

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, x;
  cin >> n >> x;
  int a[n];
  for (int i = 0; i < n; i++) cin >> a[i];
  long long power_value = a[n - 1];
  int power_count = 0;
  for (int i = n - 1; i >= 0;) {
    while (i >= 0 && power_value == a[i]) power_count++, i--;
    if (power_count % x != 0) break;
    power_value--;
    power_count /= x;
  }
  while (power_count % x == 0) {
    power_value--;
    power_count /= x;
  }
  if (power_value < 0) power_value = 0;
  long long sum = 0;
  for (int i = n - 1; i >= 0; i--) sum += a[i];
  power_value = sum - power_value;
  long long gcd = 1;
  const int modulo = 1000000007;
  for (long long i = x; power_value > 0; power_value >>= 1) {
    if (power_value & 1) gcd = gcd * i % modulo;
    i = i * i % modulo;
  }
  cout << gcd;
}

```


### Prompt

Please formulate a CPP solution to the following problem:

You are given a set of n elements indexed from 1 to n. The weight of i-th element is wi. The weight of some subset of a given set is denoted as <image>. The weight of some partition R of a given set into k subsets is <image> (recall that a partition of a given set is a set of its subsets such that every element of the given set belongs to exactly one subset in partition).

Calculate the sum of weights of all partitions of a given set into exactly k non-empty subsets, and print it modulo 109 + 7. Two partitions are considered different iff there exist two elements x and y such that they belong to the same set in one of the partitions, and to different sets in another partition.

Input

The first line contains two integers n and k (1 ≤ k ≤ n ≤ 2·105) — the number of elements and the number of subsets in each partition, respectively.

The second line contains n integers wi (1 ≤ wi ≤ 109)— weights of elements of the set.

Output

Print one integer — the sum of weights of all partitions of a given set into k non-empty subsets, taken modulo 109 + 7.

Examples

Input

4 2
2 3 2 3

Output

160

Input

5 2
1 2 3 4 5

Output

645

Note

Possible partitions in the first sample:

  1. {{1, 2, 3}, {4}}, W(R) = 3·(w1 + w2 + w3) + 1·w4 = 24;
  2. {{1, 2, 4}, {3}}, W(R) = 26;
  3. {{1, 3, 4}, {2}}, W(R) = 24;
  4. {{1, 2}, {3, 4}}, W(R) = 2·(w1 + w2) + 2·(w3 + w4) = 20;
  5. {{1, 3}, {2, 4}}, W(R) = 20;
  6. {{1, 4}, {2, 3}}, W(R) = 20;
  7. {{1}, {2, 3, 4}}, W(R) = 26;

Possible partitions in the second sample:

  1. {{1, 2, 3, 4}, {5}}, W(R) = 45;
  2. {{1, 2, 3, 5}, {4}}, W(R) = 48;
  3. {{1, 2, 4, 5}, {3}}, W(R) = 51;
  4. {{1, 3, 4, 5}, {2}}, W(R) = 54;
  5. {{2, 3, 4, 5}, {1}}, W(R) = 57;
  6. {{1, 2, 3}, {4, 5}}, W(R) = 36;
  7. {{1, 2, 4}, {3, 5}}, W(R) = 37;
  8. {{1, 2, 5}, {3, 4}}, W(R) = 38;
  9. {{1, 3, 4}, {2, 5}}, W(R) = 38;
  10. {{1, 3, 5}, {2, 4}}, W(R) = 39;
  11. {{1, 4, 5}, {2, 3}}, W(R) = 40;
  12. {{2, 3, 4}, {1, 5}}, W(R) = 39;
  13. {{2, 3, 5}, {1, 4}}, W(R) = 40;
  14. {{2, 4, 5}, {1, 3}}, W(R) = 41;
  15. {{3, 4, 5}, {1, 2}}, W(R) = 42.

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
const int N = 200001;
const long long mod = 1000000007ll;
int n, k;
long long fact[N], inv[N], inv_fact[N];
long long w[N], s = 0;
long long C(int a, int b) {
  if (a < b)
    return 0;
  else
    return (fact[a] * ((inv_fact[b] * inv_fact[a - b]) % mod)) % mod;
}
long long qpow(long long a, int m) {
  long long ret = 1;
  while (m) {
    if (m & 1) ret = (ret * a) % mod;
    a = (a * a) % mod, m >>= 1;
  }
  return ret;
}
long long S(int a, int b) {
  long long total = 0;
  if (a < b) return 0;
  for (int i = 0; i <= b; i++) {
    long long delta = 0;
    delta = C(b, i);
    if ((b - i) & 1) delta = (mod - delta) % mod;
    total = (total + delta * qpow(1ll * i, a)) % mod;
  }
  return (total * inv_fact[b]) % mod;
}
int main() {
  scanf("%d%d", &n, &k);
  for (int i = 1; i <= n; i++) scanf("%lld", &w[i]), s = (s + w[i]) % mod;
  inv[1] = 1;
  for (int i = 2; i <= n; i++)
    inv[i] = ((mod / i) * (mod - inv[mod % i])) % mod;
  fact[0] = 1, inv_fact[0] = 1;
  for (int i = 1; i <= n; i++)
    fact[i] = (fact[i - 1] * 1ll * i) % mod,
    inv_fact[i] = (inv_fact[i - 1] * inv[i]) % mod;
  long long num = (S(n, k) + 1ll * (n - 1) * S(n - 1, k)) % mod;
  printf("%lld\n", (num * s) % mod);
  return 0;
}

```


### Prompt

Develop a solution in CPP to the problem described below:

Curry making

As the ACM-ICPC domestic qualifying is approaching, you who wanted to put more effort into practice decided to participate in a competitive programming camp held at a friend's house. Participants decided to prepare their own meals.

On the first night of the training camp, the participants finished the day's practice and began preparing dinner. Not only in competitive programming, but also in self-catering, you are often said to be a "professional", and you have spared time because you have finished making the menu for your charge in a blink of an eye. Therefore, I decided to help other people make curry.

Now, there is a curry made by mixing R0 [g] roux with W0 [L] water. There is one type of roux used this time, and each roux is R [g]. Ru has a sufficient stockpile. When you use this roux, you think that the curry with a concentration of C [g / L] is the most delicious, so add some roux and water to this curry appropriately to make the concentration C [g / L]. I want to. Here, the concentration of curry in which roux R0 [g] is dissolved in water W0 [L] is R0 / W0 [g / L], and X roux of R [g] and water Y [L] are added to this curry. ] Is added, the concentration becomes (R0 + XR) / (W0 + Y) [g / L]. Although there are a lot of roux, you thought that it was not good to use too much, so you decided to make a curry with a concentration of C [g / L] by reducing the number of roux to be added as much as possible.

When making a curry with a concentration of C [g / L] by properly adding either roux, water, or both to a curry with a concentration of R0 / W0 [g / L], the number of roux X to be added Find the minimum value.

However, please note the following points regarding the curry making this time.

* Number of roux to be added The value of X must be an integer greater than or equal to 0. In other words, it is not possible to add only 1/3 of the roux.
* The value of the volume Y of water to be added can be a real number greater than or equal to 0, and does not have to be an integer.
* In some cases, it is possible to make curry with a concentration of C without adding either roux, water, or both.
* Since a sufficient amount of roux and water is secured, it is good that the situation that the curry with concentration C cannot be made due to lack of roux and water does not occur.

Input

The input consists of multiple datasets. Each dataset consists of one line and is expressed in the following format.

> R0 W0 C R

Here, R0, W0, C, and R are the mass of roux already dissolved in the curry that is being made [g], the volume of water contained in the curry [L], and the concentration of the curry you want to make [g / L]. , Represents the mass [g] per roux. All of these values are integers between 1 and 100. The end of the input is indicated by a line of four zeros separated by blanks.

Output

For each dataset, one line is the minimum number of roux that needs to be added to make a curry with a concentration of C from a fake curry that is a mixture of W0 [L] water and R0 [g] roux. To output. Do not output the amount of water to add.

Note that due to input constraints, the minimum number of roux that is the answer for each dataset is guaranteed to be within the range represented by a 32-bit signed integer.

Sample Input

10 5 3 4
2 5 2 3
91 13 7 62
10 1 3 5
20 100 2 20
2 14 7 1
0 0 0 0

Output for Sample Input

2
3
0
0
9
96

Example

Input

10 5 3 4
2 5 2 3
91 13 7 62
10 1 3 5
20 100 2 20
2 14 7 1
0 0 0 0

Output

2
3
0
0
9
96

### Response

```cpp
#include<bits/stdc++.h>
using namespace std;
int main(){
	int a,b,c,d,e,i;
	while(1){
		i=0;
		cin >> a >> b >> c >> d;
		if(a==0 && b ==0 && c==0 && d==0) break;
		while(1){
			e=a/b;
			if(e<c){
				a+=d;
				i++;
			}else{
				break;
			}
		}
		cout << i << endl;
	}
}

```


### Prompt

Please formulate a cpp solution to the following problem:

Given an n × n table T consisting of lowercase English letters. We'll consider some string s good if the table contains a correct path corresponding to the given string. In other words, good strings are all strings we can obtain by moving from the left upper cell of the table only to the right and down. Here's the formal definition of correct paths:

Consider rows of the table are numbered from 1 to n from top to bottom, and columns of the table are numbered from 1 to n from left to the right. Cell (r, c) is a cell of table T on the r-th row and in the c-th column. This cell corresponds to letter Tr, c.

A path of length k is a sequence of table cells [(r1, c1), (r2, c2), ..., (rk, ck)]. The following paths are correct:

  1. There is only one correct path of length 1, that is, consisting of a single cell: [(1, 1)];
  2. Let's assume that [(r1, c1), ..., (rm, cm)] is a correct path of length m, then paths [(r1, c1), ..., (rm, cm), (rm + 1, cm)] and [(r1, c1), ..., (rm, cm), (rm, cm + 1)] are correct paths of length m + 1.

We should assume that a path [(r1, c1), (r2, c2), ..., (rk, ck)] corresponds to a string of length k: Tr1, c1 + Tr2, c2 + ... + Trk, ck.

Two players play the following game: initially they have an empty string. Then the players take turns to add a letter to the end of the string. After each move (adding a new letter) the resulting string must be good. The game ends after 2n - 1 turns. A player wins by the following scenario:

  1. If the resulting string has strictly more letters "a" than letters "b", then the first player wins;
  2. If the resulting string has strictly more letters "b" than letters "a", then the second player wins;
  3. If the resulting string has the same number of letters "a" and "b", then the players end the game with a draw.

Your task is to determine the result of the game provided that both players played optimally well.

Input

The first line contains a single number n (1 ≤ n ≤ 20).

Next n lines contain n lowercase English letters each — table T.

Output

In a single line print string "FIRST", if the first player wins, "SECOND", if the second player wins and "DRAW", if the game ends with a draw.

Examples

Input

2
ab
cd

Output

DRAW

Input

2
xa
ay

Output

FIRST

Input

3
aab
bcb
bac

Output

DRAW

Note

Consider the first sample:

Good strings are strings: a, ab, ac, abd, acd.

The first player moves first and adds letter a to the string, as there is only one good string of length 1. Then the second player can add b or c and the game will end with strings abd or acd, correspondingly. In the first case it will be a draw (the string has one a and one b), in the second case the first player wins. Naturally, in this case the second player prefers to choose letter b and end the game with a draw.

Consider the second sample:

Good strings are: x, xa, xay.

We can see that the game will end with string xay and the first player wins.

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
const int N = 20 + 7;
const int inf = 0x3f3f3f3f;
const long long INF = 0x3f3f3f3f3f3f3f3f;
const int mod = 1e9 + 7;
const double eps = 1e-8;
const double PI = acos(-1);
template <class T, class S>
inline void add(T& a, S b) {
  a += b;
  if (a >= mod) a -= mod;
}
template <class T, class S>
inline void sub(T& a, S b) {
  a -= b;
  if (a < 0) a += mod;
}
template <class T, class S>
inline bool chkmax(T& a, S b) {
  return a < b ? a = b, true : false;
}
template <class T, class S>
inline bool chkmin(T& a, S b) {
  return a > b ? a = b, true : false;
}
int n;
int dp[21 * 2][1 << 20];
bool vis[21 * 2][1 << 20];
char Map[30][30];
int id[30][30];
struct Point {
  int x, y;
};
vector<Point> vc[50];
int dfs(int d, int mask, int op) {
  if (d == n * 2 - 2) return 0;
  int& ans = dp[d][mask];
  if (vis[d][mask]) return ans;
  ans = op ? inf : -inf;
  int up = ((int)vc[d].size());
  for (char c = 'a'; c <= 'z'; c++) {
    int nxtmask = 0, sco = 0;
    if (c == 'a')
      sco = 1;
    else if (c == 'b')
      sco = -1;
    for (int i = 0; i < up; i++) {
      if (mask >> i & 1) {
        int x = vc[d][i].x, y = vc[d][i].y + 1;
        if (y < n && Map[x][y] == c) {
          nxtmask |= 1 << id[x][y];
        }
        x = vc[d][i].x + 1, y = vc[d][i].y;
        if (x < n && Map[x][y] == c) {
          nxtmask |= 1 << id[x][y];
        }
      }
    }
    if (nxtmask) {
      if (op)
        chkmin(ans, dfs(d + 1, nxtmask, op ^ 1) + sco);
      else
        chkmax(ans, dfs(d + 1, nxtmask, op ^ 1) + sco);
    }
  }
  vis[d][mask] = true;
  return ans;
}
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) scanf("%s", Map[i]);
  for (int i = 0; i < n; i++) {
    int x = i, y = 0;
    while (x < n && y < n && x >= 0 && y >= 0) {
      id[x][y] = ((int)vc[i].size());
      vc[i].push_back(Point{x, y}), x--, y++;
    }
  }
  for (int i = n; i < 2 * n; i++) {
    int x = n - 1, y = i - n + 1;
    while (x < n && y < n && x >= 0 && y >= 0) {
      id[x][y] = ((int)vc[i].size());
      vc[i].push_back(Point{x, y}), x--, y++;
    }
  }
  int judge = dfs(0, 1, 1);
  if (Map[0][0] == 'a')
    judge++;
  else if (Map[0][0] == 'b')
    judge--;
  if (judge > 0)
    puts("FIRST");
  else if (judge < 0)
    puts("SECOND");
  else
    puts("DRAW");
  return 0;
}

```


### Prompt

Please formulate a cpp solution to the following problem:

Given an undirected weighted graph G, you should find one of spanning trees specified as follows.

The graph G is an ordered pair (V, E), where V is a set of vertices {v1, v2, ... , vn} and E is a set of undirected edges {e1, e2, ... , em}. Each edge e ∈ E has its weight w(e).

A spanning tree T is a tree (a connected subgraph without cycles) which connects all the n vertices with n - 1 edges. The slimness of a spanning tree T is defined as the difference between the largest weight and the smallest weight among the n - 1 edges of T.

<image>

Figure 5: A graph G and the weights of the edges

For example, a graph G in Figure 5(a) has four vertices {v1, v2, v3, v4} and five undirected edges {e1, e2, e3, e4, e5}. The weights of the edges are w(e1) = 3, w(e2) = 5, w(e3) = 6, w(e4) = 6, w(e5) = 7 as shown in Figure 5(b).

<image>

Figure 6: Examples of the spanning trees of G

There are several spanning trees for G. Four of them are depicted in Figure 6(a)-(d). The spanning tree Ta in Figure 6(a) has three edges whose weights are 3, 6 and 7. The largest weight is 7 and the smallest weight is 3 so that the slimness of the tree Ta is 4. The slimnesses of spanning trees Tb , Tc and Td shown in Figure 6(b), (c) and (d) are 3, 2 and 1, respectively. You can easily see the slimness of any other spanning tree is greater than or equal to 1, thus the spanning tree Td in Figure 6(d) is one of the slimmest spanning trees whose slimness is 1.

Your job is to write a program that computes the smallest slimness.

Input

The input consists of multiple datasets, followed by a line containing two zeros separated by a space. Each dataset has the following format.

n     m
a1  b1  w1
.
.
.
am  bm  wm

Every input item in a dataset is a non-negative integer. Items in a line are separated by a space.

n is the number of the vertices and m the number of the edges. You can assume 2 ≤ n ≤ 100 and 0 ≤ m ≤ n(n - 1)/2. ak and bk (k = 1, ... , m) are positive integers less than or equal to n, which represent the two vertices vak and vbk connected by the kth edge ek. wk is a positive integer less than or equal to 10000, which indicates the weight of ek . You can assume that the graph G = (V, E) is simple, that is, there are no self-loops (that connect the same vertex) nor parallel edges (that are two or more edges whose both ends are the same two vertices).

Output

For each dataset, if the graph has spanning trees, the smallest slimness among them should be printed. Otherwise, -1 should be printed. An output should not contain extra characters.

Example

Input

4 5
1 2 3
1 3 5
1 4 6
2 4 6
3 4 7
4 6
1 2 10
1 3 100
1 4 90
2 3 20
2 4 80
3 4 40
2 1
1 2 1
3 0
3 1
1 2 1
3 3
1 2 2
2 3 5
1 3 6
5 10
1 2 110
1 3 120
1 4 130
1 5 120
2 3 110
2 4 120
2 5 130
3 4 120
3 5 110
4 5 120
5 10
1 2 9384
1 3 887
1 4 2778
1 5 6916
2 3 7794
2 4 8336
2 5 5387
3 4 493
3 5 6650
4 5 1422
5 8
1 2 1
2 3 100
3 4 100
4 5 100
1 5 50
2 5 50
3 5 50
4 1 150
0 0

Output

1
20
0
-1
-1
1
0
1686
50

### Response

```cpp
#include <iostream>
#include <vector>
#include <cstdio>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <algorithm>
using namespace std;
#define INF (1<<26)
#define P(a,b) make_pair(a,b)

int n,m;
int g[100][100]={};

int prim(int low){
	int used[100] = {} , cost[100] = {} , total = 0;
	for(int i = 0 ; i < 100 ; i++) cost[i] = INF;
	used[0] = true;
	for(int i = 0 ; i < n ; i++) if(g[i][0] >= low) cost[i] = min(g[i][0],cost[i]);
	while(1){
		int uV = -1, uC = INF;
		for(int i = 0 ; i < n ; i++){
			if(!used[i] && cost[i] >= low && uC > cost[i]){
				uC = cost[i];
				uV = i;
			}
		}
		if(uV == -1){
			return count(used,used+n,1) == n ? total - low : INF;
		}
		total = max(uC,total);
		used[uV] = true;
		for(int i = 0 ; i < n ; i++) if(g[i][uV] >= low)cost[i] = min(g[i][uV],cost[i]);
	}

}
int main(){
	while(cin >> n >> m && n){
			for(int i = 0 ; i < n ; i++)
				for(int j = 0 ; j < n ; j++)
					g[i][j] = INF;

			for(int i = 0 ; i < m ; i++){
				int a,b,c;
				cin >> a >> b >> c;
				a--,b--;
				g[a][b] = g[b][a] = c;
			}
			int ans = INF;
			for(int i = 0 ; i < n ; i++){
				for(int j = i ; j < n ; j++){
					if(g[i][j] != INF)ans = min(ans,prim(g[i][j]));
				}
			}
			cout << (ans==INF?-1:ans) << endl;
	}
}
```


### Prompt

Please formulate a cpp solution to the following problem:

Little Dima has two sequences of points with integer coordinates: sequence (a1, 1), (a2, 2), ..., (an, n) and sequence (b1, 1), (b2, 2), ..., (bn, n).

Now Dima wants to count the number of distinct sequences of points of length 2·n that can be assembled from these sequences, such that the x-coordinates of points in the assembled sequence will not decrease. Help him with that. Note that each element of the initial sequences should be used exactly once in the assembled sequence.

Dima considers two assembled sequences (p1, q1), (p2, q2), ..., (p2·n, q2·n) and (x1, y1), (x2, y2), ..., (x2·n, y2·n) distinct, if there is such i (1 ≤ i ≤ 2·n), that (pi, qi) ≠ (xi, yi).

As the answer can be rather large, print the remainder from dividing the answer by number m.

Input

The first line contains integer n (1 ≤ n ≤ 105). The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 109). The third line contains n integers b1, b2, ..., bn (1 ≤ bi ≤ 109). The numbers in the lines are separated by spaces.

The last line contains integer m (2 ≤ m ≤ 109 + 7).

Output

In the single line print the remainder after dividing the answer to the problem by number m.

Examples

Input

1
1
2
7

Output

1

Input

2
1 2
2 3
11

Output

2

Note

In the first sample you can get only one sequence: (1, 1), (2, 1).

In the second sample you can get such sequences : (1, 1), (2, 2), (2, 1), (3, 2); (1, 1), (2, 1), (2, 2), (3, 2). Thus, the answer is 2.

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
int n, m;
pair<int, int> ar[200000];
int main() {
  scanf("%d", &n);
  int i;
  for (i = 0; i < n; i++) {
    scanf("%d", &ar[i].first);
    ar[i].second = i;
  }
  for (i = 0; i < n; i++) {
    scanf("%d", &ar[n + i].first);
    ar[n + i].second = i;
  }
  scanf("%d", &m);
  sort(ar, ar + n * 2);
  int p = 0;
  long long ans = 1;
  while (p < n * 2) {
    int s = p;
    int num = ar[p].first;
    while (p < n * 2 && ar[p].first == num) {
      if (p < n * 2 - 1 && ar[p + 1].first == num &&
          ar[p].second == ar[p + 1].second) {
        long long res = (long long)(p - s + 2) * (long long)(p - s + 1) / 2 % m;
        ans = ans * res % m;
        p += 2;
      } else {
        ans = ans * (p - s + 1) % m;
        p++;
      }
    }
  }
  printf("%I64d\n", ans);
  return 0;
}

```


### Prompt

Please formulate a cpp solution to the following problem:

In Berland recently a new collection of toys went on sale. This collection consists of 109 types of toys, numbered with integers from 1 to 109. A toy from the new collection of the i-th type costs i bourles.

Tania has managed to collect n different types of toys a1, a2, ..., an from the new collection. Today is Tanya's birthday, and her mother decided to spend no more than m bourles on the gift to the daughter. Tanya will choose several different types of toys from the new collection as a gift. Of course, she does not want to get a type of toy which she already has.

Tanya wants to have as many distinct types of toys in her collection as possible as the result. The new collection is too diverse, and Tanya is too little, so she asks you to help her in this.

Input

The first line contains two integers n (1 ≤ n ≤ 100 000) and m (1 ≤ m ≤ 109) — the number of types of toys that Tanya already has and the number of bourles that her mom is willing to spend on buying new toys.

The next line contains n distinct integers a1, a2, ..., an (1 ≤ ai ≤ 109) — the types of toys that Tanya already has.

Output

In the first line print a single integer k — the number of different types of toys that Tanya should choose so that the number of different types of toys in her collection is maximum possible. Of course, the total cost of the selected toys should not exceed m.

In the second line print k distinct space-separated integers t1, t2, ..., tk (1 ≤ ti ≤ 109) — the types of toys that Tanya should choose.

If there are multiple answers, you may print any of them. Values of ti can be printed in any order.

Examples

Input

3 7
1 3 4

Output

2
2 5

Input

4 14
4 6 12 8

Output

4
7 2 3 1

Note

In the first sample mom should buy two toys: one toy of the 2-nd type and one toy of the 5-th type. At any other purchase for 7 bourles (assuming that the toys of types 1, 3 and 4 have already been bought), it is impossible to buy two and more toys.

### Response

```cpp
#include <bits/stdc++.h>
int main() {
  int n, i, j, cnt = 0, sum = 0, cost;
  scanf("%d %d", &n, &cost);
  int ara[n], ara2[100000];
  for (i = 0; i < n; i++) {
    scanf("%d", &ara[i]);
  }
  std::sort(ara, ara + n);
  int x = 0, z = 0;
  for (i = 1; i <= cost; i++) {
    sum += i;
    cnt++;
    if (i == ara[x] && x < n) {
      cnt--;
      sum -= ara[x];
      x++;
      continue;
    }
    if (sum > cost) {
      sum -= i;
      cnt--;
      i--;
      break;
    } else if (sum == cost) {
      ara2[z] = i;
      z++;
      break;
    } else {
      ara2[z] = i;
      z++;
    }
  }
  printf("%d\n", cnt);
  for (j = 0; j < z; j++) printf("%d ", ara2[j]);
}

```


### Prompt

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

You are given a grid, consisting of 2 rows and n columns. Each cell of this grid should be colored either black or white.

Two cells are considered neighbours if they have a common border and share the same color. Two cells A and B belong to the same component if they are neighbours, or if there is a neighbour of A that belongs to the same component with B.

Let's call some bicoloring beautiful if it has exactly k components.

Count the number of beautiful bicolorings. The number can be big enough, so print the answer modulo 998244353.

Input

The only line contains two integers n and k (1 ≤ n ≤ 1000, 1 ≤ k ≤ 2n) — the number of columns in a grid and the number of components required.

Output

Print a single integer — the number of beautiful bicolorings modulo 998244353.

Examples

Input

3 4

Output

12

Input

4 1

Output

2

Input

1 2

Output

2

Note

One of possible bicolorings in sample 1:

<image>

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
const int N = 2100;
int n, k;
const int mod = 998244353;
int first[N][N][2][2];
int main() {
  cin >> n >> k;
  first[1][1][0][0] = first[1][1][1][1] = 1;
  first[1][2][0][1] = first[1][2][1][0] = 1;
  for (int i = 2; i <= n; ++i) {
    for (int j = 1; j <= min(2 * i - 2, k); ++j) {
      for (int a = 0; a <= 1; ++a)
        for (int b = 0; b <= 1; ++b)
          for (int x = 0; x <= 1; ++x)
            for (int y = 0; y <= 1; ++y) {
              if (a == b) {
                if (x == y && a == x)
                  first[i][j][a][b] =
                      (first[i][j][a][b] + first[i - 1][j][a][b]) % mod;
                else
                  first[i][j + 1][x][y] =
                      (first[i][j + 1][x][y] + first[i - 1][j][a][b]) % mod;
                continue;
              }
              if (x == y || a == x)
                first[i][j][x][y] =
                    (first[i][j][x][y] + first[i - 1][j][a][b]) % mod;
              else
                first[i][j + 2][x][y] =
                    (first[i][j + 2][x][y] + first[i - 1][j][a][b]) % mod;
            }
    }
  }
  int res = 0;
  for (int i = 0; i < 2; ++i)
    for (int j = 0; j < 2; ++j) res = (res + first[n][k][i][j]) % mod;
  cout << res;
}

```


### Prompt

Generate a Cpp solution to the following problem:

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

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

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

Find the minimum possible diameter that Vanya can get.

Input

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

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

It is guaranteed that the given edges form a tree.

Output

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

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

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

Examples

Input

4 3
1 2
1 3
1 4

Output

2.000000000000000000

Input

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

Output

0.500000000000000000

Input

5 5
1 2
2 3
3 4
3 5

Output

3.333333333333333333

Note

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

<image>

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

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

<image>

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
long long add = 0;
vector<long long> order, h;
vector<vector<long long>> edges, children;
void dfs(long long i, long long p) {
  for (long long to : edges[i]) {
    if (to != p) {
      children[i].push_back(to);
      dfs(to, i);
    }
  }
  order.push_back(i);
}
void solve(long long i) {
  if (children[i].empty()) {
    add++;
  }
  for (long long to : children[i]) {
    solve(to);
  }
}
int32_t main() {
  cin.tie(0);
  cout.tie(0);
  cin.sync_with_stdio(0);
  long long n, s, x, y;
  cin >> n >> s;
  edges.resize(n);
  children.resize(n);
  h.resize(n);
  order.reserve(n);
  for (long long i = 0; i < n - 1; i++) {
    cin >> x >> y;
    x--;
    y--;
    edges[x].push_back(y);
    edges[y].push_back(x);
  }
  dfs(0, -1);
  solve(0);
  cout << fixed << setprecision(8)
       << s * 2.0 / (add + (children[0].size() == 1));
  return 0;
}

```


### Prompt

Develop a solution in CPP to the problem described below:

Students of group 199 have written their lectures dismally. Now an exam on Mathematical Analysis is approaching and something has to be done asap (that is, quickly). Let's number the students of the group from 1 to n. Each student i (1 ≤ i ≤ n) has a best friend p[i] (1 ≤ p[i] ≤ n). In fact, each student is a best friend of exactly one student. In other words, all p[i] are different. It is possible that the group also has some really "special individuals" for who i = p[i].

Each student wrote exactly one notebook of lecture notes. We know that the students agreed to act by the following algorithm:

  * on the first day of revising each student studies his own Mathematical Analysis notes,
  * in the morning of each following day each student gives the notebook to his best friend and takes a notebook from the student who calls him the best friend.

Thus, on the second day the student p[i] (1 ≤ i ≤ n) studies the i-th student's notes, on the third day the notes go to student p[p[i]] and so on. Due to some characteristics of the boys' friendship (see paragraph 1), each day each student has exactly one notebook to study.

You are given two sequences that describe the situation on the third and fourth days of revising:

  * a1, a2, ..., an, where ai means the student who gets the i-th student's notebook on the third day of revising;
  * b1, b2, ..., bn, where bi means the student who gets the i-th student's notebook on the fourth day of revising.

You do not know array p, that is you do not know who is the best friend to who. Write a program that finds p by the given sequences a and b.

Input

The first line contains integer n (1 ≤ n ≤ 105) — the number of students in the group. The second line contains sequence of different integers a1, a2, ..., an (1 ≤ ai ≤ n). The third line contains the sequence of different integers b1, b2, ..., bn (1 ≤ bi ≤ n).

Output

Print sequence n of different integers p[1], p[2], ..., p[n] (1 ≤ p[i] ≤ n). It is guaranteed that the solution exists and that it is unique.

Examples

Input

4
2 1 4 3
3 4 2 1

Output

4 3 1 2

Input

5
5 2 3 1 4
1 3 2 4 5

Output

4 3 2 5 1

Input

2
1 2
2 1

Output

2 1

### Response

```cpp
#include <bits/stdc++.h>
int main() {
  int n;
  std::cin >> n;
  int* a = new int[n];
  int* b = new int[n];
  int* a_rev = new int[n];
  for (int i = 0; i < n; ++i) {
    std::cin >> a[i];
  }
  for (int i = 0; i < n; ++i) {
    std::cin >> b[i];
  }
  for (int i = 0; i < n; ++i) {
    a_rev[a[i] - 1] = i;
  }
  int* ans = new int[n];
  for (int i = 0; i < n; ++i) {
    ans[a[i] - 1] = b[i];
  }
  for (int i = 0; i < n; ++i) {
    std::cout << ans[i] << " ";
  }
  return 0;
}

```


### Prompt

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

For some reason in many American cartoons anvils fall from time to time onto heroes' heads. Of course, safes, wardrobes, cruisers, planes fall sometimes too... But anvils do so most of all.

Anvils come in different sizes and shapes. Quite often they get the hero stuck deep in the ground. But have you ever thought who throws anvils from the sky? From what height? We are sure that such questions have never troubled you!

It turns out that throwing an anvil properly is not an easy task at all. Let's describe one of the most popular anvil throwing models.

Let the height p of the potential victim vary in the range [0;a] and the direction of the wind q vary in the range [ - b;b]. p and q could be any real (floating) numbers. Then we can assume that the anvil will fit the toon's head perfectly only if the following equation has at least one real root:

<image>

Determine the probability with which an aim can be successfully hit by an anvil.

You can assume that the p and q coefficients are chosen equiprobably and independently in their ranges.

Input

The first line contains integer t (1 ≤ t ≤ 10000) — amount of testcases.

Each of the following t lines contain two space-separated integers a and b (0 ≤ a, b ≤ 106).

Pretests contain all the tests with 0 < a < 10, 0 ≤ b < 10.

Output

Print t lines — the probability of a successful anvil hit for each testcase. The absolute or relative error of the answer should not exceed 10 - 6.

Examples

Input

2
4 2
1 2

Output

0.6250000000
0.5312500000

### Response

```cpp
#include <bits/stdc++.h>
long double solve(const int P, const int Q) {
  if (Q == 0) {
    return 1;
  }
  if (P == 0) {
    return 0.5;
  }
  long double p = std::min(P, 4 * Q);
  return 1 - (Q * p - p * p / 8) / P / (2 * Q);
}
int main() {
  std::ios_base::sync_with_stdio(false);
  std::cin.tie(0);
  std::cout.tie(0);
  std::cerr.tie(0);
  std::cout << std::fixed << std::setprecision(6);
  int nT;
  while (std::cin >> nT) {
    for (int i = 0; i < nT; ++i) {
      int P, Q;
      std::cin >> P >> Q;
      std::cout << solve(P, Q) << "\n";
    }
    std::cout << std::endl;
  }
  return 0;
}

```


### Prompt

Generate a cpp solution to the following problem:

The only difference between easy and hard versions is constraints.

You are given n segments on the coordinate axis OX. Segments can intersect, lie inside each other and even coincide. The i-th segment is [l_i; r_i] (l_i ≤ r_i) and it covers all integer points j such that l_i ≤ j ≤ r_i.

The integer point is called bad if it is covered by strictly more than k segments.

Your task is to remove the minimum number of segments so that there are no bad points at all.

Input

The first line of the input contains two integers n and k (1 ≤ k ≤ n ≤ 200) — the number of segments and the maximum number of segments by which each integer point can be covered.

The next n lines contain segments. The i-th line contains two integers l_i and r_i (1 ≤ l_i ≤ r_i ≤ 200) — the endpoints of the i-th segment.

Output

In the first line print one integer m (0 ≤ m ≤ n) — the minimum number of segments you need to remove so that there are no bad points.

In the second line print m distinct integers p_1, p_2, ..., p_m (1 ≤ p_i ≤ n) — indices of segments you remove in any order. If there are multiple answers, you can print any of them.

Examples

Input

7 2
11 11
9 11
7 8
8 9
7 8
9 11
7 9

Output

3
1 4 7

Input

5 1
29 30
30 30
29 29
28 30
30 30

Output

3
1 2 4

Input

6 1
2 3
3 3
2 3
2 2
2 3
2 3

Output

4
1 3 5 6

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
long long mult(long long a, long long b, long long p = 1000000007) {
  return ((a % p) * (b % p)) % p;
}
long long add(long long a, long long b, long long p = 1000000007) {
  return (a % p + b % p) % p;
}
long long fpow(long long n, long long k, long long p = 1000000007) {
  long long r = 1;
  for (; k; k >>= 1LL) {
    if (k & 1LL) r = mult(r, n, p);
    n = mult(n, n, p);
  }
  return r;
}
long long inv(long long a, long long p = 1000000007) {
  return fpow(a, p - 2, p);
}
vector<int> st[3 * 100001];
set<pair<int, int> > curr;
vector<int> ind[3 * 100001];
void solve() {
  int n, k;
  cin >> n >> k;
  int A[3 * 100001 + 2];
  memset(A, 0, sizeof(A));
  int a, b;
  for (int i = 0; i < n; i++) {
    cin >> a >> b;
    st[a].push_back(b);
    ind[a].push_back(i + 1);
  }
  vector<int> ans;
  for (int i = 1; i < 3 * 100001; i++) {
    A[i] += A[i - 1];
    for (int j = 0; j < st[i].size(); j++) {
      curr.insert(make_pair(st[i][j], ind[i][j]));
      A[i]++;
      A[st[i][j] + 1]--;
    }
    while (A[i] > k) {
      auto it = curr.end();
      it--;
      A[i]--;
      A[(it->first) + 1]++;
      ans.push_back(it->second);
      curr.erase(it);
    }
  }
  cout << ans.size() << '\n';
  sort((ans).begin(), (ans).end());
  for (int i : ans) cout << i << " ";
  cout << '\n';
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int t = 1;
  while (t--) {
    solve();
  }
}

```


### Prompt

Please formulate a CPP solution to the following problem:

There are b blocks of digits. Each one consisting of the same n digits, which are given to you in the input. Wet Shark must choose exactly one digit from each block and concatenate all of those digits together to form one large integer. For example, if he chooses digit 1 from the first block and digit 2 from the second block, he gets the integer 12.

Wet Shark then takes this number modulo x. Please, tell him how many ways he can choose one digit from each block so that he gets exactly k as the final result. As this number may be too large, print it modulo 109 + 7.

Note, that the number of ways to choose some digit in the block is equal to the number of it's occurrences. For example, there are 3 ways to choose digit 5 from block 3 5 6 7 8 9 5 1 1 1 1 5.

Input

The first line of the input contains four space-separated integers, n, b, k and x (2 ≤ n ≤ 50 000, 1 ≤ b ≤ 109, 0 ≤ k < x ≤ 100, x ≥ 2) — the number of digits in one block, the number of blocks, interesting remainder modulo x and modulo x itself.

The next line contains n space separated integers ai (1 ≤ ai ≤ 9), that give the digits contained in each block.

Output

Print the number of ways to pick exactly one digit from each blocks, such that the resulting integer equals k modulo x.

Examples

Input

12 1 5 10
3 5 6 7 8 9 5 1 1 1 1 5

Output

3

Input

3 2 1 2
6 2 2

Output

0

Input

3 2 1 2
3 1 2

Output

6

Note

In the second sample possible integers are 22, 26, 62 and 66. None of them gives the remainder 1 modulo 2.

In the third sample integers 11, 13, 21, 23, 31 and 33 have remainder 1 modulo 2. There is exactly one way to obtain each of these integers, so the total answer is 6.

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
long long int mod;
long long int mod1 = 1e9 + 7;
long long int power(long long int a, long long int b) {
  if (b == 0) return 1;
  long long int ans = power(a, b / 2);
  ans = (ans * ans) % mod;
  if (b % 2) ans *= a;
  return ans % mod;
}
long long int mul(long long int a, long long int n, long long int mod) {
  long long int ret;
  if (n == 0) return 0;
  ret = mul(a, n / 2, mod);
  ret = (ret + ret) % mod;
  if (n % 2) ret = (ret + a) % mod;
  return ret;
}
vector<long long int> solve(vector<long long int> &base, int n, int x) {
  if (n == 1) return base;
  vector<long long int> c = solve(base, n / 2, x);
  vector<long long int> d(x, 0);
  for (int i = 0; i < x; i++) {
    for (int j = 0; j < x; j++)
      d[((i * power(10, n / 2)) % x + j) % x] =
          (d[((i * power(10, n / 2)) % x + j) % x] + (c[i] * c[j]) % mod1) %
          mod1;
  }
  if (n % 2) {
    vector<long long int> ans(x, 0);
    for (int i = 0; i < x; i++) {
      for (int j = 0; j < x; j++)
        ans[(i * 10 + j) % x] =
            (ans[(i * 10 + j) % x] + (d[i] * base[j]) % mod1) % mod1;
    }
    return ans;
  }
  return d;
}
int main() {
  ios_base::sync_with_stdio(false);
  cout.tie(NULL);
  cin.tie(NULL);
  int n, b, val, k, x;
  cin >> n >> b >> k >> x;
  mod = x;
  vector<long long int> base(x, 0);
  for (int i = 1; i <= n; i++) {
    cin >> val;
    base[val % x]++;
  }
  vector<long long int> ans = solve(base, b, x);
  cout << ans[k];
}

```


### Prompt

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

Please pay attention to the unusual memory limit in this problem.

In a parallel universe, Satan is called "Trygub". For that reason, the letters of his namesake were deleted from the alphabet in ancient times.

The government has n workers standing in a row and numbered with integers from 1 to n from left to right. Their job categories can be represented as a string s of length n, where the character s_i represents the job category of the i-th worker.

A new law will be approved to increase the equality between the workers. The government decided to make everyone have the same job category by performing the following operation any number of times (possibly zero).

There is a fixed rational parameter k=\frac ab describing how easy it is to convince the public, and it will be used to determine the success of an operation.

In an operation, the government first selects a job category x with at least one worker at the current moment. Suppose i_1,…, i_m (i_1<…<i_m) are the positions of all the workers with job category x. If k⋅ (i_m-i_1+1)≤ m, the government is able to choose any job category y with at least one worker at the current moment and change the job category of all workers with job category x to job category y.

If it is possible to make all workers have job category x, we say that x is obtainable. Can you tell the government the set of obtainable job categories?

Input

The first line contains three integers n, a, b (1 ≤ n ≤ 5000, 1≤ a≤ b≤ 10^5) — the number of workers and the numerator and denominator of the parameter k, respectively.

The second line contains a string s of length n, consisting of lowercase English characters — the job categories of each worker. The characters 't', 'r', 'y', 'g', 'u', and 'b' do not appear in the string s.

Output

Print an integer c equal to the number of obtainable job categories followed by c space-separated characters — the obtainable job categories sorted in the lexicographical order.

Example

Input

7 1 2
comicom

Output

3 c m o

Note

The first operation must select the job category 'i' because all other job categories cannot satisfy the condition, therefore 'i' is not obtainable.

Below is showed how to obtain 'c', 'm', and 'o'. The square brackets denote the segment containing all workers of the selected category, the red color denotes this category and the blue color denotes the new category after the change.

  * Get 'c':
    1. (com\color{red}{[i]}com → com\color{#1E90FF}{[o]}com)
    2. (c\color{red}{[o}m\color{red}{o}c\color{red}{o]}m → c\color{#1E90FF}{[m}m\color{#1E90FF}{m}c\color{#1E90FF}{m]}m)
    3. (c\color{red}{[mmm}c\color{red}{mm]} → c\color{#1E90FF}{[ccc}c\color{#1E90FF}{cc]})
  * Get 'm':
    1. (com\color{red}{[i]}com → com\color{#1E90FF}{[o]}com)
    2. (c\color{red}{[o}m\color{red}{o}c\color{red}{o]}m → c\color{#1E90FF}{[c}m\color{#1E90FF}{c}c\color{#1E90FF}{c]}m)
    3. (\color{red}{[cc}m\color{red}{ccc]}m → \color{#1E90FF}{[mm}m\color{#1E90FF}{mmm]}m)
  * Get 'o':
    1. (com\color{red}{[i]}com → com\color{#1E90FF}{[c]}com)
    2. (\color{red}{[c}om\color{red}{cc]}om → \color{#1E90FF}{[m}om\color{#1E90FF}{mm]}om)
    3. (\color{red}{[m}o\color{red}{mmm}o\color{red}{m]} → \color{#1E90FF}{[o}o\color{#1E90FF}{ooo}o\color{#1E90FF}{o]})

### Response

```cpp
#include <bits/stdc++.h>
#include <iostream>
using namespace std;
const int MAX_N = 1e5 + 5;
const int MAX_L = 20; // ~ Log N
const long long MOD = 1e9 + 7;
const long long INF = 1e9 + 7;
typedef long long ll;

void solve() {
	int n,a,b;
	string s;
	cin>>n>>a>>b;
	cin>>s;
	int p=0;
	vector <int> id(26,-1);
	vector <char> mp(26);
	for(int i=0;i<n;i++){
		int c = s[i] - 'a';
		if(id[c] == -1){
			mp[p] = s[i];
			id[c] = p++;
		}
	}
	vector <int> l(1 << p,n),r(1 << p,-1),cnt(1 << p);
	for(int i=0;i<n;i++){
		int c = s[i] - 'a';
		if(l[1 << id[c]] == n){
			l[1 << id[c]] = i;
		}
		r[1 << id[c]] = i;
		++cnt[1 << id[c]];
	}
	vector <bool> dp(1 << p);
	dp[0] = true;
	for(int m=0;m < (1 << p);m++){
		for(int i=0,m2=0;i<p;i++){
			if(m >> i & 1){
				m2 |= 1 << i;
				if(dp[m2] && dp[m ^ m2]){
					dp[m] = true;
				}
				l[m] = min(l[m^1 << i],l[1 << i]);
				r[m] = max(r[m^1 << i],r[1 << i]);
				cnt[m] = cnt[m ^ 1 << i] + cnt[1 << i];
			}
		}
		for(int i=0;i<p;i++){
			if((m >> i & 1) && dp[m^1 << i] && b * cnt[m] >= (r[m] - l[m] + 1) * a){
				dp[m] = true;
			}
		}
	}
	set <char> ans;
	for(int i=0;i<p;i++){
		if(dp[((1 << p) - 1) ^ (1 << i)]){
			ans.insert(mp[i]);
		}
	}
	cout<<ans.size();
	for(auto i : ans)
		cout<<" "<<i;
	cout<<"\n";
}
int main()
{
   ios_base::sync_with_stdio(false);cin.tie(NULL);

   #ifndef ONLINE_JUDGE
   freopen("input.txt", "r", stdin);
   freopen("error.txt", "w", stderr);
   freopen("output.txt", "w", stdout);
   #endif

   int t=1;
  //cin>>t;
   while(t--)
   {
      solve();
      cout<<"\n";
   }

   cerr<<"time taken : "<<(float)clock()/CLOCKS_PER_SEC<<" secs"<<endl;
   return 0;
}

```


### Prompt

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

It's hard times now. Today Petya needs to score 100 points on Informatics exam. The tasks seem easy to Petya, but he thinks he lacks time to finish them all, so he asks you to help with one..

There is a glob pattern in the statements (a string consisting of lowercase English letters, characters "?" and "*"). It is known that character "*" occurs no more than once in the pattern.

Also, n query strings are given, it is required to determine for each of them if the pattern matches it or not.

Everything seemed easy to Petya, but then he discovered that the special pattern characters differ from their usual meaning.

A pattern matches a string if it is possible to replace each character "?" with one good lowercase English letter, and the character "*" (if there is one) with any, including empty, string of bad lowercase English letters, so that the resulting string is the same as the given string.

The good letters are given to Petya. All the others are bad.

Input

The first line contains a string with length from 1 to 26 consisting of distinct lowercase English letters. These letters are good letters, all the others are bad.

The second line contains the pattern — a string s of lowercase English letters, characters "?" and "*" (1 ≤ |s| ≤ 105). It is guaranteed that character "*" occurs in s no more than once.

The third line contains integer n (1 ≤ n ≤ 105) — the number of query strings.

n lines follow, each of them contains single non-empty string consisting of lowercase English letters — a query string.

It is guaranteed that the total length of all query strings is not greater than 105.

Output

Print n lines: in the i-th of them print "YES" if the pattern matches the i-th query string, and "NO" otherwise.

You can choose the case (lower or upper) for each letter arbitrary.

Examples

Input

ab
a?a
2
aaa
aab

Output

YES
NO

Input

abc
a?a?a*
4
abacaba
abaca
apapa
aaaaax

Output

NO
YES
NO
YES

Note

In the first example we can replace "?" with good letters "a" and "b", so we can see that the answer for the first query is "YES", and the answer for the second query is "NO", because we can't match the third letter.

Explanation of the second example.

  * The first query: "NO", because character "*" can be replaced with a string of bad letters only, but the only way to match the query string is to replace it with the string "ba", in which both letters are good.
  * The second query: "YES", because characters "?" can be replaced with corresponding good letters, and character "*" can be replaced with empty string, and the strings will coincide.
  * The third query: "NO", because characters "?" can't be replaced with bad letters.
  * The fourth query: "YES", because characters "?" can be replaced with good letters "a", and character "*" can be replaced with a string of bad letters "x".

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
char str1[30];
char str2[100005];
char str3[100005];
bool flag[30];
bool f = false;
bool check(int l);
int main(void) {
  memset(flag, 0, sizeof(flag));
  scanf("%s", str1);
  scanf("%s", str2);
  for (int i = 0; i < strlen(str1); i++) flag[str1[i] - 'a']++;
  int n;
  scanf("%d", &n);
  int l = strlen(str2);
  for (int i = 0; i < l; i++)
    if (str2[i] == '*') f = true;
  while (n--) {
    scanf("%s", str3);
    if (check(l))
      printf("YES\n");
    else
      printf("NO\n");
  }
  return 0;
}
bool check(int l) {
  if (!f) {
    if (strlen(str3) != l) return false;
  } else {
    if (strlen(str3) < l - 1) return false;
  }
  int z = 0;
  int k = strlen(str3);
  int i;
  for (i = 0; i < l && z < k + 1;) {
    if (str2[i] == '*' && k - l >= 0) {
      while (!flag[str3[z] - 'a'] && z < k && l - i < k - z + 1) z++;
    }
    if (str2[i] == '*') i++;
    if (i >= l || z >= k + 1) break;
    if (str2[i] == '?') {
      if (!flag[str3[z] - 'a'])
        return false;
      else {
        i++, z++;
      }
    } else {
      if (str2[i] != str3[z]) {
        return false;
      } else
        i++, z++;
    }
  }
  if (f && (i < l || z < k)) {
    return false;
  }
  return true;
}

```