#include <bits/stdc++.h>
using namespace std;
#define pb push_back
vector<char> upd(vector<char> mass) {
    for (int i = mass.size() - 1; i >= 0; --i) {
        if (mass[i] == '0') {
            mass[i] = '1';
            return mass;
        }
        mass[i] = '0';
    }
}
bool check(vector<char> mass1, vector<char> mass2) {
    for (int i = 0; i < mass1.size(); ++i) {
        if (mass1[i] == mass2[i]) continue;
        return true;
    }
    return false;
}
vector<char> ans(vector<vector<char> > mass) {
    vector<char> now;
    for (int i = 0; i < mass[0].size(); ++i) {
        int k = 0;
        for (int j = 0; j < mass.size(); ++j) {
            if (mass[j][i] == '1') k++;
        }
        if (k % 2 == 1) now.pb('1');
        else now.pb('0');
    }
    return now;
}
vector<char> get(vector<char> mass, vector<char> mass2) {
    for (int i = 0; i < mass.size(); ++i) {
        if (mass[i] == mass2[i]) continue;
        if (mass[i] < mass2[i]) return mass2;
        return mass;
    }
    return mass;
}
signed main() {
    int n;
    string s;
    string t;
    cin >> n;
    cin >> s;
    cin >> t;
    int fir = n, sec = n;
    for (int i = 0; i < n; ++i) {
        if (s[i] == '1') {
            fir = i;
            break;
        }
    }
    for (int i = 0; i < n; ++i) {
        if (t[i] == '1') {
            sec = i;
            break;
        }
    }
    //cout << fir << ' ' << sec << endl;
    if (fir > sec) {
        for (int i = 0; i < sec; ++i) cout << '0';
        for (int i = sec; i < n; ++i) cout << '1';
        return 0;
    }
    vector<char> now;
    vector<char> now2;
    for (int i = 0; i < s.size(); ++i) now.pb(s[i]);
    for (int i = 0; i < t.size(); ++i) now2.pb(t[i]);
    int kol = 0;
    while (kol < 4 && check(now, now2)) {
        kol++;
        now = upd(now);
    }
    kol++;
    if (kol >= 4) {
        t[n - 1] = '1';
        for (int i = 0; i < t.size(); ++i) {
            cout << t[i];
        }
        return 0;
    }
    now.clear();
    for (int i = 0; i < s.size(); ++i) now.pb(s[i]);
    vector<vector<char> > was;
    while (check(now, now2)) {
        was.pb(now);
        now = upd(now);
    }
    was.pb(now);
    vector<char> get_max;
    for (int i = 0; i < was.size(); ++i) {
        for (int j = i; j < was.size(); ++j) {
            vector<vector<char> > now3;
            for (int uk = i; uk <= j; ++uk) now3.pb(was[uk]);
            vector<char> now_ans = ans(now3);
            if (get_max.size() == 0) get_max = now_ans;
            else get_max = get(get_max, now_ans);
        }
    }
    for (int i = 0; i < n; ++i) cout << get_max[i];
    return 0;
}
