#include <bits/stdc++.h>
#pragma GCC optimize ("O3")
#define fi first
#define se second
#define REP(i,n) for ( int i = 0 ; i < n ; i ++ ) 
#define pb push_back
#define debug(x) cout << #x << " = " << x << endl;
using namespace std;
typedef long long Long;
typedef long long ll;
typedef long double db;
const int N = 2e5+10 ;
string add ( string s ) {
	reverse ( s.begin() , s.end() ) ;
	int x = 1 ;
	REP ( i , s.size() ) {
		int curr = s [ i ] - '0' + x ; 
		if ( curr == 2 ) s [ i ] = '0' , x = 1 ; 
		else s [ i ] = char ( '0' + curr ) , x = 0 ;
	}
	reverse ( s.begin() , s.end() ) ;
	return s ;
}
int main(){	
	ios::sync_with_stdio(0);
	cin.tie(NULL);
	cout.tie(NULL);
	int n ; 
	cin >> n ;
	string s , t ; 
	cin >> s >> t ;
	if( t[0]=='0'){
		cout << 0<<endl;
		return 0;
	}
	//assert ( t[0] == '1' );
	//if ( n >= 3 ) {
		if ( s[0] == '0' ) {
			REP ( i , n ) cout << '1';
			cout << endl ;
			return 0 ;
		}
		if ( s == t ) {
			cout << t << endl ; 
			return 0 ;
		}
		if ( t [ n - 1 ] == '1' ) {
			cout << t << endl ;
			return 0 ;
		}
		s = add ( s ) ;
		if ( s == t ) cout << t << endl ;
		else {
			t [ n - 1 ] = '1' ;
			cout << t << endl;
		}
}
