#include<bits/stdc++.h>
using namespace std;

#define IO ios::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define ll long long
#define mem(a) memset(a, 0, sizeof(a))

const int MAXN=2e5+5;
int t, n, m;

string s1, s2;

int main(void){
	IO;
	cin >> n;
	cin >> s1 >> s2;
	if(s1[0] != s2[0]) {
		if(s2 == "0") cout << "0" << '\n';
		else for(int i = 1; i <= n; i++) cout << '1';
	}else {
		if(s2[n - 1] == '0') {
			int pos = -1;
			for(int i = 0; i < n; i++) {
				if(s1[i] == '0' && s2[i] == '1') {
					pos = i;
					break;
				}
			}
			if(pos < 0) {
				cout << s2 << '\n';
			}else {
				int flag = 0;
				for(int i = pos + 1; i < n; i++) {
					if(s1[i] != '1' || s2[i] != '0') {
						flag = 1;
						break;
					}
				}
				if(flag) {
					for(int i = 0; i < n - 1; i++) cout << s2[i];
					cout << '1' << '\n';
				}else {
					cout << s2 << '\n';
				}
			}
			
		}else {
			cout << s2 << '\n';
		}
	}
}

