#include<bits/stdc++.h>
using namespace std;
typedef  long long LL ;
typedef unsigned long long ULL;
#define mp make_pair
typedef pair<int, int> P;
const int maxn = 1e5+4;
const double eps = 1e-6;
const int  MOD = 1e9+7;
const int INF = 0x3f3f3f3f;
const double PI = acos(-1);

string ADD(string x)
{
	int tem = 1;
	for(int i=x.size()-1;i>=0;--i)
	{
		int a = x[i]-'0';
		x[i] = (a^tem)+'0';
		tem = tem & a;
	}
	return x;
}

void solve(string l, string r, int n)
{
	string tem = l;
	if(tem==r)
	{
		cout << l ;
		return;
	}
	tem = ADD(tem);
	if(tem == r) //l + 1 ==r
	{
		cout << r;
		return;
	}

		if(r[n-1]=='0')
		{
			for(int i=0;i<n-1;++i)
				cout << r[i];
			cout << "1";
			return;
		}
		if(r[n-1]=='1')
		{
			cout << r;
			return;
		}





}

int main()
{
    ios::sync_with_stdio(false);
	int n;cin >> n;
	string l, r;
	cin >> l >> r;
	for(int i=0;i<n;++i)
	{
		if(l[i]=='0' && r[i] == '0')
		{
			cout << "0";
			continue;
		}
		if(l[i]=='0' && r[i] =='1' )
		{
			for(i;i<n;++i)
				cout << "1";
			return 0;
		}
		if(l[i] == '1' && r[i] == '1')
		{
			solve(l.substr(i, n-i), r.substr(i, n-i), n-i);
			return 0;
		}
	}

	return 0;
}
