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 JAVA):

Solution:
import java.util.*;

import java.io.*;
import java.math.*;
import java.awt.geom.*;

import static java.lang.Math.*;

public class Solution implements Runnable {

	long mod1 = (long) 1e9 + 7;
	int mod2 = 998244353;

	public void solve() throws Exception {
		String s=sc.nextToken();
		String t=sc.nextToken();
		int n=s.length();
		int m=t.length();
		if(m>n)
		{
			out.println(s);
			return;
		}
		int count1=0;
		int count2=0;
		for(int i=0;i<n;i++)
		{
			if(s.charAt(i)=='0') count1++;
		}
		for(int i=0;i<m;i++)
		{
			if(t.charAt(i)=='0') count2++;
		}
		int table[]=new int[m];
		int i=0,j=1;
		
		while(i<m && j<m)
		{
			if(t.charAt(i)==t.charAt(j))
			{
				table[j]=i+1;
				i++;
				j++;
			}
			else
			{
				i=0;
				if(t.charAt(i)==t.charAt(j))
				{
					table[j]=i+1;
					i++;
				}
				j++;
				
			}
		}
		int value=table[m-1];
		int count3=0;
		for(i=value;i<m;i++)
		{
			if(t.charAt(i)=='0')
				count3++;
		}
		//out.println(count1+" "+count2+" "+count3);
		if(count2>count1 || m-count2>n-count1)
		{
			out.println(s);
			return;
		}
		int count11=n-count1;
		int count22=m-count2;
		count1-=count2;
		count11-=count22;
		//out.println(count1+" "+count11+" "+count3);
		int count33=m-value-count3;
		int a=0,b=0;
		if(count3==0) a=Integer.MAX_VALUE;
		else a=count1/count3;
		if(count33==0) b=Integer.MAX_VALUE;
		else b=count11/count33;
		int max=Math.min(a,b);
		out.print(t);
		for(i=0;i<max;i++)
		{
			out.print(t.substring(value));
		}
		count11-=max*count33;
		count1-=max*count3;
		for(i=0;i<count11;i++)out.print(1);
		for(i=0;i<count1;i++)out.print(0);
		
		
		
		

	}

	static void sort(int[] a) {
		ArrayList<Integer> l = new ArrayList<>();
		for (int i : a)
			l.add(i);
		Collections.sort(l);
		for (int i = 0; i < a.length; i++)
			a[i] = l.get(i);
	}

	static long gcd(long a, long b) {
		if (a == 0)
			return b;
		return gcd(b % a, a);
	}

	static long ncr(int n, int r, long p) {
		if (r > n)
			return 0l;
		if (r > n - r)
			r = n - r;

		long C[] = new long[r + 1];

		C[0] = 1;

		for (int i = 1; i <= n; i++) {

			for (int j = Math.min(i, r); j > 0; j--)
				C[j] = (C[j] + C[j - 1]) % p;
		}
		return C[r] % p;
	}

	public long power(long x, long y, long p) {
		long res = 1;
		// out.println(x+" "+y);
		x = x % p;
		if (x == 0)
			return 0;

		while (y > 0) {
			if ((y & 1) == 1)
				res = (res * x) % p;
			y = y >> 1;
			x = (x * x) % p;
		}
		return res;
	}

	static Throwable uncaught;

	BufferedReader in;
	FastScanner sc;
	PrintWriter out;

	@Override
	public void run() {
		try {
			in = new BufferedReader(new InputStreamReader(System.in));
			out = new PrintWriter(System.out);
			sc = new FastScanner(in);
			solve();
		} catch (Throwable uncaught) {
			Solution.uncaught = uncaught;
		} finally {
			out.close();
		}
	}

	public static void main(String[] args) throws Throwable {
		Thread thread = new Thread(null, new Solution(), "", (1 << 26));
		thread.start();
		thread.join();
		if (Solution.uncaught != null) {
			throw Solution.uncaught;
		}
	}

}

class FastScanner {

	BufferedReader in;
	StringTokenizer st;

	public FastScanner(BufferedReader in) {
		this.in = in;
	}

	public String nextToken() throws Exception {
		while (st == null || !st.hasMoreTokens()) {
			st = new StringTokenizer(in.readLine());
		}
		return st.nextToken();
	}

	public int nextInt() throws Exception {
		return Integer.parseInt(nextToken());
	}

	public int[] readArray(int n) throws Exception {
		int[] a = new int[n];
		for (int i = 0; i < n; i++)
			a[i] = nextInt();
		return a;
	}

	public long nextLong() throws Exception {
		return Long.parseLong(nextToken());
	}

	public double nextDouble() throws Exception {
		return Double.parseDouble(nextToken());
	}

}