You are given a permutation p consisting of exactly 26 integers from 1 to 26 (since it is a permutation, each integer from 1 to 26 occurs in p exactly once) and two strings s and t consisting of lowercase Latin letters.

A substring t' of string t is an occurence of string s if the following conditions are met:

  1. |t'| = |s|; 
  2. for each i ∈ [1, |s|], either s_i = t'_i, or p_{idx(s_i)} = idx(t'_i), where idx(c) is the index of character c in Latin alphabet (idx(a) = 1, idx(b) = 2, idx(z) = 26). 



For example, if p_1 = 2, p_2 = 3, p_3 = 1, s = abc, t = abcaaba, then three substrings of t are occurences of s (they are t' = abc, t' = bca and t' = aba).

For each substring of t having length equal to |s|, check if it is an occurence of s.

Input

The first line contains 26 integers p_1, p_2, ..., p_{26} (1 ≤ p_i ≤ 26, all these integers are pairwise distinct).

The second line contains one string s, and the third line contains one string t (2 ≤ |s| ≤ |t| ≤ 2 ⋅ 10^5) both consisting of lowercase Latin letters.

Output

Print a string of |t| - |s| + 1 characters, each character should be either 0 or 1. The i-th character should be 1 if and only if the substring of t starting with the i-th character and ending with the (i + |s| - 1)-th character (inclusive) is an occurence of s.

Example

Input


2 3 1 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
abc
abcaaba


Output


11001
#include <bits/stdc++.h>
using namespace std;
const int inf = 1e9 + 7;
const int N = (1 << 18);
const long double Eps = 0.001;
const long double PI = acos(-1.0);
struct comp {
  long double r, c;
  comp(long double r = 0.0, long double c = 0.0) : r(r), c(c) {}
};
inline comp operator+(const comp &a, const comp &b) {
  return comp(a.r + b.r, a.c + b.c);
}
inline comp operator-(const comp &a, const comp &b) {
  return comp(a.r - b.r, a.c - b.c);
}
inline comp operator*(const comp &a, const comp &b) {
  return comp(a.r * b.r - a.c * b.c, a.r * b.c + a.c * b.r);
}
inline comp operator/(const comp &a, const long double &b) {
  return comp(a.r / b, a.c / b);
}
comp w[N];
void precalc() {
  w[0] = comp(1, 0);
  long double ang = 2 * PI / N;
  w[1] = comp(cos(ang), sin(ang));
  for (int i = 2; i < N; i++) w[i] = w[i - 1] * w[1];
}
vector<comp> fft(vector<comp> a, int co = 1) {
  int n = a.size();
  if (n == 1) return {a[0]};
  vector<comp> a1(n / 2), a2(n / 2);
  for (int i = 0; i < n / 2; i++) a1[i] = a[i * 2];
  for (int i = 0; i < n / 2; i++) a2[i] = a[i * 2 + 1];
  a1 = fft(a1, co * 2);
  a2 = fft(a2, co * 2);
  vector<comp> res(n);
  for (int i = 0; i < n; i++) {
    int ind = i;
    if (i >= n / 2) ind -= n / 2;
    res[i] = a1[ind] + (w[co * i] * a2[ind]);
  }
  return res;
}
vector<comp> rev_fft(vector<comp> a) {
  a = fft(a);
  vector<comp> b(a.size());
  for (int i = 0; i < N; i++) b[i] = a[(N - i) % N] / N;
  return b;
}
bitset<N> f(vector<comp> a, vector<comp> b, long double sum) {
  int rev_sz = N;
  for (int i = 0; i < rev_sz / 2; i++) swap(b[i], b[rev_sz - i - 1]);
  a = fft(a);
  b = fft(b);
  for (int i = 0; i < N; i++) a[i] = a[i] * b[i];
  a = rev_fft(a);
  bitset<N> res;
  for (int i = 0; i < rev_sz; i++) res[i] = a[rev_sz - i - 1].r >= sum - Eps;
  return res;
}
bitset<N> p_function(vector<int> a, vector<int> b) {
  int n1 = a.size(), n2 = b.size();
  a.emplace_back(-1);
  for (int i : b) a.emplace_back(i);
  vector<int> p(a.size());
  for (int i = 1; i < a.size(); i++) {
    int j = p[i - 1];
    while (j > 0 && a[j] != a[i]) j = p[j - 1];
    if (a[i] == a[j]) j++;
    p[i] = j;
  }
  bitset<N> res(false);
  int id = 0;
  for (int i = 2 * n1; i < a.size(); i++) res[id++] = p[i] == n1;
  return res;
}
void solve() {
  precalc();
  vector<int> p(26), com(26), ind(26), sz(26);
  string s, t;
  for (int i = 0; i < 26; i++) {
    cin >> p[i];
    p[i]--;
  }
  cin >> s >> t;
  int temp = 1;
  for (int i = 0; i < 26; i++) {
    if (com[i] == 0) {
      int v = i;
      int temp1 = 0;
      while (!com[v]) {
        com[v] = temp;
        ind[v] = temp1++;
        v = p[v];
      }
      v = i;
      do {
        sz[v] = temp1;
        v = p[v];
      } while (v != i);
      temp++;
    }
  }
  vector<int> s1(s.size()), t1(t.size());
  for (int i = 0; i < s.size(); i++) s1[i] = com[s[i] - 'a'];
  for (int i = 0; i < t.size(); i++) t1[i] = com[t[i] - 'a'];
  bitset<N> res = p_function(s1, t1);
  vector<comp> s2(N), t2(N);
  long double sum = 0;
  for (int i = 0; i < s.size(); i++) {
    long double ang = PI / sz[s[i] - 'a'];
    sum += cos(ang);
    ang = ang * 2 * ind[s[i] - 'a'];
    s2[i] = comp(cos(ang), sin(ang));
  }
  for (int i = 0; i < t.size(); i++) {
    long double ang = (PI - 2 * PI * ind[t[i] - 'a']) / sz[t[i] - 'a'];
    t2[i] = comp(cos(ang), sin(ang));
  }
  res &= f(s2, t2, sum);
  for (int i = 0; i < t.size() - s.size() + 1; i++) cout << res[i];
}
signed main() {
  cin.tie(0);
  cout.tie(0);
  ios_base::sync_with_stdio(0);
  solve();
}
