#pragma GCC optimize(3)
#include <cstdio>
#include <queue>
#include <string>
#include <cstring>
#include <algorithm>
#include <cstdlib>
#include <iostream>
#include <iomanip>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <fstream>
#include <cassert>
#include <complex>
#include <ctime>
//#include <tr1/unordered_map>
#include <bitset>
#define pii pair<int,int>
#define pdd pair<double,double>
#define pb push_back
#define fi first
#define se second
#define is insert
#define es erase
#define mkp make_pair
#define per(i,a,b) for(int i = a; i >= b; --i)
#define rep(i,a,b) for(int i = a; i <= b; ++i)

using namespace std;
//using namespace tr1;
typedef long long ll;
typedef unsigned long long ull;

inline int read()
{
    int x = 0;
    int f = 0;
    char ch = 0;
    while(!isdigit(ch))
    {
        f |= (ch == '-') ? 1 : 0;
        ch = getchar();
    }
    while(isdigit(ch))
    {
        x = (x << 3) + (x << 1) + (ch ^ 48);
        ch = getchar();
    }
    return f ? -x : x;
}

const int maxn = 1e6 + 10;
char ss[maxn],tt[maxn];
char ans[maxn];
int n;
int sum[maxn];

int main()
{
    n = read();
    scanf("%s%s",ss + 1,tt +1);
    if(ss[1] != tt[1])
    {
        rep(i,1,n)
            printf("1");
        return 0;
    }
    int flag = 0;
    rep(i,1,n)
        if(ss[i] != tt[i])
            flag = 1;
    if(!flag)
    {
        rep(i,1,n)
            printf("%c",ss[i]);
        return 0;
    }
    int tmp = 1;
    per(i,n,1)
    {
        tmp += ss[i] - '0';
        //printf("tmp  %d\n",tmp);
        ss[i] = '0' + (tmp & 1);
        tmp >>= 1;
    }
    /*rep(i,1,n)
        printf("%c",ss[i]);
    printf("\n");*/
    flag = 0;
    rep(i,1,n - 1)
        if(ss[i] > tt[i])
        {
            flag = 1;
            break;
        }
        else if(ss[i] < tt[i])
        {
            flag = -1;
            break;
        }
    if(flag >= 0)
    {
        rep(i,1,n)
            printf("%c",tt[i]);
        return 0;
    }
    tt[n] = '1';
    rep(i,1,n)
        printf("%c",tt[i]);
}
