//#define MULTICASES
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,a,b) for(i=(a);i<=(b);++i)
#define per(i,a,b) for(i=(a);i>=(b);--i)
#define REP(i,a,b) for(i=(a);i< (b);++i)
#define PER(i,a,b) for(i=(a);i> (b);--i)
#define ERR(...) fprintf(stderr,__VA_ARGS__)
inline void ac();
int main(){
#ifdef MULTICASES
	int t;scanf("%d",&t);while(t--)ac();
#else
	ac();
#endif
	return 0;
}
const int MAXN=1000005;
char L[MAXN],R[MAXN];
inline void ac(){
	int n,i;
	scanf("%d%s%s",&n,L+1,R+1);
	if(R[1]=='0'){putchar('0');putchar('\n');return;}
	if(L[1]=='0'){rep(i,1,n)putchar('1');putchar('\n');return;}
	
	rep(i,0,n)if(L[i]!=R[i])break;
	if(i>n){puts(R+1);return;}
	
	++L[n];per(i,n,1)if(L[i]=='2'){L[i]='0';++L[i-1];}
	
	rep(i,0,n)if(L[i]!=R[i])break;
	if(i>n){puts(R+1);return;}
	
	R[n]='1';puts(R+1);
}
