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
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.Arrays;
import java.util.Deque;
import java.util.function.Supplier;
import java.io.OutputStreamWriter;
import java.io.OutputStream;
import java.util.Collection;
import java.io.IOException;
import java.io.UncheckedIOException;
import java.util.function.Consumer;
import java.io.Closeable;
import java.io.Writer;
import java.util.ArrayDeque;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) throws Exception {
        Thread thread = new Thread(null, new TaskAdapter(), "", 1 << 29);
        thread.start();
        thread.join();
    }

    static class TaskAdapter implements Runnable {
        @Override
        public void run() {
            InputStream inputStream = System.in;
            OutputStream outputStream = System.out;
            FastInput in = new FastInput(inputStream);
            FastOutput out = new FastOutput(outputStream);
            GSubstringSearch solver = new GSubstringSearch();
            solver.solve(1, in, out);
            out.close();
        }
    }

    static class GSubstringSearch {
        public void solve(int testNumber, FastInput in, FastOutput out) {
            int[] perm = new int[26];
            for (int i = 0; i < 26; i++) {
                perm[i] = in.ri() - 1;
            }
            char[] s = new char[(int) 2e5];
            char[] t = new char[(int) 2e5];
            int n = in.rs(s);
            int m = in.rs(t);
            int[][] pattern = new int[2][n];
            for (int i = 0; i < n; i++) {
                pattern[0][i] = s[i] - 'a';
                pattern[1][i] = perm[s[i] - 'a'];
            }
            int[] source = new int[m];
            for (int i = 0; i < m; i++) {
                source[i] = t[i] - 'a';
            }
            MultiMatch mm = new MultiMatch();
            boolean[] match = mm.match(pattern, source, false);
            for (int i = 0; i + n <= m; i++) {
                out.append(match[i] ? 1 : 0);
            }
        }

    }

    static class PrimitiveBuffers {
        public static Buffer<int[]>[] intPow2Bufs = new Buffer[30];
        public static Buffer<double[]>[] doublePow2Bufs = new Buffer[30];

        static {
            for (int i = 0; i < 30; i++) {
                int finalI = i;
                intPow2Bufs[i] = new Buffer<>(() -> new int[1 << finalI], x -> Arrays.fill(x, 0));
                doublePow2Bufs[i] = new Buffer<>(() -> new double[1 << finalI], x -> Arrays.fill(x, 0));
            }
        }

        public static int[] allocIntPow2(int n) {
            return intPow2Bufs[Log2.ceilLog(n)].alloc();
        }

        public static void release(int[] data) {
            intPow2Bufs[Log2.ceilLog(data.length)].release(data);
        }

        public static double[] allocDoublePow2(int n) {
            return doublePow2Bufs[Log2.ceilLog(n)].alloc();
        }

        public static double[][] allocDoublePow2Array(int n, int arraySize) {
            double[][] ans = new double[arraySize][];
            for (int i = 0; i < arraySize; i++) {
                ans[i] = allocDoublePow2(n);
            }
            return ans;
        }

        public static void release(double[] data) {
            doublePow2Bufs[Log2.ceilLog(data.length)].release(data);
        }

        public static void release(double[]... data) {
            for (double[] x : data) {
                release(x);
            }
        }

        public static int[][] allocIntPow2Array(int n, int arraySize) {
            int[][] ans = new int[arraySize][];
            for (int i = 0; i < arraySize; i++) {
                ans[i] = allocIntPow2(n);
            }
            return ans;
        }

        public static void release(int[]... data) {
            for (int[] x : data) {
                release(x);
            }
        }

    }

    static class SequenceUtils {
        public static void swap(double[] data, int i, int j) {
            double tmp = data[i];
            data[i] = data[j];
            data[j] = tmp;
        }

        public static void deepFill(Object array, double val) {
            if (!array.getClass().isArray()) {
                throw new IllegalArgumentException();
            }
            if (array instanceof double[]) {
                double[] doubleArray = (double[]) array;
                Arrays.fill(doubleArray, val);
            } else {
                Object[] objArray = (Object[]) array;
                for (Object obj : objArray) {
                    deepFill(obj, val);
                }
            }
        }

        public static void reverse(double[] data, int l, int r) {
            while (l < r) {
                swap(data, l, r);
                l++;
                r--;
            }
        }

    }

    static class FastFourierTransform {
        private static double[][] realLevels = new double[30][];
        private static double[][] imgLevels = new double[30][];

        private static void prepareLevel(int i) {
            if (realLevels[i] == null) {
                realLevels[i] = new double[1 << i];
                imgLevels[i] = new double[1 << i];
                for (int j = 0, s = 1 << i; j < s; j++) {
                    realLevels[i][j] = Math.cos(Math.PI / s * j);
                    imgLevels[i][j] = Math.sin(Math.PI / s * j);
                }
            }
        }

        public static double[][] dotMul(double[][] a, double[][] b) {
            int n = a[0].length;
            double[][] ans = PrimitiveBuffers.allocDoublePow2Array(n, 2);
            for (int i = 0; i < n; i++) {
                mul(a[0][i], a[1][i], b[0][i], b[1][i], ans, i);
            }
            return ans;
        }

        public static void fft(double[][] p, boolean inv) {
            int m = Log2.ceilLog(p[0].length);
            int n = 1 << m;
            int shift = 32 - Integer.numberOfTrailingZeros(n);
            for (int i = 1; i < n; i++) {
                int j = Integer.reverse(i << shift);
                if (i < j) {
                    SequenceUtils.swap(p[0], i, j);
                    SequenceUtils.swap(p[1], i, j);
                }
            }

            double[][] t = new double[2][1];
            for (int d = 0; d < m; d++) {
                int s = 1 << d;
                int s2 = s << 1;
                prepareLevel(d);
                for (int i = 0; i < n; i += s2) {
                    for (int j = 0; j < s; j++) {
                        int a = i + j;
                        int b = a + s;
                        mul(realLevels[d][j], imgLevels[d][j], p[0][b], p[1][b], t, 0);
                        sub(p[0][a], p[1][a], t[0][0], t[1][0], p, b);
                        add(p[0][a], p[1][a], t[0][0], t[1][0], p, a);
                    }
                }
            }

            if (inv) {
                for (int i = 0, j = 0; i <= j; i++, j = n - i) {
                    double a = p[0][j];
                    double b = p[1][j];
                    div(p[0][i], p[1][i], n, p, j);
                    if (i != j) {
                        div(a, b, n, p, i);
                    }
                }
            }
        }

        public static void add(double r1, double i1, double r2, double i2, double[][] r, int i) {
            r[0][i] = r1 + r2;
            r[1][i] = i1 + i2;
        }

        public static void sub(double r1, double i1, double r2, double i2, double[][] r, int i) {
            r[0][i] = r1 - r2;
            r[1][i] = i1 - i2;
        }

        public static void mul(double r1, double i1, double r2, double i2, double[][] r, int i) {
            r[0][i] = r1 * r2 - i1 * i2;
            r[1][i] = r1 * i2 + i1 * r2;
        }

        public static void div(double r1, double i1, double r2, double[][] r, int i) {
            r[0][i] = r1 / r2;
            r[1][i] = i1 / r2;
        }

    }

    static class MultiMatch {
        private int[][] sumOf(int[][] pattern, boolean matchAll) {
            int p = pattern.length;
            int n = pattern[0].length;
            int[][] A = PrimitiveBuffers.allocIntPow2Array(n, p * 2 + 1);
            int[] accumulate = PrimitiveBuffers.allocIntPow2(n);
            for (int i = 0; i < n; i++) {
                accumulate[i] = 1;
            }
            if (matchAll) {
                for (int[] pat : pattern) {
                    for (int i = 0; i < n; i++) {
                        if (pat[i] == 0) {
                            accumulate[i] = 0;
                        }
                    }
                }
            }
            sumOf(pattern, 0, A, 0, accumulate);
            PrimitiveBuffers.release(accumulate);
            return A;
        }

        private void sumOf(int[][] s, int pick, int[][] sum, int id, int[] accumulate) {
            int len = s[0].length;
            if (id >= s.length) {
                for (int i = 0; i < len; i++) {
                    sum[pick][i] += accumulate[i];
                }
                return;
            }
            sumOf(s, pick + 0, sum, id + 1, accumulate);
            int[] data = PrimitiveBuffers.allocIntPow2(len);
            for (int j = 0; j < len; j++) {
                data[j] = accumulate[j] * s[id][j] * 2;
            }
            sumOf(s, pick + 1, sum, id + 1, data);
            for (int j = 0; j < len; j++) {
                data[j] = accumulate[j] * s[id][j] * s[id][j];
            }
            sumOf(s, pick + 2, sum, id + 1, data);
            PrimitiveBuffers.release(data);
        }

        public boolean[] match(int[][] pattern, int[] source, boolean matchAll) {
            int n = source.length;
            int s = pattern.length;
            int m = pattern[0].length;
            int total = s * 2;
            int[] prodA = PrimitiveBuffers.allocIntPow2(n);
            Arrays.fill(prodA, 1);
            if (matchAll) {
                for (int i = 0; i < n; i++) {
                    prodA[i] = source[i];
                }
            }
            int[][] Bs = sumOf(pattern, matchAll);
            double[][] B = PrimitiveBuffers.allocDoublePow2Array(m + n - 1, 2);
            double[][] A = PrimitiveBuffers.allocDoublePow2Array(m + n - 1, 2);
            double[][] sum = PrimitiveBuffers.allocDoublePow2Array(m + n - 1, 2);
            for (int i = 0; i <= total; i++) {
                int j = total - i;
                SequenceUtils.deepFill(A, 0d);
                SequenceUtils.deepFill(B, 0d);
                if (j % 2 == 0) {
                    for (int k = 0; k < m; k++) {
                        B[0][k] = Bs[j][k];
                    }
                } else {
                    for (int k = 0; k < m; k++) {
                        B[0][k] = -Bs[j][k];
                    }
                }
                for (int k = 0; k < n; k++) {
                    A[0][k] = prodA[k];
                }
                SequenceUtils.reverse(A[0], 0, n - 1);
                FastFourierTransform.fft(A, false);
                FastFourierTransform.fft(B, false);
                double[][] dm = FastFourierTransform.dotMul(A, B);
                for (int t = 0; t < 2; t++) {
                    for (int k = 0; k < dm[t].length; k++) {
                        sum[t][k] += dm[t][k];
                    }
                }
                for (int k = 0; k < n; k++) {
                    prodA[k] *= source[k];
                }
                PrimitiveBuffers.release(dm);
            }
            FastFourierTransform.fft(sum, true);
            SequenceUtils.reverse(sum[0], 0, n - 1);
            boolean[] possible = new boolean[n];
            for (int i = 0; i + m <= n; i++) {
                possible[i] = -0.5 < sum[0][i] && sum[0][i] < 0.5;
            }
            PrimitiveBuffers.release(sum);
            PrimitiveBuffers.release(A);
            PrimitiveBuffers.release(prodA);
            PrimitiveBuffers.release(B);
            PrimitiveBuffers.release(Bs);
            return possible;
        }

    }

    static class Buffer<T> {
        private Deque<T> deque;
        private Supplier<T> supplier;
        private Consumer<T> cleaner;
        private int allocTime;
        private int releaseTime;

        public Buffer(Supplier<T> supplier) {
            this(supplier, (x) -> {
            });
        }

        public Buffer(Supplier<T> supplier, Consumer<T> cleaner) {
            this(supplier, cleaner, 0);
        }

        public Buffer(Supplier<T> supplier, Consumer<T> cleaner, int exp) {
            this.supplier = supplier;
            this.cleaner = cleaner;
            deque = new ArrayDeque<>(exp);
        }

        public T alloc() {
            allocTime++;
            return deque.isEmpty() ? supplier.get() : deque.removeFirst();
        }

        public void release(T e) {
            releaseTime++;
            cleaner.accept(e);
            deque.addLast(e);
        }

    }

    static class FastOutput implements AutoCloseable, Closeable, Appendable {
        private static final int THRESHOLD = 1 << 13;
        private final Writer os;
        private StringBuilder cache = new StringBuilder(THRESHOLD * 2);

        public FastOutput append(CharSequence csq) {
            cache.append(csq);
            return this;
        }

        public FastOutput append(CharSequence csq, int start, int end) {
            cache.append(csq, start, end);
            return this;
        }

        private void afterWrite() {
            if (cache.length() < THRESHOLD) {
                return;
            }
            flush();
        }

        public FastOutput(Writer os) {
            this.os = os;
        }

        public FastOutput(OutputStream os) {
            this(new OutputStreamWriter(os));
        }

        public FastOutput append(char c) {
            cache.append(c);
            afterWrite();
            return this;
        }

        public FastOutput append(int c) {
            cache.append(c);
            afterWrite();
            return this;
        }

        public FastOutput flush() {
            try {
                os.append(cache);
                os.flush();
                cache.setLength(0);
            } catch (IOException e) {
                throw new UncheckedIOException(e);
            }
            return this;
        }

        public void close() {
            flush();
            try {
                os.close();
            } catch (IOException e) {
                throw new UncheckedIOException(e);
            }
        }

        public String toString() {
            return cache.toString();
        }

    }

    static class FastInput {
        private final InputStream is;
        private byte[] buf = new byte[1 << 13];
        private int bufLen;
        private int bufOffset;
        private int next;

        public FastInput(InputStream is) {
            this.is = is;
        }

        private int read() {
            while (bufLen == bufOffset) {
                bufOffset = 0;
                try {
                    bufLen = is.read(buf);
                } catch (IOException e) {
                    bufLen = -1;
                }
                if (bufLen == -1) {
                    return -1;
                }
            }
            return buf[bufOffset++];
        }

        public void skipBlank() {
            while (next >= 0 && next <= 32) {
                next = read();
            }
        }

        public int ri() {
            return readInt();
        }

        public int readInt() {
            int sign = 1;

            skipBlank();
            if (next == '+' || next == '-') {
                sign = next == '+' ? 1 : -1;
                next = read();
            }

            int val = 0;
            if (sign == 1) {
                while (next >= '0' && next <= '9') {
                    val = val * 10 + next - '0';
                    next = read();
                }
            } else {
                while (next >= '0' && next <= '9') {
                    val = val * 10 - next + '0';
                    next = read();
                }
            }

            return val;
        }

        public int rs(char[] data, int offset) {
            return readString(data, offset);
        }

        public int rs(char[] data) {
            return rs(data, 0);
        }

        public int readString(char[] data, int offset) {
            skipBlank();

            int originalOffset = offset;
            while (next > 32) {
                data[offset++] = (char) next;
                next = read();
            }

            return offset - originalOffset;
        }

    }

    static class Log2 {
        public static int ceilLog(int x) {
            if (x <= 0) {
                return 0;
            }
            return 32 - Integer.numberOfLeadingZeros(x - 1);
        }

    }
}

