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.io.IOException;
import java.io.PrintWriter;
import java.util.NoSuchElementException;
public class Main{

	public static void main(String[] args){
		FastScanner sc = new FastScanner();
		
		String S = sc.next();
		String T = sc.next();
		PrintWriter out = new PrintWriter(System.out);
		int o = overlap(T,T);
		int a = 0;
		int b = 0;
		int c = 0;
		int d = 0;
		for(int i=0;i<T.length();i++){
			if(i<o){
				if(T.charAt(i)=='0'){
					a++;
				}else{
					b++;
				}
			}else{
				if(T.charAt(i)=='0'){
					c++;
				}else{
					d++;
				}
			}
		}
		int p = 0;
		int q = 0;
		for(int i=0;i<S.length();i++){
			if(S.charAt(i)=='0'){
				p++;
			}else{
				q++;
			}
		}
		//System.out.println(o);
		if(a+c>p||b+d>q){
			for(int i=0;i<p;i++){
				out.print(0);
			}
			for(int i=0;i<q;i++){
				out.print(1);
			}
		}else{
			out.print(T);
			p -= a+c;
			q -= b+d;
			//System.out.println(p+" "+q);
			//System.out.println(c+" "+d);
			int f = c==0?1000000:p/c;
			int g = d==0?1000000:q/d;
			int min = Math.min(f,g);
			for(int i=0;i<min;i++){
				out.print(T.substring(o));
			}
			p -= c * min;
			q -= d * min;
			for(int i=0;i<p;i++){
				out.print(0);
			}
			for(int i=0;i<q;i++){
				out.print(1);
			}
		}
		out.flush();
	}

	private static int overlap(String a, String b) {
		int l = a.length();
		long ah1 = 0;
		long ah2 = 0;
		long ah3 = 0;
		long bh1 = 0;
		long bh2 = 0;
		long bh3 = 0;
		long t1 = 1;
		long t2 = 1;
		long t3 = 1;
		int A = 1000000007;
		int B = 1000000009;
		int mod = 998244353;
		int ans = 0;
		for(int i=1;i<l;i++){
			ah1 = ah1 + a.charAt(l-i) * t1;
			ah1 %= mod;
			ah2 = ah2 + a.charAt(l-i) * t2;
			ah2 %= mod;
			bh1 = bh1 * A + b.charAt(i-1);
			bh1 %= mod;
			bh2 = bh2 * B + b.charAt(i-1);
			bh2 %= mod;
			if(ah1==bh1&&ah2==bh2&&ah3==bh3){
				ans = i;
			}
			t1 *= A;
			t1 %= mod;
			t2 *= B;
			t2  %= mod;

		}
		return ans;
		
	}

}




class FastScanner {
    private final java.io.InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;
    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        }else{
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }
    private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
    private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
    private void skipUnprintable() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;}
    public boolean hasNext() { skipUnprintable(); return hasNextByte();}
    public String next() {
        if (!hasNext()) throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while(isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }
    public long nextLong() {
        if (!hasNext()) throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while(true){
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            }else if(b == -1 || !isPrintableChar(b)){
                return (minus ? -n : n);
            }else{
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }
    public int nextInt() {
        if (!hasNext()) throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while(true){
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            }else if(b == -1 || !isPrintableChar(b)){
                return (int) (minus ? -n : n);
            }else{
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }
}