#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define ull unsigned long long
const int maxn=2e5+5;
const int mod=1e9+7;
const int inf=0x3f3f3f3f;
typedef pair<string, int> pii;
void solve()
{
	int n;
	cin>>n;
	string s1,s2;
	cin>>s1>>s2;
	if(s1[0]=='0'&&s2[0]=='1')
	{
		for(int i=0;i<n;i++) cout<<1;
		cout<<endl;
		return;
	}
	else
	{
		ll sum=0;
		for(int i=0;i<n;i++)
		{
			int x=s1[i]-'0';
			int y=s2[i]-'0';
			sum=sum*2+y-x;
			if(sum>1) break;
		}
		if(sum<=1||s2[s2.size()-1]=='1')
		{
			cout<<s2<<endl;
		}
		else
		{
			s2[s2.size()-1]='1';
			cout<<s2<<endl;
		}
	}
 } 
int main()
{
	ios_base::sync_with_stdio(false);
	int t=1;
	//cin>>t;
	while(t--)
	{
		solve();
	}
	return 0; 
}