#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<cstring>
#include<string>
#include<algorithm>
#define N 1000005
using namespace std;
int n;
char l[N],r[N];
bool eql(){
	for(int i=1;i<=n;i++)
		if(l[i]!=r[i]) return 0;
	return 1;
}
int main()
{
	scanf("%d",&n);
	scanf("%s",l+1);scanf("%s",r+1);
	if(eql()){printf("%s\n",r+1);return 0;}
	if(l[1]!=r[1]){for(int i=1;i<=n;i++) putchar('1');puts("");return 0;}
	if(r[n]=='1'){printf("%s\n",r+1);return 0;}
	l[n]++;for(int i=n;i>=1;i--){if(l[i]=='2') l[i-1]++,l[i]='0';}
	if(eql()){printf("%s\n",r+1);return 0;}
	r[n]++;for(int i=n;i>=1;i--) if(r[i]=='2') r[i-1]++,r[i]='0';
	printf("%s\n",r+1);
	return 0;
}