You are given two strings s and t consisting of lowercase English letters and an integer L.

We will consider generating a string of length L by concatenating one or more copies of s and t. Here, it is allowed to use the same string more than once.

For example, when s = `at`, t = `code` and L = 6, the strings `atatat`, `atcode` and `codeat` can be generated.

Among the strings that can be generated in this way, find the lexicographically smallest one. In the cases given as input, it is always possible to generate a string of length L.

Constraints

* 1 ≤ L ≤ 2 × 10^5
* 1 ≤ |s|, |t| ≤ L
* s and t consist of lowercase English letters.
* It is possible to generate a string of length L in the way described in Problem Statement.

Input

Input is given from Standard Input in the following format:


N
x_1 s_1
x_2 s_2
:
x_N s_N


Output

Print the lexicographically smallest string among the ones that can be generated in the way described in Problem Statement.

Examples

Input

6
at
code


Output

atatat


Input

8
coding
festival


Output

festival


Input

8
same
same


Output

samesame


Input

10
coin
age


Output

ageagecoin
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.UncheckedIOException;
import java.nio.charset.Charset;
import java.util.StringTokenizer;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.io.BufferedReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author mikit
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        LightScanner in = new LightScanner(inputStream);
        LightWriter out = new LightWriter(outputStream);
        GCoinage solver = new GCoinage();
        solver.solve(1, in, out);
        out.close();
    }

    static class GCoinage {
        public void solve(int testNumber, LightScanner in, LightWriter out) {
            // out.setBoolLabel(LightWriter.BoolLabel.YES_NO_FIRST_UP);
            int l = in.ints();
            String s = in.string(), t = in.string();
            StringBuilder x = new StringBuilder(), y = new StringBuilder();
            int a = find(s.length(), t.length(), l), b = find(t.length(), s.length(), l);
            for (int i = 0; i < a; i++) x.append(t);
            while (x.length() < l) x.append(s);
            for (int i = 0; i < b; i++) y.append(s);
            while (y.length() < l) y.append(t);
            String p = x.toString(), q = y.toString();
            if (p.compareTo(q) < 0) {
                out.ans(p).ln();
            } else {
                out.ans(q).ln();
            }
        }

        private static int find(int a, int b, int l) {
            for (int i = 0; i <= l; i++) {
                if ((l - a * i) % b == 0) return (l - a * i) / b;
            }
            throw new RuntimeException();
        }

    }

    static class LightWriter implements AutoCloseable {
        private final Writer out;
        private boolean autoflush = false;
        private boolean breaked = true;

        public LightWriter(Writer out) {
            this.out = out;
        }

        public LightWriter(OutputStream out) {
            this(new BufferedWriter(new OutputStreamWriter(out, Charset.defaultCharset())));
        }

        public LightWriter print(char c) {
            try {
                out.write(c);
                breaked = false;
            } catch (IOException ex) {
                throw new UncheckedIOException(ex);
            }
            return this;
        }

        public LightWriter print(String s) {
            try {
                out.write(s, 0, s.length());
                breaked = false;
            } catch (IOException ex) {
                throw new UncheckedIOException(ex);
            }
            return this;
        }

        public LightWriter ans(String s) {
            if (!breaked) {
                print(' ');
            }
            return print(s);
        }

        public LightWriter ln() {
            print(System.lineSeparator());
            breaked = true;
            if (autoflush) {
                try {
                    out.flush();
                } catch (IOException ex) {
                    throw new UncheckedIOException(ex);
                }
            }
            return this;
        }

        public void close() {
            try {
                out.close();
            } catch (IOException ex) {
                throw new UncheckedIOException(ex);
            }
        }

    }

    static class LightScanner {
        private BufferedReader reader = null;
        private StringTokenizer tokenizer = null;

        public LightScanner(InputStream in) {
            reader = new BufferedReader(new InputStreamReader(in));
        }

        public String string() {
            if (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new UncheckedIOException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int ints() {
            return Integer.parseInt(string());
        }

    }
}

