Problem: Let's assume that p and q are strings of positive length, called the container and the key correspondingly, string q only consists of characters 0 and 1. Let's take a look at a simple algorithm that extracts message s from the given container p:
    
    
      
    i = 0;  
    j = 0;  
    s = <>;  
    while i is less than the length of the string p  
    {  
        if q[j] == 1, then add to the right of string s character p[i];  
        increase variables i, j by one;  
        if the value of the variable j equals the length of the string q, then j = 0;   
    }  
    

In the given pseudocode i, j are integer variables, s is a string, '=' is an assignment operator, '==' is a comparison operation, '[]' is the operation of obtaining the string character with the preset index, '<>' is an empty string. We suppose that in all strings the characters are numbered starting from zero. 

We understand that implementing such algorithm is quite easy, so your task is going to be slightly different. You need to construct the lexicographically minimum key of length k, such that when it is used, the algorithm given above extracts message s from container p (otherwise find out that such key doesn't exist).

Input

The first two lines of the input are non-empty strings p and s (1 ≤ |p| ≤ 106, 1 ≤ |s| ≤ 200), describing the container and the message, correspondingly. The strings can contain any characters with the ASCII codes from 32 to 126, inclusive.

The third line contains a single integer k (1 ≤ k ≤ 2000) — the key's length.

Output

Print the required key (string of length k, consisting only of characters 0 and 1). If the key doesn't exist, print the single character 0.

Examples

Input

abacaba
aba
6


Output

100001


Input

abacaba
aba
3


Output

0

Note

String x = x1x2... xp is lexicographically smaller than string y = y1y2... yq, if either p < q and x1 = y1, x2 = y2, ... , xp = yp, or there exists such integer r (0 ≤ r < min(p, q)) that x1 = y1, x2 = y2, ... , xr = yr and xr + 1 < yr + 1. Symbols are compared according to their ASCII codes.

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
struct ii {
  int x, y;
  ii(int x = 0, int y = 0) : x(x), y(y) {}
  bool operator<(const ii &a) const {
    if (x != a.x) return x < a.x;
    return y < a.y;
  }
  bool operator==(const ii &a) const { return x == a.x && y == a.y; }
  ii friend operator+(ii a, ii b) { return ii(a.x + b.x, a.y + b.y); }
  ii friend operator-(ii a, ii b) { return ii(a.x - b.x, a.y - b.y); }
};
template <class T>
void sc(T &x) {
  x = 0;
  char c;
  int f = 1;
  while (c = getchar(), c < 48)
    if (c == '-') f = -1;
  do x = x * 10 + (c ^ 48);
  while (c = getchar(), c > 47);
  x *= f;
}
template <class T>
void nt(T x) {
  if (!x) return;
  nt(x / 10);
  putchar(x % 10 + '0');
}
template <class T>
void pt(T x) {
  if (x < 0) putchar('-'), x = -x;
  if (!x)
    putchar('0');
  else
    nt(x);
}
template <class T>
void pts(T x) {
  pt(x);
  putchar(' ');
}
template <class T>
void ptn(T x) {
  pt(x);
  putchar('\n');
}
template <class v>
void pp(v x, int y) {
  static char ch[] = {" \n"};
  pt(x);
  putchar(ch[y]);
}
template <class T>
void PP(T *x, int y) {
  for (int i = 0, i_ = (y)-1; i <= i_; ++i) pp(x[i], i == y - 1);
}
template <class T>
void Max(T &x, T y) {
  if (x < y) x = y;
}
template <class T>
void Min(T &x, T y) {
  if (x > y) x = y;
}
int n, m, K;
char A[1000005], B[205];
unsigned long long S[205], T[1000005];
const unsigned long long H = 137;
int flag, Ans[2005], Tmp[2005];
void solve(int L) {
  for (int i = (n)-1, i_ = 0; i >= i_; --i) {
    T[i] = A[i];
    if (i + K < n) T[i] += H * T[i + K];
  }
  for (int i = (m)-1, i_ = 0; i >= i_; --i) {
    S[i] = B[i];
    if (i + L < m) S[i] += H * S[i + L];
  }
  int top = L;
  for (int i = (K)-1, i_ = 0; i >= i_; --i) {
    if (top && T[i] == S[top - 1]) {
      Tmp[i] = 1;
      top--;
    } else
      Tmp[i] = 0;
  }
  if (!top) {
    if (!flag) {
      flag = 1;
      memcpy(Ans, Tmp, K << 2);
    } else {
      bool ok = 0;
      for (int i = 0, i_ = (K)-1; i <= i_; ++i) {
        if (Ans[i] != Tmp[i]) {
          ok = Tmp[i] < Ans[i];
          break;
        }
      }
      if (ok) memcpy(Ans, Tmp, K << 2);
    }
  }
}
int main() {
  while (A[n] = getchar(), A[n] != '\n') n++;
  A[n] = 0;
  while (B[m] = getchar(), B[m] != '\n') m++;
  B[m] = 0;
  sc(K);
  n = strlen(A);
  m = strlen(B);
  int T = (n + K - 1) / K;
  if (n % K == 0) {
    if (m % T || K < m / T) return puts("0"), 0;
    solve(m / T);
  } else {
    for (int i = 1, i_ = (K + 1) - 1; i <= i_; ++i) {
      if ((T - 1) * i <= m && m <= T * i) solve(i);
    }
  }
  if (!flag) return puts("0"), 0;
  for (int i = 0, i_ = (K)-1; i <= i_; ++i) pt(Ans[i]);
  puts("");
  return 0;
}