#include <iostream>
#include <string>

using namespace std;

int main() {
    int n;
    cin >> n;
    
    int fixed_n = n;
    
    string left;
    string right;
    cin >> left >> right;
    
    while (n < 3) {
        ++n;
        left = "0" + left;
        right = "0" + right;
    }
    
    auto with = [&](string x, char last2, char last1) {
        x[n - 2] = last2;
        x[n - 1] = last1;
        return x;
    };
    
    auto with3 = [&](string x, char last3, char last2, char last1) {
        string res = with(x, last2, last1);
        res[n - 3] = last3;
        return res;
    };
    
    auto is_correct_segment = [&](string& x, string& y) {
        if (x < left) return false;
        if (right < y) return false;
        if (x > y) return false;
        return true;
    };
    
    string ans = right;
    
    string right_00 = with(right, '0', '0');
    string right_01 = with(right, '0', '1');
    string right_10 = with(right, '1', '0');
    string right_11 = with(right, '1', '1');
    
    if (is_correct_segment(right_00, right_10)) {
        ans = max(ans, right_11);
    }
    
    if (right.find('1') != string::npos) {
        string before_right = with(right, '0', '0');
        for (int i = n - 1; i >= 0; --i) {
            if (before_right[i] == '1') {
                before_right[i] = '0';
                for (int j = i + 1; j < n; ++j) before_right[j] = '1';
                break;
            }
        }
    
        string before_right_10 = with(before_right, '1', '0');
        
        if (is_correct_segment(before_right_10, right_00)) {
            ans = max(ans, right_01);
        }   
    }
    
    int ep = 0;
    while (ep < n && left[ep] == right[ep]) ++ep;
    
    auto ans_with = [&](char last2, char last1) {
        return string(ep, '0') + string(n - 2 - ep, '1') + string(1, last2) + string(1, last1);
    };
    
    bool important_ep = (right.substr(0, ep).find('1') != string::npos);
    
    if (!important_ep) {
        string left_11 = with(left, '1', '1');
        
        if (is_correct_segment(left_11, right_00)) {
            ans = max(ans, ans_with('1', '1'));
        }   
        
        if (is_correct_segment(right_01, right_10)) {
            ans = max(ans, ans_with('1', '1'));
        }
    }

    
    ans = ans.substr(n - fixed_n, n);
    
    cout << ans << endl;
    
    return 0;
}