### Prompt

Please formulate a Cpp solution to the following problem:

Ivan places knights on infinite chessboard. Initially there are n knights. If there is free cell which is under attack of at least 4 knights then he places new knight in this cell. Ivan repeats this until there are no such free cells. One can prove that this process is finite. One can also prove that position in the end does not depend on the order in which new knights are placed.

Ivan asked you to find initial placement of exactly n knights such that in the end there will be at least ⌊ \frac{n^{2}}{10} ⌋ knights.

Input

The only line of input contains one integer n (1 ≤ n ≤ 10^{3}) — number of knights in the initial placement.

Output

Print n lines. Each line should contain 2 numbers x_{i} and y_{i} (-10^{9} ≤ x_{i},    y_{i} ≤ 10^{9}) — coordinates of i-th knight. For all i ≠ j, (x_{i},    y_{i}) ≠ (x_{j},    y_{j}) should hold. In other words, all knights should be in different cells.

It is guaranteed that the solution exists.

Examples

Input

4

Output

1 1
3 1
1 5
4 4

Input

7

Output

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

Note

Let's look at second example:

<image>

Green zeroes are initial knights. Cell (3,    3) is under attack of 4 knights in cells (1,    2), (2,    1), (4,    1) and (5,    2), therefore Ivan will place a knight in this cell. Cell (4,    5) is initially attacked by only 3 knights in cells (2,    6), (5,    7) and (6,    6). But new knight in cell (3,    3) also attacks cell (4,    5), now it is attacked by 4 knights and Ivan will place another knight in this cell. There are no more free cells which are attacked by 4 or more knights, so the process stops. There are 9 knights in the end, which is not less than ⌊ \frac{7^{2}}{10} ⌋ = 4.

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
template <typename T>
inline bool ckmin(T &a, const T &b) {
  return b < a ? a = b, 1 : 0;
}
template <typename T>
inline bool ckmax(T &a, const T &b) {
  return a < b ? a = b, 1 : 0;
}
const int inf = 1e9;
map<pair<int, int>, int> vis, used, str;
set<pair<int, int> > crd;
int n;
int dx[] = {1, 2, 2, 1, -1, -2, -2, -1}, dy[] = {-2, -1, 1, 2, 2, 1, -1, -2};
int check(vector<pair<int, int> > cd) {
  used.clear(), str.clear();
  for (int i = (0), _x = ((int)(cd).size() - 1); i <= _x; i++) str[cd[i]] = 1;
  vis.clear(), crd.clear();
  for (int i = (0), _x = ((int)(cd).size() - 1); i <= _x; i++)
    vis[cd[i]] = 4, crd.insert(cd[i]);
  int ans = 0;
  int mnx = inf, mxx = -inf, mxy = -inf, mny = inf;
  while (!crd.empty()) {
    pair<int, int> u = *crd.begin();
    used[u] = 1;
    ckmin(mnx, u.first), ckmin(mny, u.second), ckmax(mxx, u.first),
        ckmax(mxy, u.second);
    ans++;
    vis[u] = -inf;
    crd.erase(crd.begin());
    for (int i = 0; i < 8; i++) {
      pair<int, int> v = u;
      v.first += dx[i], v.second += dy[i];
      vis[v]++;
      if (vis[v] >= 4) crd.insert(v);
    }
  }
  return ans;
}
vector<pair<int, int> > corn(int n) {
  vector<pair<int, int> > id;
  for (int i = (1), _x = (n / 2); i <= _x; i++) id.push_back(make_pair(i, 0));
  n -= n / 2;
  for (int i = (1), _x = (n); i <= _x; i++) id.push_back(make_pair(i, 1));
  return id;
}
vector<pair<int, int> > test(int h) {
  vector<pair<int, int> > id;
  id.clear();
  int m = h / 2;
  for (int i = (1), _x = (m); i <= _x; i++) id.push_back(make_pair(i, 0));
  for (int i = (1), _x = (h - m); i <= _x; i++) id.push_back(make_pair(i, 1));
  int k = n - h, mdr = (m + 1) / 2, mdl = (h - m + 1) / 2;
  int R = m / 4 - (m % 4 == 0), L = (h - m) / 4 - ((h - m) % 4 == 0);
  if (k / 2 > 1) {
    for (int i = (-R - k / 2), _x = (-R - 1); i <= _x; i++)
      id.push_back(make_pair(mdr, i));
    k -= k / 2;
  }
  for (int i = (L + 2), _x = (L + k + 1); i <= _x; i++)
    id.push_back(make_pair(mdl, i));
  return id;
}
void quit(vector<pair<int, int> > id) {
  assert((int)(id).size() == n);
  assert(check(id) >= n * n / 10);
  for (int i = (0), _x = ((int)(id).size() - 1); i <= _x; i++)
    printf("%d %d\n", id[i].first, id[i].second);
  exit(0);
}
int main() {
  scanf("%d", &n);
  vector<pair<int, int> > id;
  if (n <= 14) quit(corn(n));
  if (n <= 50) {
    int mx = 0;
    vector<pair<int, int> > id;
    for (int i = (1), _x = (n); i <= _x; i++) {
      vector<pair<int, int> > tmp = test(i);
      int t = check(tmp);
      if (t > mx) mx = t, id = tmp;
    }
    quit(id);
  }
  int m = n * 4 / 5;
  quit(test(m));
  return 0;
}

```


### Prompt

Create a solution in CPP for the following problem:

Fox Ciel is going to publish a paper on FOCS (Foxes Operated Computer Systems, pronounce: "Fox"). She heard a rumor: the authors list on the paper is always sorted in the lexicographical order.

After checking some examples, she found out that sometimes it wasn't true. On some papers authors' names weren't sorted in lexicographical order in normal sense. But it was always true that after some modification of the order of letters in alphabet, the order of authors becomes lexicographical!

She wants to know, if there exists an order of letters in Latin alphabet such that the names on the paper she is submitting are following in the lexicographical order. If so, you should find out any such order.

Lexicographical order is defined in following way. When we compare s and t, first we find the leftmost position with differing characters: si ≠ ti. If there is no such position (i. e. s is a prefix of t or vice versa) the shortest string is less. Otherwise, we compare characters si and ti according to their order in alphabet.

Input

The first line contains an integer n (1 ≤ n ≤ 100): number of names.

Each of the following n lines contain one string namei (1 ≤ |namei| ≤ 100), the i-th name. Each name contains only lowercase Latin letters. All names are different.

Output

If there exists such order of letters that the given names are sorted lexicographically, output any such order as a permutation of characters 'a'–'z' (i. e. first output the first letter of the modified alphabet, then the second, and so on).

Otherwise output a single word "Impossible" (without quotes).

Examples

Input

3
rivest
shamir
adleman

Output

bcdefghijklmnopqrsatuvwxyz

Input

10
tourist
petr
wjmzbmr
yeputons
vepifanov
scottwu
oooooooooooooooo
subscriber
rowdark
tankengineer

Output

Impossible

Input

10
petr
egor
endagorion
feferivan
ilovetanyaromanova
kostka
dmitriyh
maratsnowbear
bredorjaguarturnik
cgyforever

Output

aghjlnopefikdmbcqrstuvwxyz

Input

7
car
care
careful
carefully
becarefuldontforgetsomething
otherwiseyouwillbehacked
goodluck

Output

acbdefhijklmnogpqrstuvwxyz

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
vector<int> top;
bool b = 1;
vector<int> G[26];
vector<int> vis(26, 0);
void dfs(int i) {
  vis[i] = 1;
  for (int u : G[i]) {
    if (vis[u] == 1) {
      b = 0;
      return;
    } else if (vis[u] == 0) {
      dfs(u);
    }
  }
  vis[i] = 2;
  top.push_back(i);
}
int main() {
  int n;
  string s1, s2;
  cin >> n;
  cin >> s1;
  for (int i = 1; i < n; i++) {
    cin >> s2;
    int j = 0;
    while (j < (int)min(s1.size(), s2.size()) && s1[j] == s2[j]) j++;
    if (j == (int)min(s1.size(), s2.size())) {
      if (s1.size() > s2.size()) b = 0;
      swap(s1, s2);
      continue;
    }
    G[s1[j] - 'a'].push_back(s2[j] - 'a');
    swap(s1, s2);
  }
  if (!b) {
    cout << "Impossible\n";
    return 0;
  }
  for (int i = 0; i < 26; i++) {
    if (vis[i]) continue;
    dfs(i);
    if (!b) {
      cout << "Impossible\n";
      return 0;
    }
  }
  reverse(top.begin(), top.end());
  for (int u : top) {
    char ch = 'a' + u;
    cout << ch;
  }
  cout << '\n';
  return 0;
}

```


### Prompt

Generate a CPP solution to the following problem:

There are n students in a school class, the rating of the i-th student on Codehorses is a_i. You have to form a team consisting of k students (1 ≤ k ≤ n) such that the ratings of all team members are distinct.

If it is impossible to form a suitable team, print "NO" (without quotes). Otherwise print "YES", and then print k distinct numbers which should be the indices of students in the team you form. If there are multiple answers, print any of them.

Input

The first line contains two integers n and k (1 ≤ k ≤ n ≤ 100) — the number of students and the size of the team you have to form.

The second line contains n integers a_1, a_2, ..., a_n (1 ≤ a_i ≤ 100), where a_i is the rating of i-th student.

Output

If it is impossible to form a suitable team, print "NO" (without quotes). Otherwise print "YES", and then print k distinct integers from 1 to n which should be the indices of students in the team you form. All the ratings of the students in the team should be distinct. You may print the indices in any order. If there are multiple answers, print any of them.

Assume that the students are numbered from 1 to n.

Examples

Input

5 3
15 13 15 15 12

Output

YES
1 2 5

Input

5 4
15 13 15 15 12

Output

NO

Input

4 4
20 10 40 30

Output

YES
1 2 3 4

Note

All possible answers for the first example:

  * {1 2 5}
  * {2 3 5}
  * {2 4 5}

Note that the order does not matter.

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  int b[101] = {0};
  int d[101] = {0};
  cin >> n >> k;
  int c[n + 1];
  int aa[k];
  int hey = 0;
  for (int i = 1; i <= n; i++) {
    cin >> c[i];
    b[c[i]]++;
    d[c[i]] = i;
  }
  int count = 0;
  for (int i = 1; i <= 100; i++) {
    if (b[i] > 0) count++;
  }
  if (count >= k) {
    cout << "YES" << endl;
    for (int i = 1; i <= 100; i++) {
      if (b[i] > 0) {
        aa[hey] = d[i];
        hey++;
      }
    }
    sort(aa, aa + k);
    for (int i = 0; i < k; i++) cout << aa[i] << " ";
    cout << endl;
  } else
    cout << "NO" << endl;
  return 0;
}

```


### Prompt

Please formulate a Cpp solution to the following problem:

Limak is going to participate in a contest on the last day of the 2016. The contest will start at 20:00 and will last four hours, exactly until midnight. There will be n problems, sorted by difficulty, i.e. problem 1 is the easiest and problem n is the hardest. Limak knows it will take him 5·i minutes to solve the i-th problem.

Limak's friends organize a New Year's Eve party and Limak wants to be there at midnight or earlier. He needs k minutes to get there from his house, where he will participate in the contest first.

How many problems can Limak solve if he wants to make it to the party?

Input

The only line of the input contains two integers n and k (1 ≤ n ≤ 10, 1 ≤ k ≤ 240) — the number of the problems in the contest and the number of minutes Limak needs to get to the party from his house.

Output

Print one integer, denoting the maximum possible number of problems Limak can solve so that he could get to the party at midnight or earlier.

Examples

Input

3 222

Output

2

Input

4 190

Output

4

Input

7 1

Output

7

Note

In the first sample, there are 3 problems and Limak needs 222 minutes to get to the party. The three problems require 5, 10 and 15 minutes respectively. Limak can spend 5 + 10 = 15 minutes to solve first two problems. Then, at 20:15 he can leave his house to get to the party at 23:57 (after 222 minutes). In this scenario Limak would solve 2 problems. He doesn't have enough time to solve 3 problems so the answer is 2.

In the second sample, Limak can solve all 4 problems in 5 + 10 + 15 + 20 = 50 minutes. At 20:50 he will leave the house and go to the party. He will get there exactly at midnight.

In the third sample, Limak needs only 1 minute to get to the party. He has enough time to solve all 7 problems.

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
int main() {
  int i;
  int n, k;
  cin >> n >> k;
  int minutes = 4 * 60 - k;
  for (i = 1; i <= n; i++) {
    int solve = i * 5;
    if (minutes >= solve) {
      minutes -= solve;
    } else
      break;
  }
  cout << i - 1 << endl;
  return 0;
}

```


### Prompt

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

Consider a sequence of digits of length 2^k [a_1, a_2, …, a_{2^k}]. We perform the following operation with it: replace pairs (a_{2i+1}, a_{2i+2}) with (a_{2i+1} + a_{2i+2})mod 10 for 0≤ i<2^{k-1}. For every i where a_{2i+1} + a_{2i+2}≥ 10 we get a candy! As a result, we will get a sequence of length 2^{k-1}.

Less formally, we partition sequence of length 2^k into 2^{k-1} pairs, each consisting of 2 numbers: the first pair consists of the first and second numbers, the second of the third and fourth …, the last pair consists of the (2^k-1)-th and (2^k)-th numbers. For every pair such that sum of numbers in it is at least 10, we get a candy. After that, we replace every pair of numbers with a remainder of the division of their sum by 10 (and don't change the order of the numbers).

Perform this operation with a resulting array until it becomes of length 1. Let f([a_1, a_2, …, a_{2^k}]) denote the number of candies we get in this process.

For example: if the starting sequence is [8, 7, 3, 1, 7, 0, 9, 4] then:

After the first operation the sequence becomes [(8 + 7)mod 10, (3 + 1)mod 10, (7 + 0)mod 10, (9 + 4)mod 10] = [5, 4, 7, 3], and we get 2 candies as 8 + 7 ≥ 10 and 9 + 4 ≥ 10.

After the second operation the sequence becomes [(5 + 4)mod 10, (7 + 3)mod 10] = [9, 0], and we get one more candy as 7 + 3 ≥ 10.

After the final operation sequence becomes [(9 + 0) mod 10] = [9].

Therefore, f([8, 7, 3, 1, 7, 0, 9, 4]) = 3 as we got 3 candies in total.

You are given a sequence of digits of length n s_1, s_2, … s_n. You have to answer q queries of the form (l_i, r_i), where for i-th query you have to output f([s_{l_i}, s_{l_i+1}, …, s_{r_i}]). It is guaranteed that r_i-l_i+1 is of form 2^k for some nonnegative integer k.

Input

The first line contains a single integer n (1 ≤ n ≤ 10^5) — the length of the sequence.

The second line contains n digits s_1, s_2, …, s_n (0 ≤ s_i ≤ 9).

The third line contains a single integer q (1 ≤ q ≤ 10^5) — the number of queries.

Each of the next q lines contains two integers l_i, r_i (1 ≤ l_i ≤ r_i ≤ n) — i-th query. It is guaranteed that r_i-l_i+1 is a nonnegative integer power of 2.

Output

Output q lines, in i-th line output single integer — f([s_{l_i}, s_{l_i + 1}, …, s_{r_i}]), answer to the i-th query.

Examples

Input

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

Output

3
1
0

Input

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

Output

0
0
1

Note

The first example illustrates an example from the statement.

f([7, 3, 1, 7]) = 1: sequence of operations is [7, 3, 1, 7] → [(7 + 3)mod 10, (1 + 7)mod 10] = [0, 8] and one candy as 7 + 3 ≥ 10 → [(0 + 8) mod 10] = [8], so we get only 1 candy.

f([9]) = 0 as we don't perform operations with it.

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 314;
const int INF = 1e9;
const double PI = acos(-1);
const int MOD = 1e9 + 7;
const double eps = 1e-9;
int d[N], sum[N];
void solve() {
  int n;
  cin >> n;
  for (int i = 0; i < n; ++i) {
    cin >> d[i];
  }
  sum[0] = d[0];
  for (int i = 1; i < n; ++i) {
    sum[i] = sum[i - 1] + d[i];
  }
  int q;
  cin >> q;
  while (q--) {
    int l, r;
    cin >> l >> r;
    l--, r--;
    cout << (sum[r] - sum[l] + d[l]) / 10 << "\n";
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int t = 1;
  while (t--) solve();
}

```


### Prompt

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

This is the hard version of the problem. You can find the easy version in the Div. 2 contest. Both versions only differ in the number of times you can ask your friend to taste coffee.

This is an interactive problem.

You're considering moving to another city, where one of your friends already lives. There are n cafés in this city, where n is a power of two. The i-th café produces a single variety of coffee a_i.

As you're a coffee-lover, before deciding to move or not, you want to know the number d of distinct varieties of coffees produced in this city.

You don't know the values a_1, …, a_n. Fortunately, your friend has a memory of size k, where k is a power of two.

Once per day, you can ask him to taste a cup of coffee produced by the café c, and he will tell you if he tasted a similar coffee during the last k days.

You can also ask him to take a medication that will reset his memory. He will forget all previous cups of coffee tasted. You can reset his memory at most 30\ 000 times.

More formally, the memory of your friend is a queue S. Doing a query on café c will:

  * Tell you if a_c is in S;
  * Add a_c at the back of S;
  * If |S| > k, pop the front element of S.

Doing a reset request will pop all elements out of S.

Your friend can taste at most (3n^2)/(2k) cups of coffee in total. Find the diversity d (number of distinct values in the array a).

Note that asking your friend to reset his memory does not count towards the number of times you ask your friend to taste a cup of coffee.

In some test cases the behavior of the interactor is adaptive. It means that the array a may be not fixed before the start of the interaction and may depend on your queries. It is guaranteed that at any moment of the interaction, there is at least one array a consistent with all the answers given so far.

Input

The first line contains two integers n and k (1 ≤ k ≤ n ≤ 1024, k and n are powers of two).

It is guaranteed that (3n^2)/(2k) ≤ 15\ 000.

Interaction

You begin the interaction by reading n and k.

  * To ask your friend to taste a cup of coffee produced by the café c, in a separate line output

? c

Where c must satisfy 1 ≤ c ≤ n. Don't forget to flush, to get the answer.

In response, you will receive a single letter Y (yes) or N (no), telling you if variety a_c is one of the last k varieties of coffee in his memory.

  * To reset the memory of your friend, in a separate line output the single letter R in upper case. You can do this operation at most 30\ 000 times.
  * When you determine the number d of different coffee varieties, output

! d

In case your query is invalid, you asked more than (3n^2)/(2k) queries of type ? or you asked more than 30\ 000 queries of type R, the program will print the letter E and will finish interaction. You will receive a Wrong Answer verdict. Make sure to exit immediately to avoid getting other verdicts.

After printing a query 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

The first line should contain the word fixed

The second line should contain two integers n and k, separated by space (1 ≤ k ≤ n ≤ 1024, k and n are powers of two).

It must hold that (3n^2)/(2k) ≤ 15\ 000.

The third line should contain n integers a_1, a_2, …, a_n, separated by spaces (1 ≤ a_i ≤ n).

Examples

Input

4 2
N
N
Y
N
N
N
N

Output

? 1
? 2
? 3
? 4
R
? 4
? 1
? 2
! 3

Input

8 8
N
N
N
N
Y
Y

Output

? 2
? 6
? 4
? 5
? 2
? 5
! 6

Note

In the first example, the array is a = [1, 4, 1, 3]. The city produces 3 different varieties of coffee (1, 3 and 4).

The successive varieties of coffee tasted by your friend are 1, 4, 1, 3, 3, 1, 4 (bold answers correspond to Y answers). Note that between the two ? 4 asks, there is a reset memory request R, so the answer to the second ? 4 ask is N. Had there been no reset memory request, the answer to the second ? 4 ask is Y.

In the second example, the array is a = [1, 2, 3, 4, 5, 6, 6, 6]. The city produces 6 different varieties of coffee.

The successive varieties of coffee tasted by your friend are 2, 6, 4, 5, 2, 5.

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
const int maxn = 30006;
int n, k;
int good[maxn];
void reset() { cout << "R" << endl; }
bool query(int x) {
  cout << "? " << x + 1 << endl;
  cout.flush();
  string s;
  cin >> s;
  if (s[0] == 'Y') return true;
  return false;
}
int main() {
  cin >> n >> k;
  fill(good, good + n, 1);
  if (k <= 2) {
    for (int d = 1; d < n; ++d) {
      for (int start = 0; start < d; ++start) {
        if (start + d >= n) continue;
        for (int i = 0; start + d * i < n; ++i) {
          if (query(start + d * i)) good[start + d * i] = 0;
        }
        reset();
      }
    }
  } else {
    int nElem = k / 2;
    int nBlock = 2 * n / k;
    for (int d = 1; d < nBlock; ++d) {
      for (int start = 0; start < d; ++start) {
        if (start + d >= nBlock) continue;
        for (int i = 0; start + d * i < nBlock; ++i) {
          int cur = start + d * i;
          for (int index = cur * nElem; index < (cur + 1) * nElem; ++index) {
            if (query(index)) good[index] = 0;
          }
        }
        reset();
      }
    }
  }
  int ans = 0;
  for (int i = 0; i < n; ++i)
    if (good[i]) ++ans;
  cout << "! " << ans << endl;
  return 0;
}

```


### Prompt

Generate a CPP solution to the following problem:

Bob is an active user of the social network Faithbug. On this network, people are able to engage in a mutual friendship. That is, if a is a friend of b, then b is also a friend of a. Each user thus has a non-negative amount of friends.

This morning, somebody anonymously sent Bob the following link: [graph realization problem](https://en.wikipedia.org/wiki/Graph_realization_problem) and Bob wants to know who that was. In order to do that, he first needs to know how the social network looks like. He investigated the profile of every other person on the network and noted down the number of his friends. However, he neglected to note down the number of his friends. Help him find out how many friends he has. Since there may be many possible answers, print all of them.

Input

The first line contains one integer n (1 ≤ n ≤ 5 ⋅ 10^5), the number of people on the network excluding Bob.

The second line contains n numbers a_1,a_2, ..., a_n (0 ≤ a_i ≤ n), with a_i being the number of people that person i is a friend of.

Output

Print all possible values of a_{n+1} — the amount of people that Bob can be friend of, in increasing order.

If no solution exists, output -1.

Examples

Input

3
3 3 3

Output

3

Input

4
1 1 1 1

Output

0 2 4

Input

2
0 2

Output

-1

Input

35
21 26 18 4 28 2 15 13 16 25 6 32 11 5 31 17 9 3 24 33 14 27 29 1 20 4 12 7 10 30 34 8 19 23 22

Output

13 15 17 19 21

Note

In the first test case, the only solution is that everyone is friends with everyone. That is why Bob should have 3 friends.

In the second test case, there are three possible solutions (apart from symmetries):

  * a is friend of b, c is friend of d, and Bob has no friends, or
  * a is a friend of b and both c and d are friends with Bob, or
  * Bob is friends of everyone.

The third case is impossible to solve, as the second person needs to be a friend with everybody, but the first one is a complete stranger.

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
const int Maxn = 2100000;
int n, d[Maxn], bj[Maxn], ans[Maxn], num;
long long pre[Maxn];
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) scanf("%d", &d[i]);
  sort(d, d + n);
  for (int i = 1; i <= n; i++) pre[i] = pre[i - 1] + d[i - 1];
  int j = 0;
  for (int k = 1; k <= n; k++) {
    long long l = pre[n] - pre[n - k], r = (long long)k * (k - 1);
    while (j < n && d[j] < k) j++;
    r += pre[min(j, n - k)] + 1ll * max(0, n - k - j) * k;
    long long now = d[n - k], diff = l - r;
    if (diff <= k && diff <= now) {
      bj[max(diff, 0ll)]++;
      bj[now + 1]--;
    }
    l -= d[n - k], r += min(d[n - k], k);
    diff = r - l;
    if (diff >= now + 1) {
      bj[now + 1]++;
      bj[min(diff + 1, (long long)n + 1)]--;
    }
  }
  j = 0;
  for (int i = 0; i <= n; i++) {
    j += bj[i];
    if (j == n && (pre[n] + i & 1) == 0) ans[++num] = i;
  }
  if (num == 0)
    puts("-1");
  else
    for (int i = 1; i <= num; i++) printf("%d ", ans[i]);
  return 0;
}

```


### Prompt

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

Princess Twilight went to Celestia and Luna's old castle to research the chest from the Elements of Harmony.

<image>

A sequence of positive integers bi is harmony if and only if for every two elements of the sequence their greatest common divisor equals 1. According to an ancient book, the key of the chest is a harmony sequence bi which minimizes the following expression:

<image>

You are given sequence ai, help Princess Twilight to find the key.

Input

The first line contains an integer n (1 ≤ n ≤ 100) — the number of elements of the sequences a and b. The next line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 30).

Output

Output the key — sequence bi that minimizes the sum described above. If there are multiple optimal sequences, you can output any of them.

Examples

Input

5
1 1 1 1 1

Output

1 1 1 1 1

Input

5
1 6 4 2 8

Output

1 5 3 1 8

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
template <class T, class T2>
inline void chkmax(T &x, const T2 &y) {
  if (x < y) x = y;
}
template <class T, class T2>
inline void chkmin(T &x, const T2 &y) {
  if (x > y) x = y;
}
const int MAXN = (117);
const int MAXV = 70;
vector<int> pr = {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53};
int n, a[MAXN];
void read() {
  cin >> n;
  for (int i = 0; i < n; i++) cin >> a[i];
}
int msk[MAXN];
int dp[MAXN][1 << 16];
int rec(int pos, int mask) {
  if (pos == n) return 0;
  int &memo = dp[pos][mask];
  if (memo != -1) return memo;
  memo = (int)1e9 + 42;
  for (int v = 1; v <= MAXV; v++)
    if ((mask & msk[v]) == 0)
      chkmin(memo, abs(a[pos] - v) + rec(pos + 1, mask | msk[v]));
  return memo;
}
void solve() {
  memset(dp, -1, sizeof(dp));
  for (int i = 1; i <= MAXV; i++)
    for (int j = 0; j < 16; j++)
      if (i % pr[j] == 0) msk[i] |= (1 << j);
  int mask = 0;
  for (int i = 0; i < n; i++) {
    for (int v = 1; v <= MAXV; v++)
      if (((mask & msk[v]) == 0) &&
          rec(i, mask) == abs(a[i] - v) + rec(i + 1, mask | msk[v])) {
        mask |= msk[v];
        cout << v << " ";
        break;
      }
  }
  cout << '\n';
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  read();
  solve();
  return 0;
}

```


### Prompt

Generate a cpp solution to the following problem:

Permutation p is an ordered set of integers p1, p2, ..., pn, consisting of n distinct positive integers not larger than n. We'll denote as n the length of permutation p1, p2, ..., pn.

Your task is to find such permutation p of length n, that the group of numbers |p1 - p2|, |p2 - p3|, ..., |pn - 1 - pn| has exactly k distinct elements.

Input

The single line of the input contains two space-separated positive integers n, k (1 ≤ k < n ≤ 105).

Output

Print n integers forming the permutation. If there are multiple answers, print any of them.

Examples

Input

3 2

Output

1 3 2

Input

3 1

Output

1 2 3

Input

5 2

Output

1 3 2 4 5

Note

By |x| we denote the absolute value of number x.

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
int mas[100500];
int main() {
  int n, k, p = 1, t;
  bool cur = false;
  char q;
  string s = "", s1;
  cin >> n >> k;
  mas[1] = 1;
  for (int i = 2; i <= n; i++) {
    if (p < k) {
      if (!cur)
        mas[i] = n - mas[i - 1] + 1;
      else
        mas[i] = mas[i - 2] + 1;
      if (!cur)
        cur = true;
      else
        cur = false;
      p++;
    } else {
      if (!cur) {
        mas[i] = mas[i - 1] + 1;
      } else {
        mas[i] = mas[i - 1] - 1;
      }
    }
  }
  for (int i = 1; i <= n; i++) {
    s1 = "";
    while (mas[i] > 0) {
      q = mas[i] % 10 + '0';
      mas[i] /= 10;
      s1 = q + s1;
    }
    s += s1 + ' ';
  }
  cout << s;
  return 0;
}

```


### Prompt

Please formulate a cpp solution to the following problem:

Recently, Tokitsukaze found an interesting game. Tokitsukaze had n items at the beginning of this game. However, she thought there were too many items, so now she wants to discard m (1 ≤ m ≤ n) special items of them.

These n items are marked with indices from 1 to n. In the beginning, the item with index i is placed on the i-th position. Items are divided into several pages orderly, such that each page contains exactly k positions and the last positions on the last page may be left empty.

Tokitsukaze would do the following operation: focus on the first special page that contains at least one special item, and at one time, Tokitsukaze would discard all special items on this page. After an item is discarded or moved, its old position would be empty, and then the item below it, if exists, would move up to this empty position. The movement may bring many items forward and even into previous pages, so Tokitsukaze would keep waiting until all the items stop moving, and then do the operation (i.e. check the special page and discard the special items) repeatedly until there is no item need to be discarded.

<image> Consider the first example from the statement: n=10, m=4, k=5, p=[3, 5, 7, 10]. The are two pages. Initially, the first page is special (since it is the first page containing a special item). So Tokitsukaze discards the special items with indices 3 and 5. After, the first page remains to be special. It contains [1, 2, 4, 6, 7], Tokitsukaze discards the special item with index 7. After, the second page is special (since it is the first page containing a special item). It contains [9, 10], Tokitsukaze discards the special item with index 10.

Tokitsukaze wants to know the number of operations she would do in total.

Input

The first line contains three integers n, m and k (1 ≤ n ≤ 10^{18}, 1 ≤ m ≤ 10^5, 1 ≤ m, k ≤ n) — the number of items, the number of special items to be discarded and the number of positions in each page.

The second line contains m distinct integers p_1, p_2, …, p_m (1 ≤ p_1 < p_2 < … < p_m ≤ n) — the indices of special items which should be discarded.

Output

Print a single integer — the number of operations that Tokitsukaze would do in total.

Examples

Input

10 4 5
3 5 7 10

Output

3

Input

13 4 5
7 8 9 10

Output

1

Note

For the first example:

  * In the first operation, Tokitsukaze would focus on the first page [1, 2, 3, 4, 5] and discard items with indices 3 and 5;
  * In the second operation, Tokitsukaze would focus on the first page [1, 2, 4, 6, 7] and discard item with index 7;
  * In the third operation, Tokitsukaze would focus on the second page [9, 10] and discard item with index 10.

For the second example, Tokitsukaze would focus on the second page [6, 7, 8, 9, 10] and discard all special items at once.

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3f;
const int MOD = 1e9 + 7;
template <typename S, typename T>
inline bool Min(S &a, const T &b) {
  return a > b ? a = b, true : false;
}
template <typename S, typename T>
inline bool Max(S &a, const T &b) {
  return a < b ? a = b, true : false;
}
template <typename S, typename T>
inline void Adm(S &a, const T &b) {
  a = (a + b) % MOD;
  if (a < 0) a += MOD;
}
template <typename S, typename T>
inline void Mum(S &a, const T &b) {
  a = 1LL * a * b % MOD;
}
inline long long Mum(initializer_list<long long> ls) {
  long long a = 1;
  for (long long b : ls) a = a * b % MOD;
  return a;
}
const int N = 1e5 + 100;
long long a[N];
int main() {
  long long n, m, k;
  cin >> n >> m >> k;
  for (int i = 1; i <= m; ++i) scanf("%lld", &a[i]);
  int p = 1, ans = 0;
  long long q = k;
  while (p <= m) {
    int cnt = 0;
    while (p <= m && a[p] <= q) ++p, ++cnt;
    if (cnt)
      q += cnt, ++ans;
    else
      q += (a[p] - q + k - 1) / k * k;
  }
  cout << ans << endl;
  return 0;
}

```


### Prompt

Create a solution in cpp for the following problem:

A convex polygon consisting of N vertices is given. The coordinates of each vertex are represented counterclockwise by (X1, Y1), (X2, Y2), ……, (XN, YN). No matter what straight line passes through the point P, find the coordinates of the point P so that the areas of the two convex polygons obtained after cutting are equal.

Constraints

* All inputs are integers

* 3 ≤ N ≤ 50

* 0 ≤ | Xi |, | Yi | ≤ 1000000

* The input polygon is a simple convex polygon.

* The output must satisfy max (| X-cX |, | Y-cY |) ≤ 0.0001 when the output coordinates are (X, Y) and the exact solution is (cX, cY).

Input

The input is given in the following format.

> N
> X1 Y1
> X2 Y2
> ……
> XN YN
>

Output

If there is a point that satisfies the condition of the problem statement, the coordinates of that point

> X Y
>

Output in the format of. If the point does not exist, output "NA" on one line.

Examples

Input

4
100 100
0 100
0 0
100 0

Output

50.00000 50.00000

Input

3
100 100
0 100
0 0

Output

NA

### Response

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

using namespace std;

typedef pair<double,double> P;

int main(){
    int n;cin>>n;
    vector<P> v(n);
    for(int i=0;i<n;i++){
        double x,y;cin>>x>>y;
        v[i]=P(x,y);
    }
    double cx,cy,ma=-1;
    for(int i=0;i<n;i++){
        for(int j=i;j<n;j++){
            double x1=v[i].first,y1=v[i].second,x2=v[j].first,y2=v[j].second;
            double tmp=(x2-x1)*(x2-x1)+(y2-y1)*(y2-y1);
            if(tmp>ma){
                ma=tmp;
                cx=(x1+x2)/2;cy=(y1+y2)/2;
            }
        }
    }
    bool flag=true;
    for(int i=0;i<n;i++){
        double x1=v[i].first,y1=v[i].second;
        bool ftmp=false;
        for(int j=0;j<n;j++){
            double x2=v[j].first,y2=v[j].second;
            if(cx==(x1+x2)/2 && cy==(y1+y2)/2) ftmp=true;
        }
        flag&=ftmp;
    }
    if(flag)cout<<fixed<<setprecision(10)<<cx<<" "<<cy<<endl;
    else cout<<"NA"<<endl;
}
```


### Prompt

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

12:17 (UTC): The sample input 1 and 2 were swapped. The error is now fixed. We are very sorry for your inconvenience.

There are N children in AtCoder Kindergarten, conveniently numbered 1 through N. Mr. Evi will distribute C indistinguishable candies to the children.

If child i is given a candies, the child's happiness will become x_i^a, where x_i is the child's excitement level. The activity level of the kindergarten is the product of the happiness of all the N children.

For each possible way to distribute C candies to the children by giving zero or more candies to each child, calculate the activity level of the kindergarten. Then, calculate the sum over all possible way to distribute C candies. This sum can be seen as a function of the children's excitement levels x_1,..,x_N, thus we call it f(x_1,..,x_N).

You are given integers A_i,B_i (1≦i≦N). Find <image> modulo 10^9+7.

Constraints

* 1≦N≦400
* 1≦C≦400
* 1≦A_i≦B_i≦400 (1≦i≦N)

Input

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

N C
A_1 A_2 ... A_N
B_1 B_2 ... B_N

Output

Print the value of <image> modulo 10^9+7.

Examples

Input

2 3
1 1
1 1

Output

4

Input

1 2
1
3

Output

14

Input

2 3
1 1
2 2

Output

66

Input

4 8
3 1 4 1
3 1 4 1

Output

421749

Input

3 100
7 6 5
9 9 9

Output

139123417

### Response

```cpp
#include <iostream>
#include <cstdio>
#include <cstring>

using namespace std;

const int mod = 1e9 + 7;
int f[405][405], a[405][405], l[405], r[405], n, c, b[405][405], ans;

inline int read()
{
	char ch; int res;
	while (ch = getchar(), ch < '0' || ch > '9');
	res = ch - 48;
	while (ch = getchar(), ch >= '0' && ch <= '9')
	res = res * 10 + ch - 48;
	return res;
}

int main()
{
//	freopen("candy.in", "r", stdin);
//	freopen("candy.out", "w", stdout);
	int i, j, k;
	n = read(); c = read();
	for (i = 1; i <= n; i++) l[i] = read();
	for (i = 1; i <= n; i++) r[i] = read();
	for (i = 1; i <= n; i++)
	for (int x = l[i]; x <= r[i]; x++)
	{
		int y = 1;
		for (j = 0; j <= c; j++)
		{
			a[i][j] = (a[i][j] + y) % mod;
			y = 1ll * y * x % mod;
		}
	}
	f[0][0] = 1;
	for (i = 1; i <= n; i++)
	for (j = 0; j <= c; j++)
	for (k = 0; k <= j; k++)
	f[i][j] = (f[i][j] + 1ll * f[i - 1][k] * a[i][j - k]) % mod;
	cout << f[n][c] << endl;
	fclose(stdin);
	fclose(stdout);
	return 0;
}
```


### Prompt

Please formulate a cpp solution to the following problem:

A long time ago, in a galaxy far far away two giant IT-corporations Pineapple and Gogol continue their fierce competition. Crucial moment is just around the corner: Gogol is ready to release it's new tablet Lastus 3000.

This new device is equipped with specially designed artificial intelligence (AI). Employees of Pineapple did their best to postpone the release of Lastus 3000 as long as possible. Finally, they found out, that the name of the new artificial intelligence is similar to the name of the phone, that Pineapple released 200 years ago. As all rights on its name belong to Pineapple, they stand on changing the name of Gogol's artificial intelligence.

Pineapple insists, that the name of their phone occurs in the name of AI as a substring. Because the name of technology was already printed on all devices, the Gogol's director decided to replace some characters in AI name with "#". As this operation is pretty expensive, you should find the minimum number of characters to replace with "#", such that the name of AI doesn't contain the name of the phone as a substring.

Substring is a continuous subsequence of a string.

Input

The first line of the input contains the name of AI designed by Gogol, its length doesn't exceed 100 000 characters. Second line contains the name of the phone released by Pineapple 200 years ago, its length doesn't exceed 30. Both string are non-empty and consist of only small English letters.

Output

Print the minimum number of characters that must be replaced with "#" in order to obtain that the name of the phone doesn't occur in the name of AI as a substring.

Examples

Input

intellect
tell

Output

1

Input

google
apple

Output

0

Input

sirisiri
sir

Output

2

Note

In the first sample AI's name may be replaced with "int#llect".

In the second sample Gogol can just keep things as they are.

In the third sample one of the new possible names of AI may be "s#ris#ri".

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
int main() {
  string a, b;
  char c;
  a = "";
  int ans = 0;
  while ((c = getchar()) != '\n') a += c;
  cin >> b;
  for (int i = 0; i < a.size(); ++i) {
    int n = b.size();
    if (a.substr(i, n) == b) {
      ans++;
      i += n - 1;
    }
  }
  cout << ans << endl;
  return 0;
}

```


### Prompt

Generate a CPP solution to the following problem:

One day Ms Swan bought an orange in a shop. The orange consisted of n·k segments, numbered with integers from 1 to n·k.

There were k children waiting for Ms Swan at home. The children have recently learned about the orange and they decided to divide it between them. For that each child took a piece of paper and wrote the number of the segment that he would like to get: the i-th (1 ≤ i ≤ k) child wrote the number ai (1 ≤ ai ≤ n·k). All numbers ai accidentally turned out to be different.

Now the children wonder, how to divide the orange so as to meet these conditions:

  * each child gets exactly n orange segments;
  * the i-th child gets the segment with number ai for sure;
  * no segment goes to two children simultaneously.

Help the children, divide the orange and fulfill the requirements, described above.

Input

The first line contains two integers n, k (1 ≤ n, k ≤ 30). The second line contains k space-separated integers a1, a2, ..., ak (1 ≤ ai ≤ n·k), where ai is the number of the orange segment that the i-th child would like to get.

It is guaranteed that all numbers ai are distinct.

Output

Print exactly n·k distinct integers. The first n integers represent the indexes of the segments the first child will get, the second n integers represent the indexes of the segments the second child will get, and so on. Separate the printed numbers with whitespaces.

You can print a child's segment indexes in any order. It is guaranteed that the answer always exists. If there are multiple correct answers, print any of them.

Examples

Input

2 2
4 1

Output

2 4
1 3

Input

3 1
2

Output

3 2 1

### Response

```cpp
#include <bits/stdc++.h>
int a[1000], f[1000];
int main() {
  int n, k, i, j;
  while (scanf("%d%d", &n, &k) != EOF) {
    memset(f, 0, sizeof(f));
    for (i = 0; i < k; i++) {
      scanf("%d", &a[i]);
      f[a[i]] = 1;
    }
    j = 1;
    for (i = 0; i < k; i++) {
      int num = n - 1;
      printf("%d", a[i]);
      while (num--) {
        if (f[j])
          num++;
        else {
          f[j] = 1;
          printf(" %d", j);
        }
        j++;
      }
      printf("\n");
    }
  }
}

```


### Prompt

Construct a CPP code solution to the problem outlined:

Uh oh! Applications to tech companies are due soon, and you've been procrastinating by doing contests instead! (Let's pretend for now that it is actually possible to get a job in these uncertain times.)

You have completed many programming projects. In fact, there are exactly n types of programming projects, and you have completed a_i projects of type i. Your résumé has limited space, but you want to carefully choose them in such a way that maximizes your chances of getting hired.

You want to include several projects of the same type to emphasize your expertise, but you also don't want to include so many that the low-quality projects start slipping in. Specifically, you determine the following quantity to be a good indicator of your chances of getting hired:

$$$ f(b_1,…,b_n)=∑_{i=1}^n b_i(a_i-b_i^2). $$$

Here, b_i denotes the number of projects of type i you include in your résumé. Of course, you cannot include more projects than you have completed, so you require 0≤ b_i ≤ a_i for all i.

Your résumé only has enough room for k projects, and you will absolutely not be hired if your résumé has empty space, so you require ∑_{i=1}^n b_i=k.

Find values for b_1,…, b_n that maximize the value of f(b_1,…,b_n) while satisfying the above two constraints.

Input

The first line contains two integers n and k (1≤ n≤ 10^5, 1≤ k≤ ∑_{i=1}^n a_i) — the number of types of programming projects and the résumé size, respectively.

The next line contains n integers a_1,…,a_n (1≤ a_i≤ 10^9) — a_i is equal to the number of completed projects of type i.

Output

In a single line, output n integers b_1,…, b_n that achieve the maximum value of f(b_1,…,b_n), while satisfying the requirements 0≤ b_i≤ a_i and ∑_{i=1}^n b_i=k. If there are multiple solutions, output any.

Note that you do not have to output the value f(b_1,…,b_n).

Examples

Input

10 32
1 2 3 4 5 5 5 5 5 5

Output

1 2 3 3 3 4 4 4 4 4

Input

5 8
4 4 8 2 1

Output

2 2 2 1 1

Note

For the first test, the optimal answer is f=-269. Note that a larger f value is possible if we ignored the constraint ∑_{i=1}^n b_i=k.

For the second test, the optimal answer is f=9.

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
template <class T>
bool umin(T& a, const T& b) {
  return a > b ? a = b, true : false;
}
template <class T>
bool umax(T& a, const T& b) {
  return a < b ? a = b, true : false;
}
template <long long sz>
using tut = array<long long, sz>;
void usaco(string s) {
  freopen((s + ".in").c_str(), "r", stdin);
  freopen((s + ".out").c_str(), "w", stdout);
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
}
const long long N = 2e5 + 5;
const long long mod = (119 << 23) + 1;
const long long inf = LLONG_MAX;
const long double Pi = acos(-1);
void add(long long& a, long long b, long long mod = ::mod) {
  a = (a + b) % mod;
}
void sub(long long& a, long long b, long long mod = ::mod) {
  a = ((a - b) % mod + mod) % mod;
}
void mul(long long& a, long long b, long long mod = ::mod) {
  a = (a * 1ll * b) % mod;
}
long long n, m, k, t, q, ans, res, a[N];
long long rr[N];
void solve(long long t_case) {
  cin >> n >> k;
  for (long long i = 1; i <= n; i++) {
    cin >> a[i];
  }
  auto check2 = [&](long long b, long long a) -> long long {
    return (a - 3ll * b * b - 3ll * b - 1);
  };
  auto check = [&](long long mm) -> bool {
    long long cnt = 0;
    for (long long i = 1; i <= n; i++) {
      long long l = 0, r = a[i];
      while (l < r) {
        long long m = (l + r + 1) >> 1;
        if (check2(m, a[i]) >= mm)
          l = m;
        else
          r = m - 1;
      }
      rr[i] = l;
      cnt += l;
    }
    return (cnt >= k);
  };
  long long l = -inf, r = inf;
  while (l < r) {
    long long m = (l + r + 1) >> 1;
    if (check(m))
      l = m;
    else
      r = m - 1;
  }
  check(l);
  long long cnt = 0;
  for (long long i = 1; i <= n; i++) cnt += rr[i];
  cnt -= k;
  for (long long i = 1; i <= n && cnt; i++) {
    if (rr[i] && check2(rr[i], a[i]) == l) cnt--, rr[i]--;
  }
  for (long long i = 1; i <= n; i++) cout << rr[i] << " ";
  cout << "\n";
}
signed main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  if (0) {
    long long t;
    cin >> t;
    for (long long t_case = 1; t_case <= t; t_case++) solve(t_case);
  } else
    solve(1);
  return 0;
}

```


### Prompt

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

You are given N points in the xy-plane. You have a circle of radius one and move it on the xy-plane, so as to enclose as many of the points as possible. Find how many points can be simultaneously enclosed at the maximum. A point is considered enclosed by a circle when it is inside or on the circle.

<image>

Fig 1. Circle and Points

Input

The input consists of a series of data sets, followed by a single line only containing a single character '0', which indicates the end of the input. Each data set begins with a line containing an integer N, which indicates the number of points in the data set. It is followed by N lines describing the coordinates of the points. Each of the N lines has two decimal fractions X and Y, describing the x- and y-coordinates of a point, respectively. They are given with five digits after the decimal point.

You may assume 1 <= N <= 300, 0.0 <= X <= 10.0, and 0.0 <= Y <= 10.0. No two points are closer than 0.0001. No two points in a data set are approximately at a distance of 2.0. More precisely, for any two points in a data set, the distance d between the two never satisfies 1.9999 <= d <= 2.0001. Finally, no three points in a data set are simultaneously very close to a single circle of radius one. More precisely, let P1, P2, and P3 be any three points in a data set, and d1, d2, and d3 the distances from an arbitrarily selected point in the xy-plane to each of them respectively. Then it never simultaneously holds that 0.9999 <= di <= 1.0001 (i = 1, 2, 3).

Output

For each data set, print a single line containing the maximum number of points in the data set that can be simultaneously enclosed by a circle of radius one. No other characters including leading and trailing spaces should be printed.

Example

Input

3
6.47634 7.69628
5.16828 4.79915
6.69533 6.20378
6
7.15296 4.08328
6.50827 2.69466
5.91219 3.86661
5.29853 4.16097
6.10838 3.46039
6.34060 2.41599
8
7.90650 4.01746
4.10998 4.18354
4.67289 4.01887
6.33885 4.28388
4.98106 3.82728
5.12379 5.16473
7.84664 4.67693
4.02776 3.87990
20
6.65128 5.47490
6.42743 6.26189
6.35864 4.61611
6.59020 4.54228
4.43967 5.70059
4.38226 5.70536
5.50755 6.18163
7.41971 6.13668
6.71936 3.04496
5.61832 4.23857
5.99424 4.29328
5.60961 4.32998
6.82242 5.79683
5.44693 3.82724
6.70906 3.65736
7.89087 5.68000
6.23300 4.59530
5.92401 4.92329
6.24168 3.81389
6.22671 3.62210
0

Output

2
5
5
11

### Response

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

using namespace std;
typedef double D;
const D EPS= (1e-10);

#define X real()
#define Y imag()
#define SZ size()
#define PB(x) push_back(b)
#define PREV(x,i)  (x[(i+x.SZ-1)%x.SZ])
#define NEXT(x,i) (x[(i+1)%x.SZ])

template<class T> using CR=const  T&;
using P=complex<D>;
using G=vector<P>;

int sgn(D a,D b=0){
    if(a>b+EPS)return 1;
    if(a<b-EPS)return -1;
    return 0;
}

D dist(P a,P b){
    return abs(a-b);
}

tuple<P,P> normal_direction(P v){
    D x=v.X,y=v.Y;
    return tuple<P,P>(P(y,-x),P(-y,x));
}

P normalize(P v){
    D x=v.X,y=v.Y;
    D d=abs(v);
    return P(x/d,y/d);
}

tuple<P,P> getC(P a,P b){
    auto v=b-a;
    auto pq=normal_direction(v);
    P p,q;tie(p,q)=pq;
    D d=sqrt(1-(dist(a,b)/2)*(dist(a,b)/2));
    return tuple<P,P>(a+0.5*v+d*normalize(p),a+0.5*v+d*normalize(q));
}

int cnt(G& g,P c){
    int n=g.size(),res=0;
    for(int i=0;i<n;i++)
	if(sgn(dist(c,g[i]),1.0)<=0){
	    res++;
	}
    return res;
}

int main(){
    for(int n;cin>>n,n;){
	G g(n);
	for(int i=0;i<n;i++){\
	    D x,y;
	    cin>>x>>y;
	    g[i]=P(x,y);
	}
	int res=1;
	for(int i=0;i<n;i++)
	    for(int j=i+1;j<n;j++)
		if(sgn(dist(g[i],g[j]),2.0)<=0){
		    auto pq=getC(g[i],g[j]);
		    P p,q;tie(p,q)=pq;
		    res=max({res,cnt(g,p),cnt(g,q)});
		}
	cout<<res<<endl;
    }
}
```


### Prompt

Please create a solution in cpp to the following problem:

International Women's Day is coming soon! Polycarp is preparing for the holiday.

There are n candy boxes in the shop for sale. The i-th box contains d_i candies.

Polycarp wants to prepare the maximum number of gifts for k girls. Each gift will consist of exactly two boxes. The girls should be able to share each gift equally, so the total amount of candies in a gift (in a pair of boxes) should be divisible by k. In other words, two boxes i and j (i ≠ j) can be combined as a gift if d_i + d_j is divisible by k.

How many boxes will Polycarp be able to give? Of course, each box can be a part of no more than one gift. Polycarp cannot use boxes "partially" or redistribute candies between them.

Input

The first line of the input contains two integers n and k (1 ≤ n ≤ 2 ⋅ 10^5, 1 ≤ k ≤ 100) — the number the boxes and the number the girls.

The second line of the input contains n integers d_1, d_2, ..., d_n (1 ≤ d_i ≤ 10^9), where d_i is the number of candies in the i-th box.

Output

Print one integer — the maximum number of the boxes Polycarp can give as gifts.

Examples

Input

7 2
1 2 2 3 2 4 10

Output

6

Input

8 2
1 2 2 3 2 4 6 10

Output

8

Input

7 3
1 2 2 3 2 4 5

Output

4

Note

In the first example Polycarp can give the following pairs of boxes (pairs are presented by indices of corresponding boxes):

  * (2, 3);
  * (5, 6);
  * (1, 4).

So the answer is 6.

In the second example Polycarp can give the following pairs of boxes (pairs are presented by indices of corresponding boxes):

  * (6, 8);
  * (2, 3);
  * (1, 4);
  * (5, 7).

So the answer is 8.

In the third example Polycarp can give the following pairs of boxes (pairs are presented by indices of corresponding boxes):

  * (1, 2);
  * (6, 7).

So the answer is 4.

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  srand(time(NULL));
  ;
  long long t, n, m, k, a, b, c, d;
  t = 1;
  while (t--) {
    cin >> n >> k;
    vector<long long> v(n);
    vector<long long> fr(k, 0);
    for (long long i = 0; i < n; i++) {
      cin >> v[i];
      fr[v[i] % k]++;
    }
    long long ans = 0;
    ans += fr[0] / 2;
    for (long long i = 1; i <= k / 2; i++) {
      ans += min(fr[i], fr[k - i]);
    }
    if (k % 2 == 0) {
      ans -= fr[k / 2];
      ans += fr[k / 2] / 2;
    }
    ans *= 2;
    cout << ans << endl;
  }
  return 0;
}

```


### Prompt

Generate a cpp solution to the following problem:

Bear Limak examines a social network. Its main functionality is that two members can become friends (then they can talk with each other and share funny pictures).

There are n members, numbered 1 through n. m pairs of members are friends. Of course, a member can't be a friend with themselves.

Let A-B denote that members A and B are friends. Limak thinks that a network is reasonable if and only if the following condition is satisfied: For every three distinct members (X, Y, Z), if X-Y and Y-Z then also X-Z.

For example: if Alan and Bob are friends, and Bob and Ciri are friends, then Alan and Ciri should be friends as well.

Can you help Limak and check if the network is reasonable? Print "YES" or "NO" accordingly, without the quotes.

Input

The first line of the input contain two integers n and m (3 ≤ n ≤ 150 000, <image>) — the number of members and the number of pairs of members that are friends.

The i-th of the next m lines contains two distinct integers ai and bi (1 ≤ ai, bi ≤ n, ai ≠ bi). Members ai and bi are friends with each other. No pair of members will appear more than once in the input.

Output

If the given network is reasonable, print "YES" in a single line (without the quotes). Otherwise, print "NO" in a single line (without the quotes).

Examples

Input

4 3
1 3
3 4
1 4

Output

YES

Input

4 4
3 1
2 3
3 4
1 2

Output

NO

Input

10 4
4 3
5 10
8 9
1 2

Output

YES

Input

3 2
1 2
2 3

Output

NO

Note

The drawings below show the situation in the first sample (on the left) and in the second sample (on the right). Each edge represents two members that are friends. The answer is "NO" in the second sample because members (2, 3) are friends and members (3, 4) are friends, while members (2, 4) are not.

<image>

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
const long long int INF = 9e18L;
const long long int mod = 1e9 + 7;
long long int power(long long int x, long long int y) {
  long long int res = 1;
  int mod = 1e9 + 7;
  while (y > 0) {
    if (y & 1) (res = res * x) %= mod;
    (x = x * x) %= mod;
    y = y >> 1;
  }
  return res % mod;
}
vector<int> adj[150001], vis(150001, 0), v;
int c;
void dfs(int u) {
  vis[u] = 1;
  c++;
  v.push_back(u);
  for (auto x : adj[u]) {
    if (vis[x] == 0) {
      dfs(x);
    }
  }
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n, m;
  cin >> n >> m;
  for (int i = 0; i < m; i++) {
    int a, b;
    cin >> a >> b;
    adj[a].push_back(b);
    adj[b].push_back(a);
  }
  int flag = 1;
  for (int i = 1; i < n + 1 && flag; i++) {
    if (vis[i] == 0) {
      c = 0;
      dfs(i);
      for (auto x : v) {
        if (adj[x].size() != c - 1) {
          flag = 0;
          break;
        }
      }
      v.clear();
    }
  }
  if (flag)
    cout << "YES" << '\n';
  else
    cout << "NO" << '\n';
}

```


### Prompt

Develop a solution in Cpp to the problem described below:

You are given three positive integers n, a and b. You have to construct a string s of length n consisting of lowercase Latin letters such that each substring of length a has exactly b distinct letters. It is guaranteed that the answer exists.

You have to answer t independent test cases.

Recall that the substring s[l ... r] is the string s_l, s_{l+1}, ..., s_{r} and its length is r - l + 1. In this problem you are only interested in substrings of length a.

Input

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

The only line of a test case contains three space-separated integers n, a and b (1 ≤ a ≤ n ≤ 2000, 1 ≤ b ≤ min(26, a)), where n is the length of the required string, a is the length of a substring and b is the required number of distinct letters in each substring of length a.

It is guaranteed that the sum of n over all test cases does not exceed 2000 (∑ n ≤ 2000).

Output

For each test case, print the answer — such a string s of length n consisting of lowercase Latin letters that each substring of length a has exactly b distinct letters. If there are multiple valid answers, print any of them. It is guaranteed that the answer exists.

Example

Input

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

Output

tleelte
qwerty
vvvvvv
abcde

Note

In the first test case of the example, consider all the substrings of length 5:

  * "tleel": it contains 3 distinct (unique) letters,
  * "leelt": it contains 3 distinct (unique) letters,
  * "eelte": it contains 3 distinct (unique) letters.

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
const int maxn = 4e6 + 7;
const int maxm = 2e3 + 7;
const int mod = 998244353;
long long ans = 0, tot = 0, tot1, tot2;
long long a[maxn], b[maxn], p[maxn], last[maxm], f[maxm], dp[200][200];
bool flag[maxn], vis[maxn], vis1[maxn];
struct node {
  char c;
  long long x, y, z;
  node(int x = 0, int y = 0, int z = 0) : x(x), y(y), z(z) {}
  bool operator<(const node& n) {
    if (z == n.z) return y < n.y;
    return z > n.z;
  }
};
node ve[maxn];
vector<int> v;
long long C[200][200];
void trangle() {
  C[1][1] = C[2][1] = C[2][2] = 1;
  for (register int i = 3; i <= 150; i++) {
    for (register int j = 1; j <= i; j++) {
      C[i][j] = (C[i - 1][j - 1] + C[i - 1][j]) % mod;
    }
  }
}
int main() {
  string s1, s2;
  long long n, m, k;
  long long x, y;
  map<int, int> mp;
  int t;
  cin >> t;
  while (t--) {
    s1 = "";
    cin >> n >> m >> k;
    int f = floor(1.0 * m / k);
    int s = ceil(1.0 * m / f);
    for (register int i = 1; i <= s; i++) {
      for (register int j = 1; j <= f; j++) {
        s1 += 'a' + (i - 1) % k;
      }
    }
    s1 = s1.substr(0, m);
    int len = s1.size();
    for (register int i = 1; i <= n; i++) {
      cout << s1[(i - 1) % len];
    }
    cout << '\n';
  }
}

```


### Prompt

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

Vasiliy finally got to work, where there is a huge amount of tasks waiting for him. Vasiliy is given a matrix consisting of n rows and m columns and q tasks. Each task is to swap two submatrices of the given matrix.

For each task Vasiliy knows six integers ai, bi, ci, di, hi, wi, where ai is the index of the row where the top-left corner of the first rectangle is located, bi is the index of its column, ci is the index of the row of the top-left corner of the second rectangle, di is the index of its column, hi is the height of the rectangle and wi is its width.

It's guaranteed that two rectangles in one query do not overlap and do not touch, that is, no cell belongs to both rectangles, and no two cells belonging to different rectangles share a side. However, rectangles are allowed to share an angle.

Vasiliy wants to know how the matrix will look like after all tasks are performed.

Input

The first line of the input contains three integers n, m and q (2 ≤ n, m ≤ 1000, 1 ≤ q ≤ 10 000) — the number of rows and columns in matrix, and the number of tasks Vasiliy has to perform.

Then follow n lines containing m integers vi, j (1 ≤ vi, j ≤ 109) each — initial values of the cells of the matrix.

Each of the following q lines contains six integers ai, bi, ci, di, hi, wi (1 ≤ ai, ci, hi ≤ n, 1 ≤ bi, di, wi ≤ m).

Output

Print n lines containing m integers each — the resulting matrix.

Examples

Input

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

Output

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

Input

4 2 1
1 1
1 1
2 2
2 2
1 1 4 1 1 2

Output

2 2
1 1
2 2
1 1

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1005;
int a[MAXN][MAXN];
int n, m, i, j, k, x, y, xx, yy, nn, mm, q;
int nowx, nowy, nexx, nexy;
int r[MAXN][MAXN][2];
int d[MAXN][MAXN][2];
inline int get() {
  char c;
  while ((c = getchar()) < 48 || c > 57)
    ;
  int res = c - 48;
  while ((c = getchar()) >= 48 && c <= 57) res = res * 10 + c - 48;
  return res;
}
inline void getpoint(int a, int b, int &x, int &y) {
  x = 0;
  y = 0;
  for (int i = 1; i <= b; i++) {
    int xx = r[x][y][0], yy = r[x][y][1];
    x = xx;
    y = yy;
  }
  for (int i = 1; i <= a; i++) {
    int xx = d[x][y][0], yy = d[x][y][1];
    x = xx;
    y = yy;
  }
}
int main() {
  cin >> n >> m;
  cin >> q;
  for (i = 1; i <= n; i++)
    for (j = 1; j <= m; j++) a[i][j] = get();
  for (i = 0; i <= n; i++) {
    for (j = 0; j <= m; j++) r[i][j][0] = i, r[i][j][1] = j + 1;
    for (j = 0; j <= m; j++) d[i][j][0] = i + 1, d[i][j][1] = j;
  }
  while (q--) {
    int f, g;
    x = get();
    y = get();
    xx = get();
    yy = get();
    nn = get();
    mm = get();
    int b[4][4];
    getpoint(x, y - 1, b[0][0], b[0][1]);
    getpoint(xx, yy - 1, b[0][2], b[0][3]);
    getpoint(x, y + mm - 1, b[1][0], b[1][1]);
    getpoint(xx, yy + mm - 1, b[1][2], b[1][3]);
    getpoint(x - 1, y, b[2][0], b[2][1]);
    getpoint(xx - 1, yy, b[2][2], b[2][3]);
    getpoint(x + nn - 1, y, b[3][0], b[3][1]);
    getpoint(xx + nn - 1, yy, b[3][2], b[3][3]);
    nowx = b[0][0];
    nowy = b[0][1];
    nexx = b[0][2];
    nexy = b[0][3];
    for (i = 1; i <= nn; i++) {
      swap(r[nowx][nowy][0], r[nexx][nexy][0]);
      swap(r[nowx][nowy][1], r[nexx][nexy][1]);
      f = d[nowx][nowy][0];
      g = d[nowx][nowy][1];
      nowx = f;
      nowy = g;
      f = d[nexx][nexy][0];
      g = d[nexx][nexy][1];
      nexx = f;
      nexy = g;
    }
    nowx = b[1][0];
    nowy = b[1][1];
    nexx = b[1][2];
    nexy = b[1][3];
    for (i = 1; i <= nn; i++) {
      swap(r[nowx][nowy][0], r[nexx][nexy][0]);
      swap(r[nowx][nowy][1], r[nexx][nexy][1]);
      f = d[nowx][nowy][0];
      g = d[nowx][nowy][1];
      nowx = f;
      nowy = g;
      f = d[nexx][nexy][0];
      g = d[nexx][nexy][1];
      nexx = f;
      nexy = g;
    }
    nowx = b[2][0];
    nowy = b[2][1];
    nexx = b[2][2];
    nexy = b[2][3];
    for (i = 1; i <= mm; i++) {
      swap(d[nowx][nowy][0], d[nexx][nexy][0]);
      swap(d[nowx][nowy][1], d[nexx][nexy][1]);
      f = r[nowx][nowy][0];
      g = r[nowx][nowy][1];
      nowx = f;
      nowy = g;
      f = r[nexx][nexy][0];
      g = r[nexx][nexy][1];
      nexx = f;
      nexy = g;
    }
    nowx = b[3][0];
    nowy = b[3][1];
    nexx = b[3][2];
    nexy = b[3][3];
    for (i = 1; i <= mm; i++) {
      swap(d[nowx][nowy][0], d[nexx][nexy][0]);
      swap(d[nowx][nowy][1], d[nexx][nexy][1]);
      f = r[nowx][nowy][0];
      g = r[nowx][nowy][1];
      nowx = f;
      nowy = g;
      f = r[nexx][nexy][0];
      g = r[nexx][nexy][1];
      nexx = f;
      nexy = g;
    }
  }
  for (i = 1; i <= n; i++) {
    x = i;
    y = 0;
    for (j = 1; j <= m; j++) {
      xx = r[x][y][0];
      yy = r[x][y][1];
      x = xx;
      y = yy;
      printf("%d ", a[x][y]);
    }
    puts("");
  }
}

```


### Prompt

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

There are two rectangles whose bases are parallel to the x-axis. Read the lower left coordinates (xa1, ya1) and upper right coordinates (xa2, ya2) of rectangle A, the lower left coordinates (xb1, yb1) and upper right coordinates (xb2, yb2) of rectangle B, and rectangle A and B Create a program that outputs YES if there is any overlap, and NO if there is no overlap at all. However, assume that rectangle A and rectangle B are not the same thing. Also, the things that are in contact are considered to overlap.

<image>

Input

Given multiple datasets. The format of each dataset is as follows.

xa1 ya1 xa2 ya2 xb1 yb1 xb2 yb2

Each value entered is between -2,000 and 2,000, and each value is given as a real number, including up to five digits after the decimal point.

The number of datasets does not exceed 50.

Output

Print YES or NO on one line for each dataset.

Example

Input

0.0 0.0 5.0 5.0 1.0 1.0 4.0 4.0
0.0 0.0 4.0 5.0 1.0 1.0 5.0 5.0
0.0 0.0 4.0 4.0 -3.0 -5.0 2.0 -1.0

Output

YES
YES
NO

### Response

```cpp
#include<stdio.h>
int main()
{
	double ax1,ax2,ay1,ay2,bx1,bx2,by1,by2;
	while(scanf("%lf%lf%lf%lf%lf%lf%lf%lf",&ax1,&ay1,&ax2,&ay2,&bx1,&by1,&bx2,&by2)==8)
		puts(ax1<=bx2&&bx1<=ax2&&ay1<=by2&&by1<=ay2?"YES":"NO");
	return 0;
}
```


### Prompt

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

You are given an array a_1, a_2, ..., a_n consisting of n distinct integers. Count the number of pairs of indices (i, j) such that i < j and a_i ⋅ a_j = i + j.

Input

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

The first line of each test case contains one integer n (2 ≤ n ≤ 10^5) — the length of array a.

The second line of each test case contains n space separated integers a_1, a_2, …, a_n (1 ≤ a_i ≤ 2 ⋅ n) — the array a. It is guaranteed that all elements are distinct.

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

Output

For each test case, output the number of pairs of indices (i, j) such that i < j and a_i ⋅ a_j = i + j.

Example

Input

3
2
3 1
3
6 1 5
5
3 1 5 9 2

Output

1
1
3

Note

For the first test case, the only pair that satisfies the constraints is (1, 2), as a_1 ⋅ a_2 = 1 + 2 = 3

For the second test case, the only pair that satisfies the constraints is (2, 3).

For the third test case, the pairs that satisfy the constraints are (1, 2), (1, 5), and (2, 3).

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long long int lli;
#define pb push_back
#define mp make_pair
#define va(a) a.begin(), a.end()
#define vd(d) d.begin(), d.end(), greater<ll>()
#define vi vector<int>
#define vll vector<long long>
#define pb push_back
#define pll pair<ll, ll>
#define si set<int>
#define sll set<long long>
#define endl "\n"
#define rep(i, a, b) for (ll i = a; i < b; i++)
#define demonb95                      \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL);                    \
    cout.tie(NULL)
void solve()
{
    ll n;
    cin >> n;
    vector<pll> v;
    rep(i, 0, n)
    {
        ll x;
        cin >> x;
        v.pb(mp(x, i + 1));
    }
    sort(va(v));
    ll count = 0;
    rep(i, 0, n)
    {
        rep(j, i + 1, n)
        {
            ll a = v[i].first * v[j].first;
            ll b = v[i].second + v[j].second;
            if (a == b)
                count++;

            if (a > 2 * n)
                break;
        }
    }
    cout << count << endl;
}
int main()
{
    demonb95;

    ll t;
    cin >> t;
    while (t--)
    {
        solve();
    }
    return 0;
}
```


### Prompt

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

An integer sequence is called beautiful if the difference between any two consecutive numbers is equal to 1. More formally, a sequence s_1, s_2, …, s_{n} is beautiful if |s_i - s_{i+1}| = 1 for all 1 ≤ i ≤ n - 1.

Trans has a numbers 0, b numbers 1, c numbers 2 and d numbers 3. He wants to construct a beautiful sequence using all of these a + b + c + d numbers.

However, it turns out to be a non-trivial task, and Trans was not able to do it. Could you please help Trans?

Input

The only input line contains four non-negative integers a, b, c and d (0 < a+b+c+d ≤ 10^5).

Output

If it is impossible to construct a beautiful sequence satisfying the above constraints, print "NO" (without quotes) in one line.

Otherwise, print "YES" (without quotes) in the first line. Then in the second line print a + b + c + d integers, separated by spaces — a beautiful sequence. There should be a numbers equal to 0, b numbers equal to 1, c numbers equal to 2 and d numbers equal to 3.

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

Examples

Input

2 2 2 1

Output

YES
0 1 0 1 2 3 2

Input

1 2 3 4

Output

NO

Input

2 2 2 3

Output

NO

Note

In the first test, it is easy to see, that the sequence is beautiful because the difference between any two consecutive numbers is equal to 1. Also, there are exactly two numbers, equal to 0, 1, 2 and exactly one number, equal to 3.

It can be proved, that it is impossible to construct beautiful sequences in the second and third tests.

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 4e5 + 20;
int main() {
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  if (c == d && c == 0 && a == b + 1) {
    puts("YES");
    cout << "0 ";
    for (int i = 0; i < b; ++i) {
      cout << "1 0 ";
    }
  } else if (a == b && a == 0 && c == d - 1) {
    puts("YES");
    cout << "3 ";
    for (int i = 0; i < c; ++i) {
      cout << "2 3 ";
    }
  } else if ((a <= b) && (c >= d) && (abs((b - a) - (c - d)) <= 1)) {
    puts("YES");
    if ((b - a) - (c - d) > 0) cout << "1 ";
    for (int i = 0; i < a; ++i) {
      cout << "0 1 ";
    }
    int num = 0;
    if ((b - a) - (c - d) > 0)
      num = (b - a - 1);
    else if ((b - a) - (c - d) < 0)
      num = (c - d - 1);
    else
      num = b - a;
    for (int j = 0; j < num; ++j) {
      cout << "2 1 ";
    }
    for (int k = 0; k < d; ++k) {
      cout << "2 3 ";
    }
    if ((b - a) - (c - d) < 0) cout << "2 ";
    puts("");
  } else {
    puts("NO");
  }
}

```


### Prompt

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

Snuke has a blackboard and a set S consisting of N integers. The i-th element in S is S_i.

He wrote an integer X on the blackboard, then performed the following operation N times:

* Choose one element from S and remove it.
* Let x be the number written on the blackboard now, and y be the integer removed from S. Replace the number on the blackboard with x \bmod {y}.

There are N! possible orders in which the elements are removed from S. For each of them, find the number that would be written on the blackboard after the N operations, and compute the sum of all those N! numbers modulo 10^{9}+7.

Constraints

* All values in input are integers.
* 1 \leq N \leq 200
* 1 \leq S_i, X \leq 10^{5}
* S_i are pairwise distinct.

Input

Input is given from Standard Input in the following format:

N X
S_1 S_2 \ldots S_{N}

Output

Print the answer.

Examples

Input

2 19
3 7

Output

3

Input

5 82
22 11 6 5 13

Output

288

Input

10 100000
50000 50001 50002 50003 50004 50005 50006 50007 50008 50009

Output

279669259

### Response

```cpp

#include <iostream>
#include <algorithm>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;
const ll MOD = 1000000007;

int main(int argc, const char * argv[]) {

  ll N, X; cin >> N >> X;
  vector<ll> S(N);
  for (int i=0; i<N; i++)
    cin >> S[i];

  sort(S.begin(), S.end(), greater<ll>());

  vector<vector<ll>> dp(N+1, vector<ll>(X+1, 0));
  dp[0][X] = 1;
  for (ll n=0; n<N; n++) {
    for (ll x=0; x<X+1; x++) {
      if (dp[n][x] == 0) continue;
      dp[n+1][x%S[n]] += dp[n][x];
      dp[n+1][x%S[n]] %= MOD;
      dp[n+1][x] += (N-n-1)*dp[n][x]%MOD;
      dp[n+1][x] %= MOD;
    }
  }

  ll ans = 0;
  for (int i=0; i<X+1; i++){
    ans += dp[N][i]*i % MOD;
    ans %= MOD;
  }
  cout << ans << endl;

  return 0;
}

```


### Prompt

Please create a solution in CPP to the following problem:

John Doe has an n × m table. John Doe can paint points in some table cells, not more than one point in one table cell. John Doe wants to use such operations to make each square subtable of size n × n have exactly k points.

John Doe wondered, how many distinct ways to fill the table with points are there, provided that the condition must hold. As this number can be rather large, John Doe asks to find its remainder after dividing by 1000000007 (109 + 7).

You should assume that John always paints a point exactly in the center of some cell. Two ways to fill a table are considered distinct, if there exists a table cell, that has a point in one way and doesn't have it in the other.

Input

A single line contains space-separated integers n, m, k (1 ≤ n ≤ 100; n ≤ m ≤ 1018; 0 ≤ k ≤ n2) — the number of rows of the table, the number of columns of the table and the number of points each square must contain.

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

Output

In a single line print a single integer — the remainder from dividing the described number of ways by 1000000007 (109 + 7).

Examples

Input

5 6 1

Output

45

Note

Let's consider the first test case:

<image> The gray area belongs to both 5 × 5 squares. So, if it has one point, then there shouldn't be points in any other place. If one of the white areas has a point, then the other one also must have a point. Thus, there are about 20 variants, where the point lies in the gray area and 25 variants, where each of the white areas contains a point. Overall there are 45 variants.

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
const int modulo = 1e9 + 7;
const int max_n = 111;
const int max_k = max_n * max_n;
int bin_pow(int base, long long pw) {
  if (pw == 0) return 1;
  if (pw & 1) return (1LL * base * bin_pow(base, pw - 1)) % modulo;
  return bin_pow((1LL * base * base) % modulo, pw >> 1);
}
int a[max_n][max_k], C[max_n][max_n], d[max_n][max_n];
int n, k;
long long m;
int main() {
  ios_base::sync_with_stdio(false);
  C[0][0] = 1;
  for (int i = 1; i < max_n; ++i) {
    C[0][i] = 0;
    C[i][0] = 1;
  }
  for (int i = 1; i < max_n; ++i)
    for (int j = 1; j < max_n; ++j)
      C[i][j] = (0LL + C[i][j] + C[i - 1][j] + C[i - 1][j - 1]) % modulo;
  cin >> n >> m >> k;
  for (int i = 1; i <= n; ++i)
    for (int j = 0; j <= n; ++j) {
      long long pw = 1 + (m - i) / n;
      d[i][j] = bin_pow(C[n][j], pw);
    }
  a[0][0] = 1;
  for (int i = 1; i <= n; ++i)
    for (int j = 0; j <= min(k, i * n); ++j)
      for (int t = 0; t <= min(j, n); ++t)
        if (a[i - 1][j - t] != 0)
          a[i][j] = (a[i][j] + 1LL * a[i - 1][j - t] * d[i][t]) % modulo;
  cout << a[n][k] << endl;
  return 0;
}

```


### Prompt

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

The Smart Beaver from ABBYY loves puzzles. One of his favorite puzzles is the magic square. He has recently had an idea to automate the solution of this puzzle. The Beaver decided to offer this challenge to the ABBYY Cup contestants.

The magic square is a matrix of size n × n. The elements of this matrix are integers. The sum of numbers in each row of the matrix is equal to some number s. The sum of numbers in each column of the matrix is also equal to s. In addition, the sum of the elements on the main diagonal is equal to s and the sum of elements on the secondary diagonal is equal to s. Examples of magic squares are given in the following figure:

<image> Magic squares

You are given a set of n2 integers ai. It is required to place these numbers into a square matrix of size n × n so that they form a magic square. Note that each number must occur in the matrix exactly the same number of times as it occurs in the original set.

It is guaranteed that a solution exists!

Input

The first input line contains a single integer n. The next line contains n2 integers ai ( - 108 ≤ ai ≤ 108), separated by single spaces.

The input limitations for getting 20 points are:

  * 1 ≤ n ≤ 3

The input limitations for getting 50 points are:

  * 1 ≤ n ≤ 4
  * It is guaranteed that there are no more than 9 distinct numbers among ai.

The input limitations for getting 100 points are:

  * 1 ≤ n ≤ 4

Output

The first line of the output should contain a single integer s. In each of the following n lines print n integers, separated by spaces and describing the resulting magic square. In the resulting magic square the sums in the rows, columns and diagonals must be equal to s. If there are multiple solutions, you are allowed to print any of them.

Examples

Input

3
1 2 3 4 5 6 7 8 9

Output

15
2 7 6
9 5 1
4 3 8

Input

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

Output

0
1 0 -1
-2 0 2
1 0 -1

Input

2
5 5 5 5

Output

10
5 5
5 5

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
const int N = 2036;
int a[N];
int c[N], r[N], d, d2;
int sc[N], sr[N], sd, sd2;
const int ITER = 1999;
int main() {
  int n;
  scanf("%d", &n);
  for (int i = (0); i < (int)(n * n); i++) scanf("%d", a + i);
  int s = accumulate(a, a + n * n, 0) / n;
  int sco = 1999;
  while (sco > 0) {
    int cur = 0;
    memset(c, 0, sizeof(c)), memset(r, 0, sizeof(r));
    d = d2 = 0;
    random_shuffle(a, a + n * n);
    for (int i = (0); i < (int)(n); i++)
      for (int j = (0); j < (int)(n); j++) {
        int id = i * n + j;
        r[i] += a[id];
        c[j] += a[id];
        if (i == j) d += a[id];
        if (i + j == n - 1) d2 += a[id];
      }
    sco = 0;
    for (int i = (0); i < (int)(n); i++) {
      sco += (sr[i] = abs(r[i] - s));
      sco += (sc[i] = abs(c[i] - s));
    }
    sco += (sd = abs(d - s));
    sco += (sd2 = abs(d2 - s));
    if (sco == 0) break;
    for (int iter = (0); iter < (int)(ITER); iter++) {
      int first, second;
      do {
        first = rand() % (n * n);
        second = rand() % (n * n);
      } while (a[first] == a[second]);
      int i1 = first / n, j1 = first % n;
      int i2 = second / n, j2 = second % n;
      int df = a[second] - a[first];
      int nr1 = i1 == i2 ? r[i1] : r[i1] + df;
      int nc1 = j1 == j2 ? c[j1] : c[j1] + df;
      int nr2 = i1 == i2 ? r[i2] : r[i2] - df;
      int nc2 = j1 == j2 ? c[j2] : c[j2] - df;
      int nd = d + (i1 == j1 ? df : 0) + (i2 == j2 ? -df : 0);
      int nd2 = d2 + (i1 + j1 == n - 1 ? df : 0) + (i2 + j2 == n - 1 ? -df : 0);
      int tr1 = abs(nr1 - s) - sr[i1];
      int tc1 = abs(nc1 - s) - sc[j1];
      int tr2 = abs(nr2 - s) - sr[i2];
      int tc2 = abs(nc2 - s) - sc[j2];
      int td = abs(nd - s) - sd;
      int td2 = abs(nd2 - s) - sd2;
      int upd = tr1 + tc1 + tr2 + tc2 + td + td2;
      if (upd < 0) {
        sco += upd;
        swap(a[first], a[second]);
        r[i1] += df;
        c[j1] += df;
        r[i2] -= df;
        c[j2] -= df;
        if (i1 == j1) d += df;
        if (i1 + j1 == n - 1) d2 += df;
        if (i2 == j2) d -= df;
        if (i2 + j2 == n - 1) d2 -= df;
        sr[i1] += tr1;
        sc[j1] += tc1;
        sr[i2] += tr2;
        sc[j2] += tc2;
        sd += td;
        sd2 += td2;
        if (sco == 0) goto OUT;
      }
    }
  }
OUT:
  printf("%d\n", s);
  for (int i = (0); i < (int)(n * n); i++)
    printf("%d%c", a[i], i % n == n - 1 ? '\n' : ' ');
  return 0;
}

```


### Prompt

Create a solution in CPP for the following problem:

There are three airports A, B and C, and flights between each pair of airports in both directions.

A one-way flight between airports A and B takes P hours, a one-way flight between airports B and C takes Q hours, and a one-way flight between airports C and A takes R hours.

Consider a route where we start at one of the airports, fly to another airport and then fly to the other airport.

What is the minimum possible sum of the flight times?

Constraints

* 1 \leq P,Q,R \leq 100
* All values in input are integers.

Input

Input is given from Standard Input in the following format:

P Q R

Output

Print the minimum possible sum of the flight times.

Examples

Input

1 3 4

Output

4

Input

3 2 3

Output

5

### Response

```cpp
#include <iostream>
using namespace std;
int p, q, r;
int main() {
	cin>>p>>q>>r;
	cout<<p+q+r - max(p, max(q, r));
	return 0;
}
```


### Prompt

Generate a CPP solution to the following problem:

George decided to prepare a Codesecrof round, so he has prepared m problems for the round. Let's number the problems with integers 1 through m. George estimates the i-th problem's complexity by integer bi.

To make the round good, he needs to put at least n problems there. Besides, he needs to have at least one problem with complexity exactly a1, at least one with complexity exactly a2, ..., and at least one with complexity exactly an. Of course, the round can also have problems with other complexities.

George has a poor imagination. It's easier for him to make some already prepared problem simpler than to come up with a new one and prepare it. George is magnificent at simplifying problems. He can simplify any already prepared problem with complexity c to any positive integer complexity d (c ≥ d), by changing limits on the input data.

However, nothing is so simple. George understood that even if he simplifies some problems, he can run out of problems for a good round. That's why he decided to find out the minimum number of problems he needs to come up with in addition to the m he's prepared in order to make a good round. Note that George can come up with a new problem of any complexity.

Input

The first line contains two integers n and m (1 ≤ n, m ≤ 3000) — the minimal number of problems in a good round and the number of problems George's prepared. The second line contains space-separated integers a1, a2, ..., an (1 ≤ a1 < a2 < ... < an ≤ 106) — the requirements for the complexity of the problems in a good round. The third line contains space-separated integers b1, b2, ..., bm (1 ≤ b1 ≤ b2... ≤ bm ≤ 106) — the complexities of the problems prepared by George.

Output

Print a single integer — the answer to the problem.

Examples

Input

3 5
1 2 3
1 2 2 3 3

Output

0

Input

3 5
1 2 3
1 1 1 1 1

Output

2

Input

3 1
2 3 4
1

Output

3

Note

In the first sample the set of the prepared problems meets the requirements for a good round.

In the second sample, it is enough to come up with and prepare two problems with complexities 2 and 3 to get a good round.

In the third sample it is very easy to get a good round if come up with and prepare extra problems with complexities: 2, 3, 4.

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
int main() {
  int k, l, n, m, q, h, kol = 0;
  cin >> n >> m;
  vector<int> v, u, r;
  for (int i = 0; i < n; i++) {
    cin >> k;
    v.push_back(k);
    r.push_back(1);
  }
  for (int i = 0; i < m; i++) {
    cin >> k;
    u.push_back(k);
  }
  h = 0;
  for (int i = 0; i < n; i++) {
    q = v[i];
    int j = h;
    int f = 1;
    while ((j < m) && (f == 1)) {
      l = u[j];
      if (l >= q) {
        kol++;
        f = 0;
        j++;
        h++;
      } else {
        j++;
        h++;
      }
    }
  }
  cout << max(0, n - kol);
  return 0;
}

```


### Prompt

Generate a Cpp solution to the following problem:

problem

Given the sequence $ A $ of length $ N $. Find the maximum value of $ \ sum B_i $, where $ B $ is one of the longest increasing subsequences of the sequence $ A $.

The longest increasing subsequence of the sequence $ A $ is the longest subsequence that satisfies $ A_i <A_j $ with all $ i <j $.

output

Output the maximum value of $ \ sum B_i $, where $ B $ is one of the longest increasing subsequences of the sequence $ A $. Also, output a line break at the end.

Example

Input

4
6 4 7 8

Output

21

### Response

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

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

    vector<int> lis(n + 1, 1e9);
    vector<vector<int>> ds(n);
    for (int i = 0; i < n; i++) {
        int k = lower_bound(lis.begin(), lis.end(), as[i]) - lis.begin();
        lis[k] = as[i];
        ds[k].push_back(as[i]);
    }
    long long ans = 0;
    int k;
    for (k = 0; k < n + 1; k++) {
        if (lis[k] == 1e9) break;
    }

    int nax = 1e9;
    for (int i = k - 1; i >= 0; i--) {
        sort(ds[i].begin(), ds[i].end());
        while (ds[i].back() >= nax) {
            ds[i].pop_back();
        }
        ans += ds[i].back();
        nax = ds[i].back();
    }

    cout << ans << endl;
}

```


### Prompt

Develop a solution in Cpp to the problem described below:

Drazil is playing a math game with Varda.

Let's define <image> for positive integer x as a product of factorials of its digits. For example, <image>.

First, they choose a decimal number a consisting of n digits that contains at least one digit larger than 1. This number may possibly start with leading zeroes. Then they should find maximum positive number x satisfying following two conditions:

1. x doesn't contain neither digit 0 nor digit 1.

2. <image> = <image>.

Help friends find such number.

Input

The first line contains an integer n (1 ≤ n ≤ 15) — the number of digits in a.

The second line contains n digits of a. There is at least one digit in a that is larger than 1. Number a may possibly contain leading zeroes.

Output

Output a maximum possible integer satisfying the conditions above. There should be no zeroes and ones in this number decimal representation.

Examples

Input

4
1234

Output

33222

Input

3
555

Output

555

Note

In the first case, <image>

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
template <typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val) {
  std::fill((T *)array, (T *)(array + N), val);
}
template <class T>
inline bool chmax(T &a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
inline bool chmin(T &a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
string p[] = {"", "2", "3", "322", "5", "53", "7", "7222", "7332"};
int main() {
  int n;
  cin >> n;
  string s;
  cin >> s;
  string res;
  for (int i = 0; i < (int)(n); ++i) {
    if (s[i] == '0') continue;
    res += p[s[i] - '1'];
  }
  sort(res.rbegin(), res.rend());
  cout << res << endl;
  return 0;
}

```


### Prompt

Construct a Cpp code solution to the problem outlined:

Polycarp is preparing the first programming contest for robots. There are n problems in it, and a lot of robots are going to participate in it. Each robot solving the problem i gets p_i points, and the score of each robot in the competition is calculated as the sum of p_i over all problems i solved by it. For each problem, p_i is an integer not less than 1.

Two corporations specializing in problem-solving robot manufacturing, "Robo-Coder Inc." and "BionicSolver Industries", are going to register two robots (one for each corporation) for participation as well. Polycarp knows the advantages and flaws of robots produced by these companies, so, for each problem, he knows precisely whether each robot will solve it during the competition. Knowing this, he can try predicting the results — or manipulating them.

For some reason (which absolutely cannot involve bribing), Polycarp wants the "Robo-Coder Inc." robot to outperform the "BionicSolver Industries" robot in the competition. Polycarp wants to set the values of p_i in such a way that the "Robo-Coder Inc." robot gets strictly more points than the "BionicSolver Industries" robot. However, if the values of p_i will be large, it may look very suspicious — so Polycarp wants to minimize the maximum value of p_i over all problems. Can you help Polycarp to determine the minimum possible upper bound on the number of points given for solving the problems?

Input

The first line contains one integer n (1 ≤ n ≤ 100) — the number of problems.

The second line contains n integers r_1, r_2, ..., r_n (0 ≤ r_i ≤ 1). r_i = 1 means that the "Robo-Coder Inc." robot will solve the i-th problem, r_i = 0 means that it won't solve the i-th problem.

The third line contains n integers b_1, b_2, ..., b_n (0 ≤ b_i ≤ 1). b_i = 1 means that the "BionicSolver Industries" robot will solve the i-th problem, b_i = 0 means that it won't solve the i-th problem.

Output

If "Robo-Coder Inc." robot cannot outperform the "BionicSolver Industries" robot by any means, print one integer -1.

Otherwise, print the minimum possible value of max _{i = 1}^{n} p_i, if all values of p_i are set in such a way that the "Robo-Coder Inc." robot gets strictly more points than the "BionicSolver Industries" robot.

Examples

Input

5
1 1 1 0 0
0 1 1 1 1

Output

3

Input

3
0 0 0
0 0 0

Output

-1

Input

4
1 1 1 1
1 1 1 1

Output

-1

Input

9
1 0 0 0 0 0 0 0 1
0 1 1 0 1 1 1 1 0

Output

4

Note

In the first example, one of the valid score assignments is p = [3, 1, 3, 1, 1]. Then the "Robo-Coder" gets 7 points, the "BionicSolver" — 6 points.

In the second example, both robots get 0 points, and the score distribution does not matter.

In the third example, both robots solve all problems, so their points are equal.

### Response

```cpp
#include <bits/stdc++.h>
const int mod = 1e9 + 7;
using namespace std;
template <typename T>
inline void read(T& x) {
  char c;
  bool nega = 0;
  while ((!isdigit(c = getchar())) && c != '-')
    ;
  if (c == '-') {
    c = getchar();
    nega = 1;
  }
  x = c - 48;
  while (isdigit(c = getchar())) {
    x = x * 10 + c - 48;
  }
  if (nega) x = -x;
}
template <typename T>
void Write(T x) {
  if (x > 9) Write(x / 10);
  putchar(x % 10 + 48);
}
template <typename T>
void write(T x) {
  if (x < 0) {
    putchar('-');
    x = -x;
  }
  Write(x);
}
int n, a[5010], b[5010];
int main() {
  read(n);
  for (int i = 1; i <= n; i++) read(a[i]);
  for (int i = 1; i <= n; i++) read(b[i]);
  int cnt = 0, cnt1 = 0, cnta = 0;
  for (int i = 1; i <= n; i++)
    if (a[i] == 1 && b[i] == 0) cnt++;
  for (int i = 1; i <= n; i++)
    if (b[i]) {
      cnt1++;
      if (a[i]) cnta++;
    }
  if (cnt == 0)
    write(-1);
  else
    write(((cnt1 - cnta) + cnt) / cnt);
}

```


### Prompt

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

A map of some object is a rectangular field consisting of n rows and n columns. Each cell is initially occupied by the sea but you can cover some some cells of the map with sand so that exactly k islands appear on the map. We will call a set of sand cells to be island if it is possible to get from each of them to each of them by moving only through sand cells and by moving from a cell only to a side-adjacent cell. The cells are called to be side-adjacent if they share a vertical or horizontal side. It is easy to see that islands do not share cells (otherwise they together form a bigger island).

Find a way to cover some cells with sand so that exactly k islands appear on the n × n map, or determine that no such way exists.

Input

The single line contains two positive integers n, k (1 ≤ n ≤ 100, 0 ≤ k ≤ n2) — the size of the map and the number of islands you should form.

Output

If the answer doesn't exist, print "NO" (without the quotes) in a single line.

Otherwise, print "YES" in the first line. In the next n lines print the description of the map. Each of the lines of the description must consist only of characters 'S' and 'L', where 'S' is a cell that is occupied by the sea and 'L' is the cell covered with sand. The length of each line of the description must equal n.

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

You should not maximize the sizes of islands.

Examples

Input

5 2

Output

YES
SSSSS
LLLLL
SSSSS
LLLLL
SSSSS

Input

5 25

Output

NO

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
bool sorts(pair<int, double> a, pair<int, double> b) {
  if (a.second == b.second)
    return a.first > b.first;
  else
    return a.second < b.second;
}
double dist(double a, double b, double c, double d) {
  double dist = sqrt(fabs(a - c) * fabs(a - c) + fabs(b - d) * fabs(b - d));
  return dist;
}
int gcd(int a, int b) {
  if (b == 0)
    return a;
  else
    return gcd(b, a % b);
}
int main() {
  int n, k;
  cin >> n >> k;
  if (k > ceil((double)n * n / 2.0))
    cout << "NO";
  else {
    cout << "YES" << endl;
    if (n % 2) {
      bool land = true;
      for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
          if (land && k != 0) {
            cout << "L";
            land = false;
            k--;
          } else {
            cout << "S";
            land = true;
          }
        }
        cout << "\n";
      }
    } else {
      bool land = true;
      for (int i = 0; i < n; i++) {
        if (i % 2 == 0)
          land = true;
        else
          land = false;
        for (int j = 0; j < n; j++) {
          if (land && k != 0) {
            cout << "L";
            land = false;
            k--;
          } else {
            cout << "S";
            land = true;
          }
        }
        cout << "\n";
      }
    }
  }
}

```


### Prompt

Create a solution in Cpp for the following problem:

Most C/C++ programmers know about excellent opportunities that preprocessor #define directives give; but many know as well about the problems that can arise because of their careless use.

In this problem we consider the following model of #define constructions (also called macros). Each macro has its name and value. The generic syntax for declaring a macro is the following:

#define macro_name macro_value

After the macro has been declared, "macro_name" is replaced with "macro_value" each time it is met in the program (only the whole tokens can be replaced; i.e. "macro_name" is replaced only when it is surrounded by spaces or other non-alphabetic symbol). A "macro_value" within our model can only be an arithmetic expression consisting of variables, four arithmetic operations, brackets, and also the names of previously declared macros (in this case replacement is performed sequentially). The process of replacing macros with their values is called substitution.

One of the main problems arising while using macros — the situation when as a result of substitution we get an arithmetic expression with the changed order of calculation because of different priorities of the operations.

Let's consider the following example. Say, we declared such a #define construction:

#define sum x + y

and further in the program the expression "2 * sum" is calculated. After macro substitution is performed we get "2 * x + y", instead of intuitively expected "2 * (x + y)".

Let's call the situation "suspicious", if after the macro substitution the order of calculation changes, falling outside the bounds of some macro. Thus, your task is to find out by the given set of #define definitions and the given expression if this expression is suspicious or not.

Let's speak more formally. We should perform an ordinary macros substitution in the given expression. Moreover, we should perform a "safe" macros substitution in the expression, putting in brackets each macro value; after this, guided by arithmetic rules of brackets expansion, we can omit some of the brackets. If there exist a way to get an expression, absolutely coinciding with the expression that is the result of an ordinary substitution (character-by-character, but ignoring spaces), then this expression and the macros system are called correct, otherwise — suspicious.

Note that we consider the "/" operation as the usual mathematical division, not the integer division like in C/C++. That's why, for example, in the expression "a*(b/c)" we can omit brackets to get the expression "a*b/c".

Input

The first line contains the only number n (0 ≤ n ≤ 100) — the amount of #define constructions in the given program.

Then there follow n lines, each of them contains just one #define construction. Each construction has the following syntax:

#define name expression

where

  * name — the macro name,
  * expression — the expression with which the given macro will be replaced. An expression is a non-empty string, containing digits,names of variables, names of previously declared macros, round brackets and operational signs +-*/. It is guaranteed that the expression (before and after macros substitution) is a correct arithmetic expression, having no unary operations. The expression contains only non-negative integers, not exceeding 109.

All the names (#define constructions' names and names of their arguments) are strings of case-sensitive Latin characters. It is guaranteed that the name of any variable is different from any #define construction.

Then, the last line contains an expression that you are to check. This expression is non-empty and satisfies the same limitations as the expressions in #define constructions.

The input lines may contain any number of spaces anywhere, providing these spaces do not break the word "define" or the names of constructions and variables. In particular, there can be any number of spaces before and after the "#" symbol.

The length of any line from the input file does not exceed 100 characters.

Output

Output "OK", if the expression is correct according to the above given criterion, otherwise output "Suspicious".

Examples

Input

1
#define sum x + y
1 * sum

Output

Suspicious

Input

1
#define sum  (x + y)
sum - sum

Output

OK

Input

4
#define sum  x + y
#define mul  a * b
#define div  a / b
#define expr sum + mul * div * mul
expr

Output

OK

Input

3
#define SumSafe   (a+b)
#define DivUnsafe  a/b
#define DenominatorUnsafe  a*b
((SumSafe) + DivUnsafe/DivUnsafe + x/DenominatorUnsafe)

Output

Suspicious

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
unordered_map<string, int> mp;
int check(string s, int l, int r) {
  int num = 0, flag = 0;
  for (int i = r; i >= l; --i) {
    if (s[i] == '(')
      num++;
    else if (s[i] == ')')
      num--;
    else if (!num && !flag && (s[i] == '*' || s[i] == '/'))
      flag = i;
    else if (!num && (s[i] == '+' || s[i] == '-')) {
      int x = check(s, l, i - 1), y = check(s, i + 1, r);
      if (x == 2 || y == 2)
        return 2;
      else if (s[i] == '+')
        return 3;
      else if (s[i] == '-') {
        if (y == 3)
          return 2;
        else
          return 3;
      }
    }
  }
  if (flag) {
    int x = check(s, l, flag - 1), y = check(s, flag + 1, r);
    if (x == 2 || y == 2) return 2;
    if (s[flag] == '*') {
      if (x == 3 || y == 3)
        return 2;
      else
        return 4;
    } else {
      if (x == 3 || y == 3 || y == 4)
        return 2;
      else
        return 4;
    }
  }
  if (s[l] == '(' && s[r] == ')')
    return check(s, l + 1, r - 1) == 2 ? 2 : 1;
  else {
    string t = s.substr(l, r - l + 1);
    if (mp.count(t)) return mp[t];
  }
}
void erase_space(string& s) {
  for (int i = 0; i < s.size(); ++i) {
    if (s[i] == ' ') {
      s.erase(i, 1);
      i--;
    }
  }
}
int main() {
  int nums;
  for (cin >> nums; nums--;) {
    while (cin.get() != '#')
      ;
    string a, s;
    cin >> a >> a;
    getline(cin, s);
    erase_space(s);
    int opt = check(s, 0, s.size() - 1);
    mp[a] = opt;
  }
  string s;
  getline(cin, s);
  erase_space(s);
  if (check(s, 0, s.length() - 1) != 2)
    cout << "OK\n";
  else
    cout << "Suspicious\n";
  return 0;
}

```