#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define mk make_pair
#define vi vector < int >
#define pb push_back
#define pi pair < int, int >
#define fr first
#define sc second

const int N = 1e5 + 7;
const int INF = 1e9 + 7;

int n;
string s1, s2;

int xr (int l, int r){
    int ans = 0;
    for (int i = l; i <= r; i++)
        ans ^= i;
    return ans;
}

int main(){
    cin >> n >> s1 >> s2;
    if (n == 1 && s2[0] == '0')
        cout << 0;
    else if (s1[0] == '0'){
        for (int i = 0; i < n; i++)
            cout << 1;
    }
    else if (n > 5){
        string s3 = s1;
        for (int i = n - 1; i >= 0; i--){
            if (s3[i] == '0'){
                s3[i] = '1';
                break;
            }
            else
                s3[i] = '0';
        }
        for (int i = 0; i < n - 1; i++)
            cout << s2[i];
        if (s1 != s2 && s3 != s2)
            cout << 1;
        else
            cout << s2[n - 1];
    }
    else {
        int l = 0, r = 0;
        for (int i = 0; i < n; i++){
            if (s1[i] == '1')
                l += 1 << (n - i - 1);
            if (s2[i] == '1')
                r += 1 << (n - i - 1);
        }
        int ans = r;
        for (int i = l; i <= r; i++){
            for (int j = i; j <= r; j++){
                ans = max(ans, xr(i, j));
            }
        }
        for (int i = n - 1; i >= 0; i--){
            if (ans & (1 << i))
                cout << 1;
            else
                cout << 0;
        }
    }
}
