### Prompt

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

At University A, there were many mistakes in entering IDs.
Therefore, University A decided to issue a new ID to prevent typos.
There is a way to check if the new ID is correct to prevent typos.

・ Calculate the sum of all digits.
・ However, the number of even-numbered digits is doubled, with the rightmost digit as the first digit.
-When the number becomes 10 or more by doubling, the number obtained by adding the 1st digit and the 10th digit is used as the digit number.
・ If the sum is divisible by 10, the ID is correct, otherwise it is incorrect.

As an example, check the ID 53579.
Since the sum of all digits is calculated,
5 + 3 + 5 + 7 + 9

However, since the number of even-numbered digits is doubled,
5 + 6 + 5 + 14 + 9

When the number becomes 10 or more by doubling, the number obtained by adding the ones digit and the tens digit is the digit number.
5 + 6 + 5 + (1 + 4) + 9

From the above, the total sum is 30. Since 30 is divisible by 10, 53579 is the correct ID.

Mr. B is a college student at University A and was issued a new ID, but he forgot some digits of the ID.
However, I succeeded in narrowing down some candidates as to what kind of numbers will be included in the forgotten part.
Your job is to find out how many correct combinations of B's IDs are available.

Input

The input is given in the following format.

n
ID
m
a0 a1 ... am-1

n is the number of digits in the ID.
Each digit of the ID contains a number from 0 to 9 or the letter'*' to indicate that it is a forgotten digit.
m is the number of candidate numbers in the'*'.
ai is a candidate for numbers in'*'.

Input meets the following constraints
1 ≤ n ≤ 100,000
1 ≤ m ≤ 10
0 ≤ ai ≤ 9
Number of 1 ≤'*' ≤ 7

Output

Output the answer value on one line

Examples

Input

5
5*57*
2
3 9

Output

1

Input

15
2***9*2*6*1199*
9
0 1 2 3 4 6 7 8 9

Output

478297

### Response

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

using namespace std;

int n, m, *id, *a, result = 0, known = 0;
vector<int> undefined;
bool isCollectID(void) {
  int sum = 0;
  for (int i = 0; i < undefined.size(); i++) {
    int j = undefined[i];
    if ((n + j) % 2)
      sum += id[j];
    else
      sum += id[j] * 2 >= 10 ? id[j] * 2 - 9 : id[j] * 2;
  }
  return (known + sum) % 10 == 0;
}

void searchCadidate(int i) {
  if (i == undefined.size()) {
      if (isCollectID())
        result++;
  } else {
    /*
    for (int j = 0; j < n; j++)
      if (id[j] > 0)
        cout << id[j];
      else
        cout << '*';
    cout << endl;
    */
    for (int j = 0; j < m; j++) {
      id[undefined[i]] = a[j];
      searchCadidate(i + 1);
    }
  }
}

int main(int argc, char *argv[]) {
  string s;
  cin >> n;
  cin >> s;
  cin >> m;
  a = new int[m];
  for (int i = 0; i < m; i++)
    cin >> a[i];
  id = new int[n];
  for (int i = 0; i < n; i++)
    if (s[i] == '*') {
      id[i] = -1;// test
      undefined.push_back(i);
    } else {
      id[i] = s[i] - '0';
      if ((n + i) % 2)
        known += s[i] - '0';
      else
        known += id[i] * 2 >= 10 ? id[i] * 2 - 9 : id[i] * 2;
    }

  searchCadidate(0);

  cout << result << endl;
  return 0;
}
```


### Prompt

Generate a CPP solution to the following problem:

To become the king of Codeforces, Kuroni has to solve the following problem.

He is given n numbers a_1, a_2, ..., a_n. Help Kuroni to calculate ∏_{1≤ i<j≤ n} |a_i - a_j|. As result can be very big, output it modulo m.

If you are not familiar with short notation, ∏_{1≤ i<j≤ n} |a_i - a_j| is equal to |a_1 - a_2|⋅|a_1 - a_3|⋅ ... ⋅|a_1 - a_n|⋅|a_2 - a_3|⋅|a_2 - a_4|⋅ ... ⋅|a_2 - a_n| ⋅ ... ⋅ |a_{n-1} - a_n|. In other words, this is the product of |a_i - a_j| for all 1≤ i < j ≤ n.

Input

The first line contains two integers n, m (2≤ n ≤ 2⋅ 10^5, 1≤ m ≤ 1000) — number of numbers and modulo.

The second line contains n integers a_1, a_2, ..., a_n (0 ≤ a_i ≤ 10^9).

Output

Output the single number — ∏_{1≤ i<j≤ n} |a_i - a_j| mod m.

Examples

Input

2 10
8 5

Output

3

Input

3 12
1 4 5

Output

0

Input

3 7
1 4 9

Output

1

Note

In the first sample, |8 - 5| = 3 ≡ 3 mod 10.

In the second sample, |1 - 4|⋅|1 - 5|⋅|4 - 5| = 3⋅ 4 ⋅ 1 = 12 ≡ 0 mod 12.

In the third sample, |1 - 4|⋅|1 - 9|⋅|4 - 9| = 3 ⋅ 8 ⋅ 5 = 120 ≡ 1 mod 7.

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, m, i, j, k, a, b, c = 1, p = 1;
  map<long long, long long> mp;
  vector<long long> v;
  scanf("%lld %lld", &n, &m);
  for (i = 0; i < n; i++) {
    scanf("%lld", &a);
    b = a % m;
    if (mp[b] == 1) c = 0;
    v.push_back(a);
    mp[b] = 1;
  }
  if (c == 0)
    printf("0\n");
  else {
    k = v.size();
    for (i = 0; i < k - 1; i++) {
      for (j = i + 1; j < k; j++) {
        p = (p * abs(v[i] - v[j])) % m;
      }
    }
    printf("%lld\n", p);
  }
  return 0;
}

```


### Prompt

Please formulate a cpp solution to the following problem:

Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.

Petya recently learned to determine whether a string of lowercase Latin letters is lucky. For each individual letter all its positions in the string are written out in the increasing order. This results in 26 lists of numbers; some of them can be empty. A string is considered lucky if and only if in each list the absolute difference of any two adjacent numbers is a lucky number.

For example, let's consider string "zbcdzefdzc". The lists of positions of equal letters are:

  * b: 2
  * c: 3, 10
  * d: 4, 8
  * e: 6
  * f: 7
  * z: 1, 5, 9
  * Lists of positions of letters a, g, h, ..., y are empty.

This string is lucky as all differences are lucky numbers. For letters z: 5 - 1 = 4, 9 - 5 = 4, for letters c: 10 - 3 = 7, for letters d: 8 - 4 = 4.

Note that if some letter occurs only once in a string, it doesn't influence the string's luckiness after building the lists of positions of equal letters. The string where all the letters are distinct is considered lucky.

Find the lexicographically minimal lucky string whose length equals n.

Input

The single line contains a positive integer n (1 ≤ n ≤ 105) — the length of the sought string.

Output

Print on the single line the lexicographically minimal lucky string whose length equals n.

Examples

Input

5

Output

abcda

Input

3

Output

abc

Note

The lexical comparison of strings is performed by the < operator in modern programming languages. String a is lexicographically less than string b if exists such i (1 ≤ i ≤ n), that ai < bi, and for any j (1 ≤ j < i) aj = bj.

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
const int OO = (int)1e6;
const double EPS = (1e-11);
int dcmp(double x, double y) { return fabs(x - y) <= EPS ? 0 : x < y ? -1 : 1; }
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < (int)(n); ++i) {
    cout << (char)('a' + (i % 4));
  }
  return 0;
}

```


### Prompt

Construct a CPP code solution to the problem outlined:

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

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

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

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

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

Input

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

Output

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

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

Examples

Input

1
-1

Output

0

Input

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

Output

18 18 0

Input

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

Output

128 180 148 160

Note

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

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
long long b[200][200], cnt, c[200][200], ans[200], n, po, a[200][200][70], m;
int main() {
  cin >> n;
  for (long long i = 1; i <= n; i++) {
    for (long long j = 1; j <= n; j++) {
      cin >> b[i][j];
      if (i != j) {
        cnt = 0;
        long long cur = b[i][j];
        while (cur != 0) {
          a[i][j][cnt++] = cur % 2;
          cur /= 2;
        }
      }
    }
  }
  for (long long i = 1; i <= n; i++) {
    for (long long j = 1; j <= n; j++) {
      if (i != j) {
        for (long long k = 0; k <= 50; k++) {
          if (a[i][j][k] == 1) {
            c[i][k] = 1;
            c[j][k] = 1;
          }
        }
      }
    }
  }
  for (long long i = 1; i <= n; i++) {
    po = 1;
    for (long long j = 0; j <= 50; j++) {
      ans[i] += c[i][j] * po;
      po *= 2;
    }
    cout << ans[i] << ' ';
  }
}

```


### Prompt

Develop a solution in cpp to the problem described below:

The Berland Kingdom is a set of n cities connected with each other with n - 1 railways. Each road connects exactly two different cities. The capital is located in city 1. For each city there is a way to get from there to the capital by rail.

In the i-th city there is a soldier division number i, each division is characterized by a number of ai. It represents the priority, the smaller the number, the higher the priority of this division. All values of ai are different.

One day the Berland King Berl Great declared a general mobilization, and for that, each division should arrive in the capital. Every day from every city except the capital a train departs. So there are exactly n - 1 departing trains each day. Each train moves toward the capital and finishes movement on the opposite endpoint of the railway on the next day. It has some finite capacity of cj, expressed in the maximum number of divisions, which this train can transport in one go. Each train moves in the direction of reducing the distance to the capital. So each train passes exactly one railway moving from a city to the neighboring (where it stops) toward the capital.

In the first place among the divisions that are in the city, division with the smallest number of ai get on the train, then with the next smallest and so on, until either the train is full or all the divisions are be loaded. So it is possible for a division to stay in a city for a several days.

The duration of train's progress from one city to another is always equal to 1 day. All divisions start moving at the same time and end up in the capital, from where they don't go anywhere else any more. Each division moves along a simple path from its city to the capital, regardless of how much time this journey will take.

Your goal is to find for each division, in how many days it will arrive to the capital of Berland. The countdown begins from day 0.

Input

The first line contains the single integer n (1 ≤ n ≤ 5000). It is the number of cities in Berland. The second line contains n space-separated integers a1, a2, ..., an, where ai represents the priority of the division, located in the city number i. All numbers a1, a2, ..., an are different (1 ≤ ai ≤ 109). Then n - 1 lines contain the descriptions of the railway roads. Each description consists of three integers vj, uj, cj, where vj, uj are number of cities connected by the j-th rail, and cj stands for the maximum capacity of a train riding on this road (1 ≤ vj, uj ≤ n, vj ≠ uj, 1 ≤ cj ≤ n).

Output

Print sequence t1, t2, ..., tn, where ti stands for the number of days it takes for the division of city i to arrive to the capital. Separate numbers with spaces.

Examples

Input

4
40 10 30 20
1 2 1
2 3 1
4 2 1

Output

0 1 3 2

Input

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

Output

0 1 4 2 3

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
const int MM = 5e3 + 5, MOD = 1e9 + 7;
int N, p[MM], ans[MM], d;
priority_queue<pair<int, int>, vector<pair<int, int>>, greater<pair<int, int>>>
    pq[MM];
vector<pair<int, int>> adj[MM];
void dfs(int u, int pa, int cap) {
  int cnt = 0;
  while (!pq[u].empty() && cnt++ < cap) {
    pq[pa].push(pq[u].top());
    if (pa == 0) ans[pq[u].top().second] = d;
    pq[u].pop();
  }
  for (pair<int, int> e : adj[u]) {
    int v = e.first, c = e.second;
    if (v == pa) continue;
    dfs(v, u, c);
  }
}
int main() {
  cin.tie(nullptr)->sync_with_stdio(false);
  cin >> N;
  for (int i = 1; i <= N; i++) cin >> p[i], pq[i].push({p[i], i});
  for (int i = 1, u, v, w; i < N; i++) {
    cin >> u >> v >> w;
    adj[u].push_back({v, w});
    adj[v].push_back({u, w});
  }
  while (pq[0].size() != N) dfs(1, 0, 1e9), d++;
  for (int i = 1; i <= N; i++) cout << ans[i] << (i == N ? "\n" : " ");
}

```


### Prompt

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

Let's call an undirected graph of n vertices p-interesting, if the following conditions fulfill:

  * the graph contains exactly 2n + p edges;
  * the graph doesn't contain self-loops and multiple edges;
  * for any integer k (1 ≤ k ≤ n), any subgraph consisting of k vertices contains at most 2k + p edges.

A subgraph of a graph is some set of the graph vertices and some set of the graph edges. At that, the set of edges must meet the condition: both ends of each edge from the set must belong to the chosen set of vertices.

Your task is to find a p-interesting graph consisting of n vertices.

Input

The first line contains a single integer t (1 ≤ t ≤ 5) — the number of tests in the input. Next t lines each contains two space-separated integers: n, p (5 ≤ n ≤ 24; p ≥ 0; <image>) — the number of vertices in the graph and the interest value for the appropriate test.

It is guaranteed that the required graph exists.

Output

For each of the t tests print 2n + p lines containing the description of the edges of a p-interesting graph: the i-th line must contain two space-separated integers ai, bi (1 ≤ ai, bi ≤ n; ai ≠ bi) — two vertices, connected by an edge in the resulting graph. Consider the graph vertices numbered with integers from 1 to n.

Print the answers to the tests in the order the tests occur in the input. If there are multiple solutions, you can print any of them.

Examples

Input

1
6 0

Output

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

### Response

```cpp
#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:102400000,102400000")
using namespace std;
const int inf = 1e9 + 7;
const long long linf = 1e18;
const double pi = acos(-1.0);
int main() {
  ios::sync_with_stdio(false);
  int t;
  cin >> t;
  for (int total = 0; total < t; total++) {
    int n, p;
    cin >> n >> p;
    for (int temp = 0; temp < 2 * n + p;) {
      for (int i = 1; i <= n; i++) {
        if (temp == 2 * n + p) break;
        for (int j = i + 1; j <= n; j++) {
          temp++;
          cout << i << ' ' << j << endl;
          if (temp == 2 * n + p) break;
        }
      }
    }
  }
  return 0;
}

```


### Prompt

Construct a Cpp code solution to the problem outlined:

You are given two integers a and b.

In one move, you can choose some integer k from 1 to 10 and add it to a or subtract it from a. In other words, you choose an integer k ∈ [1; 10] and perform a := a + k or a := a - k. You may use different values of k in different moves.

Your task is to find the minimum number of moves required to obtain b from a.

You have to answer t independent test cases.

Input

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

The only line of the test case contains two integers a and b (1 ≤ a, b ≤ 10^9).

Output

For each test case, print the answer: the minimum number of moves required to obtain b from a.

Example

Input

6
5 5
13 42
18 4
1337 420
123456789 1000000000
100500 9000

Output

0
3
2
92
87654322
9150

Note

In the first test case of the example, you don't need to do anything.

In the second test case of the example, the following sequence of moves can be applied: 13 → 23 → 32 → 42 (add 10, add 9, add 10).

In the third test case of the example, the following sequence of moves can be applied: 18 → 10 → 4 (subtract 8, subtract 6).

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL), cout.tie(NULL);
  int t;
  cin >> t;
  while (t--) {
    long long int a, b;
    cin >> a >> b;
    if (a == b) cout << "0" << endl;
    if (b > a && (b - a) % 2 == 1) cout << "1" << endl;
    if (b > a && (b - a) % 2 == 0) cout << "2" << endl;
    if (a > b && (a - b) % 2 == 0) cout << "1" << endl;
    if (a > b && (a - b) % 2 == 1) cout << "2" << endl;
  }
  return 0;
}

```


### Prompt

Construct a Cpp code solution to the problem outlined:

You are given an undirected graph with N vertices and M edges. Here, N-1≤M≤N holds and the graph is connected. There are no self-loops or multiple edges in this graph.

The vertices are numbered 1 through N, and the edges are numbered 1 through M. Edge i connects vertices a_i and b_i.

The color of each vertex can be either white or black. Initially, all the vertices are white. Snuke is trying to turn all the vertices black by performing the following operation some number of times:

* Select a pair of adjacent vertices with the same color, and invert the colors of those vertices. That is, if the vertices are both white, then turn them black, and vice versa.

Determine if it is possible to turn all the vertices black. If the answer is positive, find the minimum number of times the operation needs to be performed in order to achieve the objective.

Constraints

* 2≤N≤10^5
* N-1≤M≤N
* 1≤a_i,b_i≤N
* There are no self-loops or multiple edges in the given graph.
* The given graph is connected.

Input

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

N M
a_1 b_1
a_2 b_2
:
a_M b_M

Output

If it is possible to turn all the vertices black, print the minimum number of times the operation needs to be performed in order to achieve the objective. Otherwise, print `-1` instead.

Examples

Input

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

Output

5

Input

3 2
1 2
2 3

Output

-1

Input

4 4
1 2
2 3
3 4
4 1

Output

2

Input

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

Output

7

### Response

```cpp
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cmath>

using namespace std;

const int N=100010;

int n,m,cnt=1,G[N],c[N],ic[N],dfn[N],dpt[N];
struct edge{
  int t,nx;
}E[N<<2];

inline void addedge(int x,int y){
  E[++cnt].t=y; E[cnt].nx=G[x]; G[x]=cnt;
  E[++cnt].t=x; E[cnt].nx=G[y]; G[y]=cnt;
}

int prty,u,v;

void dfs(int x,int cc){
  c[x]=cc;
  for(int i=G[x];i;i=E[i].nx){
    if(!c[E[i].t]) dfs(E[i].t,3-cc);
    if(c[E[i].t]==c[x]) prty=1,u=x,v=E[i].t;
  }
}

int ans,a[N];

int dfs1(int x,int f){
  int ret=a[x];
  for(int i=G[x];i;i=E[i].nx)
    if(E[i].t!=f && c[E[i].t]!=c[x]) ret+=dfs1(E[i].t,x);
  ans+=abs(ret);
  return ret;
}

int k[N],Q[N],t,ct;

int dfs2(int x,int f){
  int ret=a[x];
  for(int i=G[x];i;i=E[i].nx)
    if(E[i].t!=f && i!=ct && (i^1)!=ct){
      ret+=dfs2(E[i].t,x);
      k[x]+=k[E[i].t];
    }
  if(k[x]){
    if(k[x]<0) Q[++t]=-ret;
    else Q[++t]=ret;
  }
  else ans+=abs(ret);
  return ret;
}

int vis[N];

void dfs3(int x,int f){
  vis[x]=1;
  for(int i=G[x];i;i=E[i].nx){
    if(E[i].t==f) continue;
    if(!vis[E[i].t]) dfs3(E[i].t,x);
    else u=x,v=E[i].t,ct=i;
  }
}

int main(){
  scanf("%d%d",&n,&m);
  for(int i=1,x,y;i<=m;i++)
    scanf("%d%d",&x,&y),addedge(x,y);
  dfs(1,1); int num=0;
  for(int i=1;i<=n;i++)
    if(c[i]==2) num++,a[i]=1; else num--,a[i]=-1;
  if(n-1==m){
    if(num) puts("-1");
    else{
      dfs1(1,0); printf("%d\n",ans);
    }
  }
  else{
    if(prty){
      if(num&1) puts("-1");
      else{
	a[u]-=num/2; a[v]-=num/2;
	dfs1(1,0); printf("%d\n",ans+abs(num/2));
      }
    }
    else{
      if(num) puts("-1");
      else{
	dfs3(1,0);
	k[u]=1; k[v]=-1;
	dfs2(1,0); Q[++t]=0;
	sort(Q+1,Q+1+t);
	int cur=Q[t/2];
	for(int i=1;i<=t;i++) ans+=abs(cur-Q[i]);
	printf("%d\n",ans);
      }
    }
  }
  return 0;
}

```


### Prompt

Create a solution in Cpp for the following problem:

You are given an array a_1, a_2, …, a_n of integers. This array is non-increasing.

Let's consider a line with n shops. The shops are numbered with integers from 1 to n from left to right. The cost of a meal in the i-th shop is equal to a_i.

You should process q queries of two types:

  * 1 x y: for each shop 1 ≤ i ≤ x set a_{i} = max(a_{i}, y).
  * 2 x y: let's consider a hungry man with y money. He visits the shops from x-th shop to n-th and if he can buy a meal in the current shop he buys one item of it. Find how many meals he will purchase. The man can buy a meal in the shop i if he has at least a_i money, and after it his money decreases by a_i.

Input

The first line contains two integers n, q (1 ≤ n, q ≤ 2 ⋅ 10^5).

The second line contains n integers a_{1},a_{2}, …, a_{n} (1 ≤ a_{i} ≤ 10^9) — the costs of the meals. It is guaranteed, that a_1 ≥ a_2 ≥ … ≥ a_n.

Each of the next q lines contains three integers t, x, y (1 ≤ t ≤ 2, 1≤ x ≤ n, 1 ≤ y ≤ 10^9), each describing the next query.

It is guaranteed that there exists at least one query of type 2.

Output

For each query of type 2 output the answer on the new line.

Example

Input

10 6
10 10 10 6 6 5 5 5 3 1
2 3 50
2 4 10
1 3 10
2 2 36
1 4 7
2 2 17

Output

8
3
6
2

Note

In the first query a hungry man will buy meals in all shops from 3 to 10.

In the second query a hungry man will buy meals in shops 4, 9, and 10.

After the third query the array a_1, a_2, …, a_n of costs won't change and will be \{10, 10, 10, 6, 6, 5, 5, 5, 3, 1\}.

In the fourth query a hungry man will buy meals in shops 2, 3, 4, 5, 9, and 10.

After the fifth query the array a of costs will be \{10, 10, 10, 7, 6, 5, 5, 5, 3, 1\}.

In the sixth query a hungry man will buy meals in shops 2 and 4.

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
long long n, q, a[200005];
struct nod {
  long long mi, mx, s, lazy;
} tr[200005 << 2];
void pushup(long long now, long long l, long long r) {
  tr[now].mx = max(tr[(now << 1)].mx, tr[((now << 1) | 1)].mx);
  tr[now].mi = min(tr[(now << 1)].mi, tr[((now << 1) | 1)].mi);
  tr[now].s = tr[(now << 1)].s + tr[((now << 1) | 1)].s;
}
void mdf(long long now, long long l, long long r, long long v) {
  tr[now].mx = tr[now].mi = v;
  tr[now].s = (r - l + 1) * v;
  tr[now].lazy = v;
}
void pushdown(long long now, long long l, long long r) {
  if (l == r) return;
  long long mid = (l + r) >> 1;
  if (tr[now].lazy) {
    tr[(now << 1)].mx = tr[((now << 1) | 1)].mx = tr[(now << 1)].mi =
        tr[((now << 1) | 1)].mi = tr[now].lazy;
    tr[(now << 1)].s = (mid - l + 1) * tr[now].lazy;
    tr[((now << 1) | 1)].s = (r - mid) * tr[now].lazy;
    tr[(now << 1)].lazy = tr[((now << 1) | 1)].lazy = tr[now].lazy;
    tr[now].lazy = 0;
  }
  pushup(now, l, r);
}
void ins(long long now, long long l, long long r, long long x, long long y,
         long long v) {
  if (tr[now].lazy) pushdown(now, l, r);
  if (x <= l && r <= y) {
    mdf(now, l, r, v);
    return;
  }
  long long mid = (l + r) >> 1;
  if (x <= mid) ins((now << 1), l, mid, x, y, v);
  if (y > mid) ins(((now << 1) | 1), mid + 1, r, x, y, v);
  pushup(now, l, r);
}
long long query(long long now, long long l, long long r, long long k) {
  if (tr[1].mi > k) return n + 1;
  if (tr[now].lazy) pushdown(now, l, r);
  if (l == r) return l;
  long long mid = (l + r) >> 1;
  if (tr[(now << 1)].mi <= k) return query((now << 1), l, mid, k);
  return query(((now << 1) | 1), mid + 1, r, k);
}
long long flag, sum, cnt;
long long solve(long long now, long long l, long long r, long long x) {
  if (tr[now].lazy) pushdown(now, l, r);
  if (!flag && l == r && x == l) flag = 1;
  if (l == r) {
    if (flag == 1 && sum >= tr[now].s) {
      sum -= tr[now].s;
      cnt++;
      return 1;
    }
    return 0;
  }
  long long mid = (l + r) >> 1;
  if (flag == 0) {
    if (x <= mid) {
      long long adc = solve((now << 1), l, mid, x);
      if (adc == 1) adc = solve(((now << 1) | 1), mid + 1, r, x);
      return adc;
    } else
      return solve(((now << 1) | 1), mid + 1, r, x);
  } else {
    if (sum >= tr[now].s) {
      sum -= tr[now].s, cnt += r - l + 1;
      return 1;
    } else {
      long long adc = solve((now << 1), l, mid, x);
      if (adc == 1) adc = solve(((now << 1) | 1), mid + 1, r, x);
      return adc;
    }
  }
}
signed main() {
  ios::sync_with_stdio(0);
  cin >> n >> q;
  for (long long i = 1, x; i <= n; i++) cin >> a[i], ins(1, 1, n, i, i, a[i]);
  for (long long i = 1, op, x, y; i <= q; i++) {
    cin >> op >> x >> y;
    if (op == 1) {
      long long pos = query(1, 1, n, y);
      if (pos > y)
        continue;
      else
        ins(1, 1, n, pos, x, y);
    } else {
      sum = y, cnt = 0;
      while (sum >= tr[1].mi) {
        flag = 0;
        long long pos = query(1, 1, n, sum);
        if (pos < x) pos = x;
        long long adc = solve(1, 1, n, pos);
        if (adc == 1) break;
      }
      cout << cnt << endl;
    }
  }
}

```


### Prompt

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

Find the number of k-divisible numbers on the segment [a, b]. In other words you need to find the number of such integer values x that a ≤ x ≤ b and x is divisible by k.

Input

The only line contains three space-separated integers k, a and b (1 ≤ k ≤ 1018; - 1018 ≤ a ≤ b ≤ 1018).

Output

Print the required number.

Examples

Input

1 1 10

Output

10

Input

2 -4 4

Output

5

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
const long long N = 2e5 + 30, Mod = 1e9 + 7;
const long long SQ = 330;
int main() {
  ios::sync_with_stdio(0), cin.tie(0);
  long long k, a, b;
  cin >> k >> a >> b;
  long long ans = 0;
  if (0 >= a && 0 <= b) ans++;
  if (a == 0) return cout << ans + b / k, 0;
  if (b == 0) return cout << ans + abs(a) / k, 0;
  if (a < 0 && b > 0) return cout << ans + abs(a) / k + abs(b) / k, 0;
  a = abs(a), b = abs(b);
  if (a > b) swap(a, b);
  cout << ans + b / k - (a - 1) / k;
  return (0);
}

```


### Prompt

Please formulate a CPP solution to the following problem:

Winters are just damn freezing cold in Nvodsk! That's why a group of n friends prefers to take a taxi, order a pizza and call girls. The phone numbers in the city consist of three pairs of digits (for example, 12-34-56). Each friend has a phonebook of size si (that's the number of phone numbers). We know that taxi numbers consist of six identical digits (for example, 22-22-22), the numbers of pizza deliveries should necessarily be decreasing sequences of six different digits (for example, 98-73-21), all other numbers are the girls' numbers.

You are given your friends' phone books. Calculate which friend is best to go to when you are interested in each of those things (who has maximal number of phone numbers of each type).

If the phone book of one person contains some number two times, you should count it twice. That is, each number should be taken into consideration the number of times it occurs in the phone book.

Input

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

Then follow n data blocks that describe each friend's phone books. Each block is presented in the following form: first goes the line that contains integer si and string namei (0 ≤ si ≤ 100) — the number of phone numbers in the phone book of the i-th friend and the name of the i-th friend. The name is a non-empty sequence of uppercase and lowercase Latin letters, containing no more than 20 characters. Next si lines contain numbers as "XX-XX-XX", where X is arbitrary digits from 0 to 9.

Output

In the first line print the phrase "If you want to call a taxi, you should call: ". Then print names of all friends whose phone books contain maximal number of taxi phone numbers.

In the second line print the phrase "If you want to order a pizza, you should call: ". Then print names of all friends who have maximal number of pizza phone numbers.

In the third line print the phrase "If you want to go to a cafe with a wonderful girl, you should call: ". Then print names of all friends who have maximal number of girls' phone numbers.

Print the names in the order in which they are given in the input data. Separate two consecutive names with a comma and a space. Each line should end with exactly one point. For clarifications concerning the output form, see sample tests. It is necessary that you follow the output form strictly. Extra spaces are not allowed.

Examples

Input

4
2 Fedorov
22-22-22
98-76-54
3 Melnikov
75-19-09
23-45-67
99-99-98
7 Rogulenko
22-22-22
11-11-11
33-33-33
44-44-44
55-55-55
66-66-66
95-43-21
3 Kaluzhin
11-11-11
99-99-99
98-65-32

Output

If you want to call a taxi, you should call: Rogulenko.
If you want to order a pizza, you should call: Fedorov, Rogulenko, Kaluzhin.
If you want to go to a cafe with a wonderful girl, you should call: Melnikov.

Input

3
5 Gleb
66-66-66
55-55-55
01-01-01
65-43-21
12-34-56
3 Serega
55-55-55
87-65-43
65-55-21
5 Melnik
12-42-12
87-73-01
36-04-12
88-12-22
82-11-43

Output

If you want to call a taxi, you should call: Gleb.
If you want to order a pizza, you should call: Gleb, Serega.
If you want to go to a cafe with a wonderful girl, you should call: Melnik.

Input

3
3 Kulczynski
22-22-22
65-43-21
98-12-00
4 Pachocki
11-11-11
11-11-11
11-11-11
98-76-54
0 Smietanka

Output

If you want to call a taxi, you should call: Pachocki.
If you want to order a pizza, you should call: Kulczynski, Pachocki.
If you want to go to a cafe with a wonderful girl, you should call: Kulczynski.

Note

In the first sample you are given four friends. Fedorov's phone book contains one taxi number and one pizza delivery number, Melnikov's phone book only has 3 numbers of girls, Rogulenko's one has 6 taxi numbers and one pizza delivery number, Kaluzhin's one contains 2 taxi numbers and one pizza delivery number.

Thus, if you need to order a taxi, you should obviously call Rogulenko, if you need to order a pizza you should call anybody of the following: Rogulenko, Fedorov, Kaluzhin (each of them has one number). Melnikov has maximal number of phone numbers of girls.

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
vector<int> T, P, G;
pair<string, vector<int> > p[100];
string s;
int main() {
  int n, x, cc = 0;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> x >> p[i].first;
    for (int k = 0; k < 3; k++) p[i].second.push_back(0);
    for (int j = 0; j < x; j++) {
      cin >> s;
      if (s[0] == s[1] && s[0] == s[3] && s[0] == s[4] && s[0] == s[6] &&
          s[0] == s[7])
        p[i].second[0]++;
      else if (s[0] > s[1] && s[1] > s[3] && s[3] > s[4] && s[4] > s[6] &&
               s[6] > s[7])
        p[i].second[1]++;
      else
        p[i].second[2]++;
    }
    T.push_back(p[i].second[0]);
    P.push_back(p[i].second[1]);
    G.push_back(p[i].second[2]);
  }
  sort(T.rbegin(), T.rend());
  sort(P.rbegin(), P.rend());
  sort(G.rbegin(), G.rend());
  cout << "If you want to call a taxi, you should call: ";
  for (int i = 0; i < n; i++) {
    if (p[i].second[0] == T[0]) {
      if (cc == 1) cout << ", ";
      cout << p[i].first;
      cc = 1;
    }
  }
  cout << "." << endl;
  cout << "If you want to order a pizza, you should call: ";
  cc = 0;
  for (int i = 0; i < n; i++) {
    if (p[i].second[1] == P[0]) {
      if (cc == 1) cout << ", ";
      cout << p[i].first;
      cc = 1;
    }
  }
  cout << "." << endl;
  cout
      << "If you want to go to a cafe with a wonderful girl, you should call: ";
  cc = 0;
  for (int i = 0; i < n; i++) {
    if (p[i].second[2] == G[0]) {
      if (cc == 1) cout << ", ";
      cout << p[i].first;
      cc = 1;
    }
  }
  cout << "." << endl;
  return 0;
}

```


### Prompt

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

While playing yet another strategy game, Mans has recruited n [Swedish heroes](https://www.youtube.com/watch?v=5sGOwFVUU0I), whose powers which can be represented as an array a.

Unfortunately, not all of those mighty heroes were created as capable as he wanted, so that he decided to do something about it. In order to accomplish his goal, he can pick two consecutive heroes, with powers a_i and a_{i+1}, remove them and insert a hero with power -(a_i+a_{i+1}) back in the same position.

For example if the array contains the elements [5, 6, 7, 8], he can pick 6 and 7 and get [5, -(6+7), 8] = [5, -13, 8].

After he will perform this operation n-1 times, Mans will end up having only one hero. He wants his power to be as big as possible. What's the largest possible power he can achieve?

Input

The first line contains a single integer n (1 ≤ n ≤ 200000).

The second line contains n integers a_1, a_2, …, a_n (-10^9 ≤ a_i ≤ 10^9) — powers of the heroes.

Output

Print the largest possible power he can achieve after n-1 operations.

Examples

Input

4
5 6 7 8

Output

26

Input

5
4 -5 9 -2 1

Output

15

Note

Suitable list of operations for the first sample:

[5, 6, 7, 8] → [-11, 7, 8] → [-11, -15] → [26]

### Response

```cpp
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
constexpr long long mod = 998244353;
const long long INF = mod * mod;
const double eps = 1e-12;
const double pi = acosl(-1.0);
long long mod_pow(long long x, long long n, long long m = mod) {
  if (n < 0) {
    long long res = mod_pow(x, -n, m);
    return mod_pow(res, m - 2, m);
  }
  if (abs(x) >= m) x %= m;
  if (x < 0) x += m;
  long long res = 1;
  while (n) {
    if (n & 1) res = res * x % m;
    x = x * x % m;
    n >>= 1;
  }
  return res;
}
struct modint {
  long long n;
  modint() : n(0) { ; }
  modint(long long m) : n(m) {
    if (n >= mod)
      n %= mod;
    else if (n < 0)
      n = (n % mod + mod) % mod;
  }
  operator int() { return n; }
};
bool operator==(modint a, modint b) { return a.n == b.n; }
modint operator+=(modint& a, modint b) {
  a.n += b.n;
  if (a.n >= mod) a.n -= mod;
  return a;
}
modint operator-=(modint& a, modint b) {
  a.n -= b.n;
  if (a.n < 0) a.n += mod;
  return a;
}
modint operator*=(modint& a, modint b) {
  a.n = ((long long)a.n * b.n) % mod;
  return a;
}
modint operator+(modint a, modint b) { return a += b; }
modint operator-(modint a, modint b) { return a -= b; }
modint operator*(modint a, modint b) { return a *= b; }
modint operator^(modint a, long long n) {
  if (n == 0) return modint(1);
  modint res = (a * a) ^ (n / 2);
  if (n % 2) res = res * a;
  return res;
}
long long inv(long long a, long long p) {
  return (a == 1 ? 1 : (1 - p * inv(p % a, a)) / a + p);
}
modint operator/(modint a, modint b) { return a * modint(inv(b, mod)); }
modint operator/=(modint& a, modint b) {
  a = a / b;
  return a;
}
const int max_n = 1 << 2;
modint fact[max_n], factinv[max_n];
void init_f() {
  fact[0] = modint(1);
  for (int i = 0; i < max_n - 1; i++) {
    fact[i + 1] = fact[i] * modint(i + 1);
  }
  factinv[max_n - 1] = modint(1) / fact[max_n - 1];
  for (int i = max_n - 2; i >= 0; i--) {
    factinv[i] = factinv[i + 1] * modint(i + 1);
  }
}
modint comb(int a, int b) {
  if (a < 0 || b < 0 || a < b) return 0;
  return fact[a] * factinv[b] * factinv[a - b];
}
modint combP(int a, int b) {
  if (a < 0 || b < 0 || a < b) return 0;
  return fact[a] * factinv[a - b];
}
vector<string> s[11];
void expr() {
  s[1] = {"1"};
  for (int i = 2; i <= 10; i++) {
    for (int j = 1; j < i; j++) {
      for (string t : s[j])
        for (string u : s[i - j]) {
          string ad = t + u;
          for (int k = 0; k < ad.size(); k++) ad[k] = '0' + '1' - ad[k];
          s[i].push_back(ad);
        }
    }
    sort((s[i]).begin(), (s[i]).end());
    s[i].erase(unique((s[i]).begin(), (s[i]).end()), s[i].end());
  }
  for (int i = 1; i <= 8; i++) {
    cout << i << " start "
         << "\n";
    for (string t : s[i]) cout << t << "\n";
  }
}
void solve() {
  int n;
  cin >> n;
  vector<long long> a(n);
  for (int i = 0; i < n; i++) cin >> a[i];
  if (n == 1) {
    cout << a[0] << "\n";
    return;
  }
  if (n % 2 == 0) {
    sort((a).begin(), (a).end());
    vector<long long> ra(n + 1);
    for (int i = 0; i < n; i++) ra[i + 1] = ra[i] + a[i];
    int c = (n / 2) % 3;
    c = (c + 2) % 3;
    long long ans = -INF;
    for (int x = c; x <= n; x += 3) {
      long long sum = ra[n] - ra[n - x] - (ra[n - x]);
      ans = max(ans, sum);
    }
    cout << ans << "\n";
  } else {
    vector<pair<long long, long long> > v(n);
    for (int i = 0; i < n; i++) v[i] = {a[i], i};
    sort((v).begin(), (v).end());
    vector<long long> ra(n + 1);
    for (int i = 0; i < n; i++) {
      ra[i + 1] = ra[i] + v[i].first;
    }
    int c = (n + 1) / 2;
    c %= 3;
    long long ans = -INF;
    for (int x = c; x <= n; x += 3) {
      if (x == (n + 1) / 2) {
        bool valid = false;
        for (int j = 0; j < x; j++) {
          if (v[n - 1 - j].second % 2) valid = true;
        }
        if (valid) {
          long long sum = ra[n] - ra[n - x] - (ra[n - x]);
          ans = max(ans, sum);
        } else {
          long long sum = ra[n] - ra[n - x] - (ra[n - x]);
          sum -= 2 * v[n / 2].first;
          sum += 2 * v[n / 2 - 1].first;
          ans = max(ans, sum);
        }
      } else {
        long long sum = ra[n] - ra[n - x] - (ra[n - x]);
        ans = max(ans, sum);
      }
    }
    cout << ans << "\n";
  }
}
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  solve();
  return 0;
}

```


### Prompt

Generate a Cpp solution to the following problem:

You are given n segments on a number line; each endpoint of every segment has integer coordinates. Some segments can degenerate to points. Segments can intersect with each other, be nested in each other or even coincide.

The intersection of a sequence of segments is such a maximal set of points (not necesserily having integer coordinates) that each point lies within every segment from the sequence. If the resulting set isn't empty, then it always forms some continuous segment. The length of the intersection is the length of the resulting segment or 0 in case the intersection is an empty set.

For example, the intersection of segments [1;5] and [3;10] is [3;5] (length 2), the intersection of segments [1;5] and [5;7] is [5;5] (length 0) and the intersection of segments [1;5] and [6;6] is an empty set (length 0).

Your task is to remove exactly one segment from the given sequence in such a way that the intersection of the remaining (n - 1) segments has the maximal possible length.

Input

The first line contains a single integer n (2 ≤ n ≤ 3 ⋅ 10^5) — the number of segments in the sequence.

Each of the next n lines contains two integers l_i and r_i (0 ≤ l_i ≤ r_i ≤ 10^9) — the description of the i-th segment.

Output

Print a single integer — the maximal possible length of the intersection of (n - 1) remaining segments after you remove exactly one segment from the sequence.

Examples

Input

4
1 3
2 6
0 4
3 3

Output

1

Input

5
2 6
1 3
0 4
1 20
0 4

Output

2

Input

3
4 5
1 2
9 20

Output

0

Input

2
3 10
1 5

Output

7

Note

In the first example you should remove the segment [3;3], the intersection will become [2;3] (length 1). Removing any other segment will result in the intersection [3;3] (length 0).

In the second example you should remove the segment [1;3] or segment [2;6], the intersection will become [2;4] (length 2) or [1;3] (length 2), respectively. Removing any other segment will result in the intersection [2;3] (length 1).

In the third example the intersection will become an empty set no matter the segment you remove.

In the fourth example you will get the intersection [3;10] (length 7) if you remove the segment [1;5] or the intersection [1;5] (length 4) if you remove the segment [3;10].

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
const int maxN = 3e5 + 10;
int pf[maxN][2], sf[maxN][2];
int l[maxN], r[maxN];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> l[i] >> r[i];
    if (i == 0)
      pf[i + 1][0] = l[i], pf[i + 1][1] = r[i];
    else {
      pf[i + 1][0] = max(pf[i][0], l[i]);
      pf[i + 1][1] = min(pf[i][1], r[i]);
    }
  }
  for (int i = n - 1; i >= 0; i--) {
    if (i == n - 1)
      sf[i][0] = l[i], sf[i][1] = r[i];
    else {
      sf[i][0] = max(sf[i + 1][0], l[i]);
      sf[i][1] = min(sf[i + 1][1], r[i]);
    }
  }
  int ans = 0;
  for (int i = 0; i < n; i++) {
    int maxL = -1;
    if (i) maxL = max(maxL, pf[i][0]);
    if (i + 1 < n) maxL = max(maxL, sf[i + 1][0]);
    int minR = 1e9 + 10;
    if (i + 1 < n) minR = min(minR, sf[i + 1][1]);
    if (i) minR = min(minR, pf[i][1]);
    ans = max(ans, minR - maxL);
  }
  cout << ans << endl;
}

```


### Prompt

Develop a solution in CPP to the problem described below:

There are n Christmas trees on an infinite number line. The i-th tree grows at the position x_i. All x_i are guaranteed to be distinct.

Each integer point can be either occupied by the Christmas tree, by the human or not occupied at all. Non-integer points cannot be occupied by anything.

There are m people who want to celebrate Christmas. Let y_1, y_2, ..., y_m be the positions of people (note that all values x_1, x_2, ..., x_n, y_1, y_2, ..., y_m should be distinct and all y_j should be integer). You want to find such an arrangement of people that the value ∑_{j=1}^{m}min_{i=1}^{n}|x_i - y_j| is the minimum possible (in other words, the sum of distances to the nearest Christmas tree for all people should be minimized).

In other words, let d_j be the distance from the j-th human to the nearest Christmas tree (d_j = min_{i=1}^{n} |y_j - x_i|). Then you need to choose such positions y_1, y_2, ..., y_m that ∑_{j=1}^{m} d_j is the minimum possible.

Input

The first line of the input contains two integers n and m (1 ≤ n, m ≤ 2 ⋅ 10^5) — the number of Christmas trees and the number of people.

The second line of the input contains n integers x_1, x_2, ..., x_n (-10^9 ≤ x_i ≤ 10^9), where x_i is the position of the i-th Christmas tree. It is guaranteed that all x_i are distinct.

Output

In the first line print one integer res — the minimum possible value of ∑_{j=1}^{m}min_{i=1}^{n}|x_i - y_j| (in other words, the sum of distances to the nearest Christmas tree for all people).

In the second line print m integers y_1, y_2, ..., y_m (-2 ⋅ 10^9 ≤ y_j ≤ 2 ⋅ 10^9), where y_j is the position of the j-th human. All y_j should be distinct and all values x_1, x_2, ..., x_n, y_1, y_2, ..., y_m should be distinct.

If there are multiple answers, print any of them.

Examples

Input

2 6
1 5

Output

8
-1 2 6 4 0 3

Input

3 5
0 3 1

Output

7
5 -2 4 -1 2

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, m;
  long long sum = 0;
  long long k = 0;
  queue<pair<long long, long long>> bfs;
  map<int, bool> map;
  cin >> n >> m;
  for (int i = 0; i < n; i++) {
    long long a;
    cin >> a;
    bfs.push({a, 0});
    map[a] = true;
  }
  vector<long long> ans;
  while (true) {
    if (k == m) break;
    if (map.find(bfs.front().first - 1) == map.end()) {
      ans.push_back(bfs.front().first - 1);
      bfs.push({bfs.front().first - 1, bfs.front().second + 1});
      map[bfs.front().first - 1] = true;
      sum += bfs.front().second + 1;
      k++;
    }
    if (k == m) break;
    if (map.find(bfs.front().first + 1) == map.end()) {
      ans.push_back(bfs.front().first + 1);
      bfs.push({bfs.front().first + 1, bfs.front().second + 1});
      map[bfs.front().first + 1] = true;
      sum += bfs.front().second + 1;
      k++;
    }
    bfs.pop();
    if (k == m) break;
  }
  cout << sum << "\n";
  for (int i = 0; i < m; i++) {
    cout << ans[i] << " ";
  }
  return 0;
}

```


### Prompt

Please create a solution in cpp to the following problem:

Let's introduce the designation <image>, where x is a string, n is a positive integer and operation " + " is the string concatenation operation. For example, [abc, 2] = abcabc.

We'll say that string s can be obtained from string t, if we can remove some characters from string t and obtain string s. For example, strings ab and aсba can be obtained from string xacbac, and strings bx and aaa cannot be obtained from it.

Sereja has two strings, w = [a, b] and q = [c, d]. He wants to find such maximum integer p (p > 0), that [q, p] can be obtained from string w.

Input

The first line contains two integers b, d (1 ≤ b, d ≤ 107). The second line contains string a. The third line contains string c. The given strings are not empty and consist of lowercase English letters. Their lengths do not exceed 100.

Output

In a single line print an integer — the largest number p. If the required value of p doesn't exist, print 0.

Examples

Input

10 3
abab
bab

Output

3

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
int dp[100];
int main() {
  int b, d, n, m, i, j, t;
  string a, c;
  cin >> b >> d >> a >> c;
  n = a.size();
  m = c.size();
  for (i = 0; i < m; i++)
    for (j = 0; j < n; j++)
      if (a[j] == c[(i + dp[i]) % m]) dp[i]++;
  t = 0;
  for (i = 0; i < b; i++) t += dp[t % m];
  cout << t / d / m << endl;
  return 0;
}

```


### Prompt

Please create a solution in CPP to the following problem:

There are n incoming messages for Vasya. The i-th message is going to be received after ti minutes. Each message has a cost, which equals to A initially. After being received, the cost of a message decreases by B each minute (it can become negative). Vasya can read any message after receiving it at any moment of time. After reading the message, Vasya's bank account receives the current cost of this message. Initially, Vasya's bank account is at 0.

Also, each minute Vasya's bank account receives C·k, where k is the amount of received but unread messages.

Vasya's messages are very important to him, and because of that he wants to have all messages read after T minutes.

Determine the maximum amount of money Vasya's bank account can hold after T minutes.

Input

The first line contains five integers n, A, B, C and T (1 ≤ n, A, B, C, T ≤ 1000).

The second string contains n integers ti (1 ≤ ti ≤ T).

Output

Output one integer — the answer to the problem.

Examples

Input

4 5 5 3 5
1 5 5 4

Output

20

Input

5 3 1 1 3
2 2 2 1 1

Output

15

Input

5 5 3 4 5
1 2 3 4 5

Output

35

Note

In the first sample the messages must be read immediately after receiving, Vasya receives A points for each message, n·A = 20 in total.

In the second sample the messages can be read at any integer moment.

In the third sample messages must be read at the moment T. This way Vasya has 1, 2, 3, 4 and 0 unread messages at the corresponding minutes, he gets 40 points for them. When reading messages, he receives (5 - 4·3) + (5 - 3·3) + (5 - 2·3) + (5 - 1·3) + 5 = - 5 points. This is 35 in total.

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, A, B, C, T, a[100000];
  int mon = 0;
  cin >> n >> A >> B >> C >> T;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  if (C <= B) {
    mon = n * A;
  } else {
    for (int i = 0; i < n; i++) {
      if (a[i] <= T) mon = mon + (T - a[i]) * C + A - (T - a[i]) * B;
    }
  }
  cout << mon;
  return 0;
}

```


### Prompt

Create a solution in cpp for the following problem:

You are given a string S consisting of lowercase English letters. Determine whether all the characters in S are different.

Constraints

* 2 ≤ |S| ≤ 26, where |S| denotes the length of S.
* S consists of lowercase English letters.

Input

Input is given from Standard Input in the following format:

S

Output

If all the characters in S are different, print `yes` (case-sensitive); otherwise, print `no`.

Examples

Input

uncopyrightable

Output

yes

Input

different

Output

no

Input

no

Output

yes

### Response

```cpp
#include<bits/stdc++.h>
using namespace std;
string s;
int hsh[35];
int main()
{
	cin >> s;
	for(int i=0;i<s.size();i++)
	{
		++hsh[s[i]-'a'];
	}
	for(int i=0;i<26;i++)
	{
		if(hsh[i]>1)
		{
			printf("no");
			return 0;
		}
	}
	printf("yes");
}
```


### Prompt

Create a solution in Cpp for the following problem:

One day Vasya the Hipster decided to count how many socks he had. It turned out that he had a red socks and b blue socks.

According to the latest fashion, hipsters should wear the socks of different colors: a red one on the left foot, a blue one on the right foot.

Every day Vasya puts on new socks in the morning and throws them away before going to bed as he doesn't want to wash them.

Vasya wonders, what is the maximum number of days when he can dress fashionable and wear different socks, and after that, for how many days he can then wear the same socks until he either runs out of socks or cannot make a single pair from the socks he's got.

Can you help him?

Input

The single line of the input contains two positive integers a and b (1 ≤ a, b ≤ 100) — the number of red and blue socks that Vasya's got.

Output

Print two space-separated integers — the maximum number of days when Vasya can wear different socks and the number of days when he can wear the same socks until he either runs out of socks or cannot make a single pair from the socks he's got.

Keep in mind that at the end of the day Vasya throws away the socks that he's been wearing on that day.

Examples

Input

3 1

Output

1 1

Input

2 3

Output

2 0

Input

7 3

Output

3 2

Note

In the first sample Vasya can first put on one pair of different socks, after that he has two red socks left to wear on the second day.

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b;
  cin >> a >> b;
  int x, coun;
  x = abs(a - b) / 2;
  if (a > b)
    cout << b << " " << x;
  else
    cout << a << " " << x;
  return 0;
}

```


### Prompt

Generate a CPP solution to the following problem:

You successfully found poor Arkady near the exit of the station you've perfectly predicted. You sent him home on a taxi and suddenly came up with a question.

There are n crossroads in your city and several bidirectional roads connecting some of them. A taxi ride is a path from some crossroads to another one without passing the same crossroads twice. You have a collection of rides made by one driver and now you wonder if this driver can be a robot or they are definitely a human.

You think that the driver can be a robot if for every two crossroads a and b the driver always chooses the same path whenever he drives from a to b. Note that a and b here do not have to be the endpoints of a ride and that the path from b to a can be different. On the contrary, if the driver ever has driven two different paths from a to b, they are definitely a human.

Given the system of roads and the description of all rides available to you, determine if the driver can be a robot or not.

Input

Each test contains one or more test cases. The first line contains a single integer t (1 ≤ t ≤ 3 ⋅ 10^5) — the number of test cases.

The first line of each test case contains a single integer n (1 ≤ n ≤ 3 ⋅ 10^5) — the number of crossroads in the city.

The next line contains a single integer q (1 ≤ q ≤ 3 ⋅ 10^5) — the number of rides available to you.

Each of the following q lines starts with a single integer k (2 ≤ k ≤ n) — the number of crossroads visited by the driver on this ride. It is followed by k integers c_1, c_2, ..., c_k (1 ≤ c_i ≤ n) — the crossroads in the order the driver visited them. It is guaranteed that all crossroads in one ride are distinct.

It is guaranteed that the sum of values k among all rides of all test cases does not exceed 3 ⋅ 10^5.

It is guaranteed that the sum of values n and the sum of values q doesn't exceed 3 ⋅ 10^5 among all test cases.

Output

Output a single line for each test case.

If the driver can be a robot, output "Robot" in a single line. Otherwise, output "Human".

You can print each letter in any case (upper or lower).

Examples

Input

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

Output

Human

Input

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

Output

Robot

Note

In the first example it is clear that the driver used two different ways to get from crossroads 1 to crossroads 3. It must be a human.

In the second example the driver always drives the cycle 1 → 2 → 3 → 4 → 1 until he reaches destination.

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
const int S = 500;
vector<int> v[300001];
vector<pair<int, int> > V[300001];
int T, n, q, k, x, po[300001], p[300001];
void solve() {
  scanf("%d%d", &n, &q);
  for (int i = 1; i <= q; i++) {
    scanf("%d", &k);
    v[i].clear();
    for (int j = 0; j < k; j++) scanf("%d", &x), v[i].push_back(x);
  }
  for (int i = 1; i <= q; i++)
    if (v[i].size() >= S) {
      int k = v[i].size();
      for (int j = 0; j < k; j++) po[v[i][j]] = j + 1;
      for (int j = 1, siz, l; j <= q; j++)
        if (i != j) {
          int mi = (po[v[j][0]] ? po[v[j][0]] : (1e9));
          for (l = 1, siz = v[j].size(); l < siz; l++)
            if (po[v[j][l]]) {
              if (mi < po[v[j][l]] && !po[v[j][l - 1]] ||
                  po[v[j][l - 1]] && po[v[j][l - 1]] < po[v[j][l]] - 1) {
                for (int j = 0; j < k; j++) po[v[i][j]] = 0;
                puts("Human");
                return;
              }
              mi = (mi > po[v[j][l]] ? po[v[j][l]] : mi);
            }
        }
      for (int j = 0; j < k; j++) po[v[i][j]] = 0;
    }
  for (int i = 1; i <= n; i++) V[i].clear();
  for (int i = 1, siz, j; i <= q; i++)
    if (v[i].size() < S)
      for (j = 0, siz = v[i].size(); j < siz; j++)
        V[v[i][j]].push_back(make_pair(i, j));
  for (int i = 1, siz, j; i <= n; i++) {
    for (j = 0, siz = V[i].size(); j < siz; j++) {
      int p1 = V[i][j].first, p2 = V[i][j].second, s = v[p1].size();
      for (int k = p2 + 1, K; k < s; k++) {
        K = v[p1][k];
        if (!po[K])
          po[K] = p1, p[K] = k;
        else if (v[po[K]][p[K] - 1] != v[p1][k - 1]) {
          for (j = 0, siz = V[i].size(); j < siz; j++) {
            int p1 = V[i][j].first, p2 = V[i][j].second, s = v[p1].size();
            for (int k = p2 + 1; k < s; k++) po[v[p1][k]] = 0;
          }
          puts("Human");
          return;
        }
      }
    }
    for (j = 0, siz = V[i].size(); j < siz; j++) {
      int p1 = V[i][j].first, p2 = V[i][j].second, s = v[p1].size();
      for (int k = p2 + 1; k < s; k++) po[v[p1][k]] = 0;
    }
  }
  puts("Robot");
}
int main() {
  scanf("%d", &T);
  memset(po, 0, sizeof(po));
  while (T--) solve();
  return 0;
}

```


### Prompt

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

Leonid works for a small and promising start-up that works on decoding the human genome. His duties include solving complex problems of finding certain patterns in long strings consisting of letters 'A', 'T', 'G' and 'C'.

Let's consider the following scenario. There is a fragment of a human DNA chain, recorded as a string S. To analyze the fragment, you need to find all occurrences of string T in a string S. However, the matter is complicated by the fact that the original chain fragment could contain minor mutations, which, however, complicate the task of finding a fragment. Leonid proposed the following approach to solve this problem.

Let's write down integer k ≥ 0 — the error threshold. We will say that string T occurs in string S on position i (1 ≤ i ≤ |S| - |T| + 1), if after putting string T along with this position, each character of string T corresponds to the some character of the same value in string S at the distance of at most k. More formally, for any j (1 ≤ j ≤ |T|) there must exist such p (1 ≤ p ≤ |S|), that |(i + j - 1) - p| ≤ k and S[p] = T[j].

For example, corresponding to the given definition, string "ACAT" occurs in string "AGCAATTCAT" in positions 2, 3 and 6.

<image>

Note that at k = 0 the given definition transforms to a simple definition of the occurrence of a string in a string.

Help Leonid by calculating in how many positions the given string T occurs in the given string S with the given error threshold.

Input

The first line contains three integers |S|, |T|, k (1 ≤ |T| ≤ |S| ≤ 200 000, 0 ≤ k ≤ 200 000) — the lengths of strings S and T and the error threshold.

The second line contains string S.

The third line contains string T.

Both strings consist only of uppercase letters 'A', 'T', 'G' and 'C'.

Output

Print a single number — the number of occurrences of T in S with the error threshold k by the given definition.

Examples

Input

10 4 1
AGCAATTCAT
ACAT

Output

3

Note

If you happen to know about the structure of the human genome a little more than the author of the problem, and you are not impressed with Leonid's original approach, do not take everything described above seriously.

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e6 + 9;
const int MOD = 1e9 + 7;
int mod = 999998639;
inline long long qpow(long long b, long long e, long long m = MOD) {
  long long a = 1;
  for (; e; e >>= 1, b = b * b % m)
    if (e & 1) a = a * b % m;
  return a;
}
long long exgcd(long long a, long long b, long long &x, long long &y) {
  if (b == 0) {
    x = 1, y = 0;
    return a;
  }
  long long d = exgcd(b, a % b, x, y);
  long long z = x;
  x = y, y = z - y * (a / b);
  return d;
}
int rev[maxn];
struct Complex {
  double x, y;
  Complex(double _x = 0.0, double _y = 0.0) {
    x = _x;
    y = _y;
  }
  Complex operator-(const Complex &b) const {
    return Complex(x - b.x, y - b.y);
  }
  Complex operator+(const Complex &b) const {
    return Complex(x + b.x, y + b.y);
  }
  Complex operator*(const Complex &b) const {
    return Complex(x * b.x - y * b.y, x * b.y + y * b.x);
  }
};
void change(Complex y[], int len) {
  for (int i = 0; i < len; ++i) {
    rev[i] = rev[i >> 1] >> 1;
    if (i & 1) {
      rev[i] |= len >> 1;
    }
  }
  for (int i = 0; i < len; ++i) {
    if (i < rev[i]) {
      swap(y[i], y[rev[i]]);
    }
  }
  return;
}
void fft(Complex y[], int len, int on) {
  change(y, len);
  for (int h = 2; h <= len; h <<= 1) {
    Complex wn(cos(2 * acos(-1) / h), sin(on * 2 * acos(-1) / h));
    for (int j = 0; j < len; j += h) {
      Complex w(1, 0);
      for (int k = j; k < j + h / 2; k++) {
        Complex u = y[k];
        Complex t = w * y[k + h / 2];
        y[k] = u + t;
        y[k + h / 2] = u - t;
        w = w * wn;
      }
    }
  }
  if (on == -1) {
    for (int i = 0; i < len; i++) {
      y[i].x /= len;
    }
  }
}
Complex A[maxn], B[maxn];
char s[maxn], t[maxn];
int a[maxn], b[maxn], ans[maxn];
map<char, vector<int> > mp;
int n, m, k;
void solve(char c, int len) {
  memset(a, 0, sizeof(a));
  memset(b, 0, sizeof(b));
  for (int i = 0; i < n; i++) {
    int l = -0x3f3f3f3f, r = 0x3f3f3f3f;
    auto it = lower_bound(mp[c].begin(), mp[c].end(), i);
    if (it != mp[c].end()) r = *it;
    if (it != mp[c].begin()) l = *(--it);
    if (abs(i - l) <= k || abs(i - r) <= k) a[i] = 1;
  }
  for (int i = 0; i < m; i++) {
    if (t[i] == c) b[i] = 1;
  }
  for (int i = 0; i <= len; i++) {
    A[i] = Complex(a[i], 0);
    B[i] = Complex(b[i], 0);
  }
  fft(A, len, 1), fft(B, len, 1);
  for (int i = 0; i <= len; i++) {
    A[i] = A[i] * B[i];
  }
  fft(A, len, -1);
  for (int i = 0; i <= len; i++) {
    ans[i] += int(A[i].x + 0.5);
  }
}
int main() {
  while (scanf("%d%d%d", &n, &m, &k) != EOF) {
    scanf("%s%s", s, t);
    reverse(s, s + n);
    for (int i = 0; i < n; i++) {
      mp[s[i]].push_back(i);
    }
    int len = 1;
    while (len < 2 * n) len <<= 1;
    solve('A', len), solve('T', len), solve('G', len), solve('C', len);
    int res = 0;
    for (int i = 0; i < n; i++) {
      if (ans[i] == m) res++;
    }
    printf("%d\n", res);
  }
}

```


### Prompt

Please create a solution in cpp to the following problem:

There are n psychos standing in a line. Each psycho is assigned a unique integer from 1 to n. At each step every psycho who has an id greater than the psycho to his right (if exists) kills his right neighbor in the line. Note that a psycho might kill and get killed at the same step.

You're given the initial arrangement of the psychos in the line. Calculate how many steps are needed to the moment of time such, that nobody kills his neighbor after that moment. Look notes to understand the statement more precise.

Input

The first line of input contains integer n denoting the number of psychos, (1 ≤ n ≤ 105). In the second line there will be a list of n space separated distinct integers each in range 1 to n, inclusive — ids of the psychos in the line from left to right.

Output

Print the number of steps, so that the line remains the same afterward.

Examples

Input

10
10 9 7 8 6 5 3 4 2 1

Output

2

Input

6
1 2 3 4 5 6

Output

0

Note

In the first sample line of the psychos transforms as follows: [10 9 7 8 6 5 3 4 2 1]  →  [10 8 4] →  [10]. So, there are two steps.

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 5;
const int maxm = 1e6 + 5;
const int inf = 0x3f3f3f3f;
long long mod = 998244353;
const double eps = 1e-9;
const double pi = acos(-1);
const double e = 2.718281828;
int n, m, w, k;
int ans[maxn];
int sta[maxn];
int a[maxn];
int main() {
  int _;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) scanf("%d", &a[i]);
  int as = 0;
  int l = 0;
  for (int i = n - 1; i >= 0; i--) {
    sta[l++] = a[i];
    while (l > 1 && sta[l - 1] > sta[l - 2]) {
      if (ans[sta[l - 2]] > ans[sta[l - 1]])
        ans[sta[l - 1]] = ans[sta[l - 2]];
      else
        ans[sta[l - 1]]++;
      sta[l - 2] = sta[l - 1];
      l--;
    }
    as = max(as, ans[sta[l - 1]]);
  }
  cout << as << endl;
}

```


### Prompt

Please formulate a cpp solution to the following problem:

On one quiet day all of sudden Mister B decided to draw angle a on his field. Aliens have already visited his field and left many different geometric figures on it. One of the figures is regular convex n-gon (regular convex polygon with n sides).

That's why Mister B decided to use this polygon. Now Mister B must find three distinct vertices v1, v2, v3 such that the angle <image> (where v2 is the vertex of the angle, and v1 and v3 lie on its sides) is as close as possible to a. In other words, the value <image> should be minimum possible.

If there are many optimal solutions, Mister B should be satisfied with any of them.

Input

First and only line contains two space-separated integers n and a (3 ≤ n ≤ 105, 1 ≤ a ≤ 180) — the number of vertices in the polygon and the needed angle, in degrees.

Output

Print three space-separated integers: the vertices v1, v2, v3, which form <image>. If there are multiple optimal solutions, print any of them. The vertices are numbered from 1 to n in clockwise order.

Examples

Input

3 15

Output

1 2 3

Input

4 67

Output

2 1 3

Input

4 68

Output

4 1 2

Note

In first sample test vertices of regular triangle can create only angle of 60 degrees, that's why every possible angle is correct.

Vertices of square can create 45 or 90 degrees angles only. That's why in second sample test the angle of 45 degrees was chosen, since |45 - 67| < |90 - 67|. Other correct answers are: "3 1 2", "3 2 4", "4 2 3", "4 3 1", "1 3 4", "1 4 2", "2 4 1", "4 1 3", "3 1 4", "3 4 2", "2 4 3", "2 3 1", "1 3 2", "1 2 4", "4 2 1".

In third sample test, on the contrary, the angle of 90 degrees was chosen, since |90 - 68| < |45 - 68|. Other correct answers are: "2 1 4", "3 2 1", "1 2 3", "4 3 2", "2 3 4", "1 4 3", "3 4 1".

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
template <typename T, typename T1>
ostream &operator<<(ostream &out, pair<T, T1> obj) {
  out << "(" << obj.first << "," << obj.second << ")";
  return out;
}
template <typename T, typename T1>
ostream &operator<<(ostream &out, map<T, T1> cont) {
  typename map<T, T1>::const_iterator itr = cont.begin();
  typename map<T, T1>::const_iterator ends = cont.end();
  for (; itr != ends; ++itr) out << *itr << " ";
  out << endl;
  return out;
}
template <typename T>
ostream &operator<<(ostream &out, set<T> cont) {
  typename set<T>::const_iterator itr = cont.begin();
  typename set<T>::const_iterator ends = cont.end();
  for (; itr != ends; ++itr) out << *itr << " ";
  out << endl;
  return out;
}
template <typename T>
ostream &operator<<(ostream &out, multiset<T> cont) {
  typename multiset<T>::const_iterator itr = cont.begin();
  typename multiset<T>::const_iterator ends = cont.end();
  for (; itr != ends; ++itr) out << *itr << " ";
  out << endl;
  return out;
}
template <typename T,
          template <typename ELEM, typename ALLOC = allocator<ELEM>> class CONT>
ostream &operator<<(ostream &out, CONT<T> cont) {
  typename CONT<T>::const_iterator itr = cont.begin();
  typename CONT<T>::const_iterator ends = cont.end();
  for (; itr != ends; ++itr) out << *itr << " ";
  out << endl;
  return out;
}
template <typename T, unsigned int N, typename CTy, typename CTr>
typename enable_if<!is_same<T, char>::value, basic_ostream<CTy, CTr> &>::type
operator<<(basic_ostream<CTy, CTr> &out, const T (&arr)[N]) {
  for (auto i = 0; i < N; ++i) out << arr[i] << " ";
  out << endl;
  return out;
}
template <typename T>
T gcd(T a, T b) {
  T min_v = min(a, b);
  T max_v = max(a, b);
  while (min_v) {
    T temp = max_v % min_v;
    max_v = min_v;
    min_v = temp;
  }
  return max_v;
}
template <typename T>
T lcm(T a, T b) {
  return (a * b) / gcd(a, b);
}
template <typename T>
T fast_exp_pow(T base, T exp, T mod) {
  T res = 1;
  while (exp) {
    if (exp & 1) {
      res *= base;
      res %= mod;
    }
    exp >>= 1;
    base *= base;
    base %= mod;
  }
  return res % mod;
}
int N, A;
int main() {
  scanf("%d%d", &N, &A);
  double angle = (N - 2.0) * 180.0 / N;
  double angle_1 = angle / (N - 2.0);
  int div = min(N - 3, (int)(A / angle_1));
  double val_1 = fabs(div * angle_1 - A);
  double val_2 = fabs((div + 1) * angle_1 - A);
  if (div && val_1 < val_2) {
    printf("1 2 %d\n", N - div + 1);
  } else {
    printf("1 2 %d\n", N - div);
  }
  return 0;
}

```


### Prompt

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

The prison of your city has n prisoners. As the prison can't accommodate all of them, the city mayor has decided to transfer c of the prisoners to a prison located in another city.

For this reason, he made the n prisoners to stand in a line, with a number written on their chests. The number is the severity of the crime he/she has committed. The greater the number, the more severe his/her crime was.

Then, the mayor told you to choose the c prisoners, who will be transferred to the other prison. He also imposed two conditions. They are,

  * The chosen c prisoners has to form a contiguous segment of prisoners.
  * Any of the chosen prisoner's crime level should not be greater then t. Because, that will make the prisoner a severe criminal and the mayor doesn't want to take the risk of his running away during the transfer.

Find the number of ways you can choose the c prisoners.

Input

The first line of input will contain three space separated integers n (1 ≤ n ≤ 2·105), t (0 ≤ t ≤ 109) and c (1 ≤ c ≤ n). The next line will contain n space separated integers, the ith integer is the severity ith prisoner's crime. The value of crime severities will be non-negative and will not exceed 109.

Output

Print a single integer — the number of ways you can choose the c prisoners.

Examples

Input

4 3 3
2 3 1 1

Output

2

Input

1 1 1
2

Output

0

Input

11 4 2
2 2 0 7 3 2 2 4 9 1 4

Output

6

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
int a[200005];
int main() {
  int n, t, c, i, j = 0, tmp = 0, f = 0;
  cin >> n >> t >> c;
  for (i = 0; i < n; i++) {
    cin >> a[i];
    if (a[i] > t) {
      j = 0;
    } else {
      if (j >= c - 1) {
        tmp++;
      }
      j++;
    }
  }
  cout << tmp;
}

```


### Prompt

Develop a solution in CPP to the problem described below:

Dreamoon likes coloring cells very much.

There is a row of n cells. Initially, all cells are empty (don't contain any color). Cells are numbered from 1 to n.

You are given an integer m and m integers l_1, l_2, …, l_m (1 ≤ l_i ≤ n)

Dreamoon will perform m operations.

In i-th operation, Dreamoon will choose a number p_i from range [1, n-l_i+1] (inclusive) and will paint all cells from p_i to p_i+l_i-1 (inclusive) in i-th color. Note that cells may be colored more one than once, in this case, cell will have the color from the latest operation.

Dreamoon hopes that after these m operations, all colors will appear at least once and all cells will be colored. Please help Dreamoon to choose p_i in each operation to satisfy all constraints.

Input

The first line contains two integers n,m (1 ≤ m ≤ n ≤ 100 000).

The second line contains m integers l_1, l_2, …, l_m (1 ≤ l_i ≤ n).

Output

If it's impossible to perform m operations to satisfy all constraints, print "'-1" (without quotes).

Otherwise, print m integers p_1, p_2, …, p_m (1 ≤ p_i ≤ n - l_i + 1), after these m operations, all colors should appear at least once and all cells should be colored.

If there are several possible solutions, you can print any.

Examples

Input

5 3
3 2 2

Output

2 4 1

Input

10 1
1

Output

-1

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
inline long long read() {
  register long long x = 0;
  register bool f = 0;
  register char c = getchar();
  while (c < '0' || c > '9') {
    if (c == '-') f = 1;
    c = getchar();
  }
  while (c >= '0' && c <= '9') {
    x = (x << 3) + (x << 1) + c - 48;
    c = getchar();
  }
  return f ? -x : x;
}
char cr[200];
long long tt;
inline void print(register long long x, register char k = '\n') {
  if (!x) putchar('0');
  if (x < 0) putchar('-'), x = -x;
  while (x) cr[++tt] = x % 10 + '0', x /= 10;
  while (tt) putchar(cr[tt--]);
  putchar(k);
}
const long long maxn = 114514;
long long a[maxn], s[maxn], n, m, p[maxn], sum;
signed main() {
  n = read();
  m = read();
  for (long long i = 1; i <= m; i++) {
    a[i] = read();
    p[i] = i;
    if (p[i] + a[i] - 1 > n) {
      print(-1);
      return 0;
    }
    sum += a[i];
  }
  if (sum < n) {
    print(-1);
    return 0;
  }
  sum = 0;
  for (long long i = m; i; i--) {
    sum += a[i];
    p[i] = n - sum + 1;
    if (p[i] < i) p[i] = i;
  }
  for (long long i = 1; i <= m; i++) {
    print(p[i], ' ');
  }
}

```


### Prompt

Please create a solution in Cpp to the following problem:

For a dynamic list $L$ of integers, perform a sequence of the following operations. $L$ has a special element called END at the end of the list and an element of $L$ is indicated by a cursor.

* insert($x$): Insert $x$ before the element indicated by the cursor. After this operation, the cursor points the inserted element.
* move($d$): Move the cursor to the end by $d$, if $d$ is positive. Move the cursor to the front by $d$, if $d$ is negative.
* erase(): Delete the element indicated by the cursor. After this operation, the cursor points the element next to the deleted element. In case there is no such element, the cursor should point END.

In the initial state, $L$ is empty and the cursor points END.

Constraints

* $1 \leq q \leq 500,000$
* The cursor indicates an element of $L$ or END during the operations
* Erase operation will not given when the cursor points END
* $-1,000,000,000 \leq x \leq 1,000,000,000$
* Moving distance of the cursor ($\sum{|d|}$) does not exceed 1,000,000
* $L$ is not empty after performing all operations

Input

The input is given in the following format.

$q$
$query_1$
$query_2$
:
$query_q$

Each query $query_i$ is given by

0 $x$

or

1 $d$

or

2

where the first digits 0, 1 and 2 represent insert, move and erase operations respectively.

Output

Print all elements of the list in order after performing given operations. Print an element in a line.

Example

Input

5
0 1
0 2
0 3
1 1
2

Output

3
1

### Response

```cpp
#include "stdio.h"
#include <vector>
#include <string>
#include <iostream>
#include <algorithm>

#include <list>
#include <iterator>

using namespace std;

enum {INS, MOVE, DEL};

class Puzzle
{
public:

	int N;
	//vector<long> list;
	list<int> data;

	void input()
	{
		cin >> N;
	}

	void play()
	{
		int q;
		long d;
		//int cs = 0;
		list<int>::iterator itr = data.begin();

		for (int qi = 0; qi < N; qi++) {
			cin >> q;
			switch (q) {
			case INS:
				cin >> d;
				itr = data.insert(itr,d);
				break;
			case MOVE:
				cin >> d;
				advance(itr, d);
				//itr = itr + 5;
				break;
			case DEL:
				itr = data.erase(itr);
				break;
			}
		}

		for (auto d : data) {
			printf("%d\n", d);
		}
	}

};

int main()
{
	Puzzle puz;

	puz.input();
	puz.play();

    return 0;
}

```


### Prompt

Develop a solution in cpp to the problem described below:

Luba thinks about watering her garden. The garden can be represented as a segment of length k. Luba has got n buckets, the i-th bucket allows her to water some continuous subsegment of garden of length exactly ai each hour. Luba can't water any parts of the garden that were already watered, also she can't water the ground outside the garden.

Luba has to choose one of the buckets in order to water the garden as fast as possible (as mentioned above, each hour she will water some continuous subsegment of length ai if she chooses the i-th bucket). Help her to determine the minimum number of hours she has to spend watering the garden. It is guaranteed that Luba can always choose a bucket so it is possible water the garden.

See the examples for better understanding.

Input

The first line of input contains two integer numbers n and k (1 ≤ n, k ≤ 100) — the number of buckets and the length of the garden, respectively.

The second line of input contains n integer numbers ai (1 ≤ ai ≤ 100) — the length of the segment that can be watered by the i-th bucket in one hour.

It is guaranteed that there is at least one bucket such that it is possible to water the garden in integer number of hours using only this bucket.

Output

Print one integer number — the minimum number of hours required to water the garden.

Examples

Input

3 6
2 3 5

Output

2

Input

6 7
1 2 3 4 5 6

Output

7

Note

In the first test the best option is to choose the bucket that allows to water the segment of length 3. We can't choose the bucket that allows to water the segment of length 5 because then we can't water the whole garden.

In the second test we can choose only the bucket that allows us to water the segment of length 1.

### Response

```cpp
#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:10000000")
using namespace std;
const double PI = acos(-1.0);
const int INF = 1e9;
const int MOD = INF + 7;
const long long BIGINF = 1e16;
int n, k, elem, mini = 1e9;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    cin >> elem;
    if (k % elem == 0) mini = min(k / elem, mini);
  }
  cout << mini << '\n';
  return 0;
}

```


### Prompt

Please formulate a CPP solution to the following problem:

Vasya lives in a round building, whose entrances are numbered sequentially by integers from 1 to n. Entrance n and entrance 1 are adjacent.

Today Vasya got bored and decided to take a walk in the yard. Vasya lives in entrance a and he decided that during his walk he will move around the house b entrances in the direction of increasing numbers (in this order entrance n should be followed by entrance 1). The negative value of b corresponds to moving |b| entrances in the order of decreasing numbers (in this order entrance 1 is followed by entrance n). If b = 0, then Vasya prefers to walk beside his entrance.

<image> Illustration for n = 6, a = 2, b = - 5.

Help Vasya to determine the number of the entrance, near which he will be at the end of his walk.

Input

The single line of the input contains three space-separated integers n, a and b (1 ≤ n ≤ 100, 1 ≤ a ≤ n, - 100 ≤ b ≤ 100) — the number of entrances at Vasya's place, the number of his entrance and the length of his walk, respectively.

Output

Print a single integer k (1 ≤ k ≤ n) — the number of the entrance where Vasya will be at the end of his walk.

Examples

Input

6 2 -5

Output

3

Input

5 1 3

Output

4

Input

3 2 7

Output

3

Note

The first example is illustrated by the picture in the statements.

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
int n, a, b;
int main(int argc, char const *argv[]) {
  scanf("%d %d %d", &n, &a, &b);
  int ans = (a - 1 + b) % n + 1;
  printf("%d\n", ans < 1 ? ans + n : ans);
  return 0;
}

```


### Prompt

Construct a Cpp code solution to the problem outlined:

The Fair Nut found a string s. The string consists of lowercase Latin letters. The Nut is a curious guy, so he wants to find the number of strictly increasing sequences p_1, p_2, …, p_k, such that:

  1. For each i (1 ≤ i ≤ k), s_{p_i} = 'a'.
  2. For each i (1 ≤ i < k), there is such j that p_i < j < p_{i + 1} and s_j = 'b'.

The Nut is upset because he doesn't know how to find the number. Help him.

This number should be calculated modulo 10^9 + 7.

Input

The first line contains the string s (1 ≤ |s| ≤ 10^5) consisting of lowercase Latin letters.

Output

In a single line print the answer to the problem — the number of such sequences p_1, p_2, …, p_k modulo 10^9 + 7.

Examples

Input

abbaa

Output

5

Input

baaaa

Output

4

Input

agaa

Output

3

Note

In the first example, there are 5 possible sequences. [1], [4], [5], [1, 4], [1, 5].

In the second example, there are 4 possible sequences. [2], [3], [4], [5].

In the third example, there are 3 possible sequences. [1], [3], [4].

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod = 1e9 + 7;
const ll N = 1e5 + 5;
ll mat[N];
vector<int> v;
int n;
ll nikal(int pos) {
  if (pos == n) return 1;
  if (mat[pos] != -1) return mat[pos];
  return mat[pos] = (nikal(pos + 1) * v[pos] + nikal(pos + 1)) % mod;
}
void solve() {
  string s;
  memset(mat, -1, sizeof(mat));
  cin >> s;
  string t;
  for (int i = 0; i < s.size(); i++) {
    if (s[i] == 'a' || s[i] == 'b') t.push_back(s[i]);
    ;
  }
  s = t;
  int c = 0;
  for (int i = 0; i < s.size(); i++) {
    if (s[i] == 'a')
      c++;
    else if (s[i] == 'b') {
      if (c) v.push_back(c);
      c = 0;
    }
  }
  if (c) v.push_back(c);
  n = v.size();
  cout << nikal(0) - 1;
}
int main() {
  int t = 1;
  while (t--) {
    solve();
  }
}

```


### Prompt

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

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

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

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

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

Input

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

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

Output

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

Examples

Input

7
1 1 2 2 3 3 3

Output

6

Input

10
1 1 1 5 4 1 3 1 2 2

Output

7

Input

1
1

Output

0

Note

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

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
template <class T>
ostream &operator<<(ostream &os, const vector<T> &v) {
  os << "[";
  for (int i = 0; i < (((int)(v).size())); ++i) {
    if (i) os << ", ";
    os << v[i];
  }
  return os << "]";
}
template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
  return os << "(" << p.first << " " << p.second << ")";
}
template <class T>
bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
bool chmin(T &a, const T &b) {
  if (b < a) {
    a = b;
    return true;
  }
  return false;
}
using ll = long long;
using ull = unsigned long long;
using ld = long double;
using P = pair<int, int>;
using vi = vector<int>;
using vll = vector<ll>;
using vvi = vector<vi>;
using vvll = vector<vll>;
const ll MOD = 1e9 + 7;
const int INF = INT_MAX / 2;
const ll LINF = LLONG_MAX / 2;
const ld eps = 1e-9;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  int n;
  cin >> n;
  vi a(n);
  map<int, int> mp;
  set<int> st;
  for (int i = 0; i < (n); ++i) {
    cin >> a[i];
    mp[a[i]]++;
    st.insert(a[i]);
  }
  int ma = 0, argma = 0;
  for (auto [val, cnt] : mp) {
    bool upd = chmax(ma, cnt);
    if (upd) argma = val;
  }
  int ans = 0;
  for (auto &val : st) {
    if (val == argma) continue;
    vvi v(2 * n + 5);
    int now = 0;
    v[n].push_back(-1);
    for (int i = 0; i < (n); ++i) {
      if (a[i] == argma) {
        now++;
      } else if (a[i] == val) {
        now--;
      }
      v[now + n].push_back(i);
    }
    for (int i = 0; i < (2 * n + 5); ++i) {
      int mi = INF, ma = -INF;
      for (int j = 0; j < (((int)(v[i]).size())); ++j) {
        chmin(mi, v[i][j]);
        chmax(ma, v[i][j]);
      }
      if (mi != INF && ma != -INF && mi != ma) {
        chmax(ans, ma - mi);
      }
    }
  }
  cout << ans << endl;
  return 0;
}

```


### Prompt

Create a solution in Cpp for the following problem:

You are given n points on a plane. All points are different.

Find the number of different groups of three points (A, B, C) such that point B is the middle of segment AC.

The groups of three points are considered unordered, that is, if point B is the middle of segment AC, then groups (A, B, C) and (C, B, A) are considered the same.

Input

The first line contains a single integer n (3 ≤ n ≤ 3000) — the number of points.

Next n lines contain the points. The i-th line contains coordinates of the i-th point: two space-separated integers xi, yi ( - 1000 ≤ xi, yi ≤ 1000).

It is guaranteed that all given points are different.

Output

Print the single number — the answer to the problem.

Examples

Input

3
1 1
2 2
3 3

Output

1

Input

3
0 0
-1 0
0 1

Output

0

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
int cot[4010][4010];
int main() {
  int x[3010], y[3010];
  int n, i, j;
  while (cin >> n) {
    memset(cot, 0, sizeof(cot));
    for (i = 0; i < n; i++) {
      cin >> x[i] >> y[i];
      x[i] += 1000;
      y[i] += 1000;
    }
    int ans = 0;
    for (i = 0; i < n; i++) {
      for (j = i + 1; j < n; j++) {
        cot[x[i] + x[j]][y[i] + y[j]]++;
      }
    }
    for (i = 0; i < n; i++) {
      ans += cot[x[i] * 2][y[i] * 2];
    }
    cout << ans << endl;
  }
}

```


### Prompt

Generate a CPP solution to the following problem:

At University A, there were many mistakes in entering IDs.
Therefore, University A decided to issue a new ID to prevent typos.
There is a way to check if the new ID is correct to prevent typos.

・ Calculate the sum of all digits.
・ However, the number of even-numbered digits is doubled, with the rightmost digit as the first digit.
-When the number becomes 10 or more by doubling, the number obtained by adding the 1st digit and the 10th digit is used as the digit number.
・ If the sum is divisible by 10, the ID is correct, otherwise it is incorrect.

As an example, check the ID 53579.
Since the sum of all digits is calculated,
5 + 3 + 5 + 7 + 9

However, since the number of even-numbered digits is doubled,
5 + 6 + 5 + 14 + 9

When the number becomes 10 or more by doubling, the number obtained by adding the ones digit and the tens digit is the digit number.
5 + 6 + 5 + (1 + 4) + 9

From the above, the total sum is 30. Since 30 is divisible by 10, 53579 is the correct ID.

Mr. B is a college student at University A and was issued a new ID, but he forgot some digits of the ID.
However, I succeeded in narrowing down some candidates as to what kind of numbers will be included in the forgotten part.
Your job is to find out how many correct combinations of B's IDs are available.

Input

The input is given in the following format.

n
ID
m
a0 a1 ... am-1

n is the number of digits in the ID.
Each digit of the ID contains a number from 0 to 9 or the letter'*' to indicate that it is a forgotten digit.
m is the number of candidate numbers in the'*'.
ai is a candidate for numbers in'*'.

Input meets the following constraints
1 ≤ n ≤ 100,000
1 ≤ m ≤ 10
0 ≤ ai ≤ 9
Number of 1 ≤'*' ≤ 7

Output

Output the answer value on one line

Examples

Input

5
5*57*
2
3 9

Output

1

Input

15
2***9*2*6*1199*
9
0 1 2 3 4 6 7 8 9

Output

478297

### Response

```cpp
#include<iostream>
#include<algorithm>
#include<string>
using namespace std;
int m, n, a[10], a_2[10], ID[100001];
int dp[100001][10];
int table[] = { 0, 2, 4, 6, 8, 1, 3, 5, 7, 9};

int rec( int now, int sum ){
  if(now == n + 1) return sum % 10 == 0;
  if(~dp[now][sum % 10]) return dp[now][sum % 10];

  int ret = 0;
  if(~ID[now]){
    ret += rec( now + 1, sum + ID[now]);
  }else{
    if(now & 1)
      for(int i = 0 ; i < m ; i++ ){
        ret += rec( now + 1, sum + a[i]);
      }
    else
      for(int i = 0 ; i < m ; i++ ){
        ret += rec( now + 1, sum + a_2[i]);
      }
  }
  return dp[now][sum % 10] = ret;
}

int main(){
  fill_n( *dp, 100001 * 10, -1);
  cin >> n;
  for(int i = n ; i ; i-- ){
    char c;
    cin >> c;
    if(c == '*') ID[i] = -1;
    else ID[i] = i % 2 ? c - '0' : table[c - '0'];
  }
  cin >> m;
  for(int i = 0 ; i < m ; i++ ){
    cin >> a[i];
    a_2[i] = table[a[i]];
  }
  cout << rec( 1, 0) << endl;
}
```


### Prompt

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

Takahashi and Aoki are playing a stone-taking game. Initially, there are N piles of stones, and the i-th pile contains A_i stones and has an associated integer K_i.

Starting from Takahashi, Takahashi and Aoki take alternate turns to perform the following operation:

* Choose a pile. If the i-th pile is selected and there are X stones left in the pile, remove some number of stones between 1 and floor(X/K_i) (inclusive) from the pile.

The player who first becomes unable to perform the operation loses the game. Assuming that both players play optimally, determine the winner of the game. Here, floor(x) represents the largest integer not greater than x.

Constraints

* 1 \leq N \leq 200
* 1 \leq A_i,K_i \leq 10^9
* All input values are integers.

Input

Input is given from Standard Input in the following format:

N
A_1 K_1
:
A_N K_N

Output

If Takahashi will win, print `Takahashi`; if Aoki will win, print `Aoki`.

Examples

Input

2
5 2
3 3

Output

Aoki

Input

3
3 2
4 3
5 1

Output

Takahashi

Input

3
28 3
16 4
19 2

Output

Aoki

Input

4
3141 59
26535 897
93 23
8462 64

Output

Takahashi

### Response

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

using namespace std;

int main()
{
	int n, r = 0;
	cin >> n;
	for (int i = 0; i < n; i++) {
		int a, k;
		cin >> a >> k;
		for (;;) {
			int b = a % k % (a / k + 1);
			if (!b) break;
			a += b - a / k - a % k - 1;
		}
		r ^= a / k;
	}
	cout << (r ? "Takahashi" : "Aoki") << endl;
	return 0;
}

```


### Prompt

Please create a solution in cpp to the following problem:

Limak is a little bear who loves to play. Today he is playing by destroying block towers. He built n towers in a row. The i-th tower is made of hi identical blocks. For clarification see picture for the first sample.

Limak will repeat the following operation till everything is destroyed.

Block is called internal if it has all four neighbors, i.e. it has each side (top, left, down and right) adjacent to other block or to the floor. Otherwise, block is boundary. In one operation Limak destroys all boundary blocks. His paws are very fast and he destroys all those blocks at the same time.

Limak is ready to start. You task is to count how many operations will it take him to destroy all towers.

Input

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

The second line contains n space-separated integers h1, h2, ..., hn (1 ≤ hi ≤ 109) — sizes of towers.

Output

Print the number of operations needed to destroy all towers.

Examples

Input

6
2 1 4 6 2 2

Output

3

Input

7
3 3 3 1 3 3 3

Output

2

Note

The picture below shows all three operations for the first sample test. Each time boundary blocks are marked with red color.

<image> After first operation there are four blocks left and only one remains after second operation. This last block is destroyed in third operation.

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
const int maxn = 100000 + 5;
int n;
int l[maxn], r[maxn], h[maxn];
int main() {
  while (cin >> n) {
    for (int i = 1; i <= n; i++) {
      scanf("%d", &h[i]);
    }
    h[0] = l[0] = h[n + 1] = r[n + 1] = 0;
    for (int i = 1; i <= n; i++) {
      l[i] = min(l[i - 1] + 1, h[i]);
    }
    for (int i = n; i >= 1; i--) {
      r[i] = min(r[i + 1] + 1, h[i]);
    }
    int ans = 0;
    for (int i = 1; i <= n; i++) {
      ans = max(ans, min(r[i], l[i]));
    }
    cout << ans << endl;
  }
}

```


### Prompt

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

Given the number n, find the smallest positive integer which has exactly n divisors. It is guaranteed that for the given n the answer will not exceed 1018.

Input

The first line of the input contains integer n (1 ≤ n ≤ 1000).

Output

Output the smallest positive integer with exactly n divisors.

Examples

Input

4

Output

6

Input

6

Output

12

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
const int prime[16] = {2,  3,  5,  7,  11, 13, 17, 19,
                       23, 29, 31, 37, 41, 43, 47, 53};
const int lmlog[16] = {59, 37, 25, 21, 17, 16, 14, 14,
                       13, 12, 12, 11, 11, 11, 10, 10};
const int maxN = 1000;
const unsigned long long oo = 1000000000000000001;
int n;
unsigned long long ppow[16][60];
unsigned long long f[maxN + 1][17];
int main() {
  cin >> n;
  int i, j, k;
  for (i = 0; i < 16; ++i) {
    ppow[i][0] = 1;
    for (j = 1; j <= lmlog[i]; ++j) ppow[i][j] = ppow[i][j - 1] * prime[i];
  }
  for (i = 1; i <= n; ++i) f[i][0] = oo;
  for (i = 0; i <= 16; ++i) f[1][i] = 1;
  for (j = 1; j <= 16; ++j)
    for (i = 2; i <= n; ++i) {
      f[i][j] = f[i][j - 1];
      for (k = 1; k < lmlog[j - 1]; ++k)
        if (i % (k + 1) == 0 && f[i / (k + 1)][j - 1] < oo &&
            f[i / (k + 1)][j - 1] < oo / ppow[j - 1][k])
          f[i][j] = min(f[i][j], f[i / (k + 1)][j - 1] * ppow[j - 1][k]);
    }
  cout << f[n][16];
}

```


### Prompt

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

It's the year 4527 and the tanks game that we all know and love still exists. There also exists Great Gena's code, written in 2016. The problem this code solves is: given the number of tanks that go into the battle from each country, find their product. If it is turns to be too large, then the servers might have not enough time to assign tanks into teams and the whole game will collapse!

There are exactly n distinct countries in the world and the i-th country added ai tanks to the game. As the developers of the game are perfectionists, the number of tanks from each country is beautiful. A beautiful number, according to the developers, is such number that its decimal representation consists only of digits '1' and '0', moreover it contains at most one digit '1'. However, due to complaints from players, some number of tanks of one country was removed from the game, hence the number of tanks of this country may not remain beautiful.

Your task is to write the program that solves exactly the same problem in order to verify Gena's code correctness. Just in case.

Input

The first line of the input contains the number of countries n (1 ≤ n ≤ 100 000). The second line contains n non-negative integers ai without leading zeroes — the number of tanks of the i-th country.

It is guaranteed that the second line contains at least n - 1 beautiful numbers and the total length of all these number's representations doesn't exceed 100 000.

Output

Print a single number without leading zeroes — the product of the number of tanks presented by each country.

Examples

Input

3
5 10 1

Output

50

Input

4
1 1 10 11

Output

110

Input

5
0 3 1 100 1

Output

0

Note

In sample 1 numbers 10 and 1 are beautiful, number 5 is not not.

In sample 2 number 11 is not beautiful (contains two '1's), all others are beautiful.

In sample 3 number 3 is not beautiful, all others are beautiful.

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, y, s = 0, j = 0, k = 0;
  vector<int> T;
  cin >> n;
  string m;
  string mot = "";
  while (j < n) {
    cin >> m;
    if (m == "0") {
      cout << 0;
      return 0;
    }
    for (int i = 0; i < m.size(); i++) {
      if (m[i] == '0') s++;
    }
    if ((s == m.size() - 1) && (m[0] == '1')) {
      k += s;
    } else {
      mot = m;
    }
    s = 0;
    j++;
  }
  if (mot != "") {
    cout << mot;
  } else
    cout << 1;
  for (int i = 1; i <= k; i++) {
    cout << '0';
  }
  return 0;
}

```


### Prompt

Generate a Cpp solution to the following problem:

You are visiting a large electronics store to buy a refrigerator and a microwave.

The store sells A kinds of refrigerators and B kinds of microwaves. The i-th refrigerator ( 1 \le i \le A ) is sold at a_i yen (the currency of Japan), and the j-th microwave ( 1 \le j \le B ) is sold at b_j yen.

You have M discount tickets. With the i-th ticket ( 1 \le i \le M ), you can get a discount of c_i yen from the total price when buying the x_i-th refrigerator and the y_i-th microwave together. Only one ticket can be used at a time.

You are planning to buy one refrigerator and one microwave. Find the minimum amount of money required.

Constraints

* All values in input are integers.
* 1 \le A \le 10^5
* 1 \le B \le 10^5
* 1 \le M \le 10^5
* 1 \le a_i , b_i , c_i \le 10^5
* 1 \le x_i \le A
* 1 \le y_i \le B
* c_i \le a_{x_i} + b_{y_i}

Input

Input is given from Standard Input in the following format:

A B M
a_1 a_2 ... a_A
b_1 b_2 ... b_B
x_1 y_1 c_1
\vdots
x_M y_M c_M

Output

Print the answer.

Examples

Input

2 3 1
3 3
3 3 3
1 2 1

Output

5

Input

1 1 2
10
10
1 1 5
1 1 10

Output

10

Input

2 2 1
3 5
3 5
2 2 2

Output

6

### Response

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

int main() {
  int A, B, M;
  cin >> A >> B >> M;
  vector<int> a(A), b(B);
  for (auto &x : a) cin >> x;
  for (auto &x : b) cin >> x;
  int ans = 1e9;
  for (int i = 0, x, y, c; cin >> x >> y >> c; i++)
    ans = min(ans, a.at(--x) + b.at(--y) - c);
  sort(a.begin(), a.end());
  sort(b.begin(), b.end());
  cout << min(ans, a.at(0) + b.at(0)) << "\n";
}
```


### Prompt

Construct a Cpp code solution to the problem outlined:

Everybody knows that the Berland citizens are keen on health, especially students. Berland students are so tough that all they drink is orange juice!

Yesterday one student, Vasya and his mates made some barbecue and they drank this healthy drink only. After they ran out of the first barrel of juice, they decided to play a simple game. All n people who came to the barbecue sat in a circle (thus each person received a unique index bi from 0 to n - 1). The person number 0 started the game (this time it was Vasya). All turns in the game were numbered by integers starting from 1. If the j-th turn was made by the person with index bi, then this person acted like that:

  1. he pointed at the person with index (bi + 1) mod n either with an elbow or with a nod (x mod y is the remainder after dividing x by y);
  2. if j ≥ 4 and the players who had turns number j - 1, j - 2, j - 3, made during their turns the same moves as player bi on the current turn, then he had drunk a glass of juice;
  3. the turn went to person number (bi + 1) mod n.

The person who was pointed on the last turn did not make any actions.

The problem was, Vasya's drunk too much juice and can't remember the goal of the game. However, Vasya's got the recorded sequence of all the participants' actions (including himself). Now Vasya wants to find out the maximum amount of juice he could drink if he played optimally well (the other players' actions do not change). Help him.

You can assume that in any scenario, there is enough juice for everybody.

Input

The first line contains a single integer n (4 ≤ n ≤ 2000) — the number of participants in the game. The second line describes the actual game: the i-th character of this line equals 'a', if the participant who moved i-th pointed at the next person with his elbow, and 'b', if the participant pointed with a nod. The game continued for at least 1 and at most 2000 turns.

Output

Print a single integer — the number of glasses of juice Vasya could have drunk if he had played optimally well.

Examples

Input

4
abbba

Output

1

Input

4
abbab

Output

0

Note

In both samples Vasya has got two turns — 1 and 5. In the first sample, Vasya could have drunk a glass of juice during the fifth turn if he had pointed at the next person with a nod. In this case, the sequence of moves would look like "abbbb". In the second sample Vasya wouldn't drink a single glass of juice as the moves performed during turns 3 and 4 are different.

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
int i, j, k, n, m, x, y, z, l, now, sum;
char ch[3000], c;
int main() {
  scanf("%d", &n);
  scanf("%s", &ch);
  l = strlen(ch);
  now = 0;
  sum = 0;
  for (i = 0; i < l; i++) {
    if (now == 0) {
      if (i >= 3) {
        c = ch[i - 1];
        if ((ch[i - 2] == c) && (ch[i - 3] == c)) sum++;
        ch[i] = c;
      }
    }
    now++;
    now = now % n;
  }
  printf("%d", sum);
  return 0;
}

```