Problem: The new camp by widely-known over the country Spring Programming Camp is going to start soon. Hence, all the team of friendly curators and teachers started composing the camp's schedule. After some continuous discussion, they came up with a schedule s, which can be represented as a binary string, in which the i-th symbol is '1' if students will write the contest in the i-th day and '0' if they will have a day off.

At the last moment Gleb said that the camp will be the most productive if it runs with the schedule t (which can be described in the same format as schedule s). Since the number of days in the current may be different from number of days in schedule t, Gleb required that the camp's schedule must be altered so that the number of occurrences of t in it as a substring is maximum possible. At the same time, the number of contest days and days off shouldn't change, only their order may change.

Could you rearrange the schedule in the best possible way?

Input

The first line contains string s (1 ⩽ |s| ⩽ 500 000), denoting the current project of the camp's schedule.

The second line contains string t (1 ⩽ |t| ⩽ 500 000), denoting the optimal schedule according to Gleb.

Strings s and t contain characters '0' and '1' only.

Output

In the only line print the schedule having the largest number of substrings equal to t. Printed schedule should consist of characters '0' and '1' only and the number of zeros should be equal to the number of zeros in s and the number of ones should be equal to the number of ones in s.

In case there multiple optimal schedules, print any of them.

Examples

Input


101101
110


Output


110110

Input


10010110
100011


Output


01100011


Input


10
11100


Output


01

Note

In the first example there are two occurrences, one starting from first position and one starting from fourth position.

In the second example there is only one occurrence, which starts from third position. Note, that the answer is not unique. For example, if we move the first day (which is a day off) to the last position, the number of occurrences of t wouldn't change.

In the third example it's impossible to make even a single occurrence.

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
const int inf = 0x3f3f3f3f;
const long long mo = 998244353;
long long sx, sy, ex, ey, dx[6] = {0, 1, 0, -1, 0, 0},
                          dy[6] = {1, 0, -1, 0, 0, 0}, m, n, k,
                          dz[6]{0, 0, 0, 0, -1, 1}, sg;
long long p, no, v, ans, w;
int par[55];
long long a[400005], b[400005], c[500006], d1[400006], ma[500006], mi[500006],
    ne[200005];
long long bit[200005];
long long gcd(long long a, long long b) { return a ? gcd(b % a, a) : b; }
set<string> se;
struct node {
  long long u, w, v;
} a2[200005];
vector<node> eg;
long long qu(long long a, long long b, long long m) {
  long long ans = 1;
  while (b) {
    if (b & 1) {
      ans = ans % m * a % m;
    }
    b >>= 1;
    a = a % m * a % m;
  }
  return ans;
}
int su(int n) {
  if (n == 1 || n == 0) return 0;
  for (int i = 2; i <= sqrt(n); i++) {
    if (n % i == 0) return 0;
  }
  return 1;
}
long long query(int i) {
  long long ans = 0;
  while (i > 0) {
    ans += bit[i];
    i -= i & -i;
  }
  return ans;
}
void add(int i, long long x) {
  while (i <= n) {
    bit[i] += x;
    i += i & -i;
  }
}
int fi(int a) {
  if (a == par[a])
    return a;
  else
    return par[a] = fi(par[a]);
}
map<long long, long long> mp, mp1;
map<vector<pair<int, int> >, int> mp2;
priority_queue<pair<int, int> > que;
int vis[400005], vis1[400055];
long long dp[500][500];
vector<int> g[400000], g1[400000];
vector<long long> ve, ve1, ve2;
int cmp1(node a, node b) { return a.u > b.u; }
int cmp(node a, node b) { return a.v < b.v; }
long long lcm(long long a, long long b) { return a * b / gcd(a, b); }
string ans1;
inline long long read() {
  long long x = 0;
  bool t = false;
  char ch = getchar();
  while ((ch < '0' || ch > '9') && ch != '-') ch = getchar();
  if (ch == '-') t = true, ch = getchar();
  while (ch <= '9' && ch >= '0') x = x * 10 + ch - 48, ch = getchar();
  return t ? -x : x;
}
void ge(string &a) {
  int j = 0, k = -1;
  int n = a.size();
  ne[0] = -1;
  while (j < n) {
    if (k == -1 || a[j] == a[k])
      ne[++j] = ++k;
    else
      k = ne[k];
  }
}
int main() {
  int t, p2, p3;
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  string s, ss, sss;
  long long l, r, n1, u, l1, r1;
  int tot = 1;
  char ch, ch1;
  while (cin >> s >> ss) {
    ge(ss);
    int ct = 0, ct1 = 0;
    for (int i = 0; i < s.length(); i++) {
      if (s[i] == '1')
        ct++;
      else
        ct1++;
    }
    m = ss.length();
    p = 0;
    for (int i = 0; i < s.length(); i++) {
      if (ss[p] == '1') {
        if (ct)
          cout << 1, ct--, p++;
        else
          break;
      } else if (ct1)
        cout << 0, ct1--, p++;
      else
        break;
      if (p == m) p = ne[m];
    }
    while (ct) cout << 1, ct--;
    while (ct1) cout << 0, ct1--;
  }
}