#include <bits/stdc++.h>
#define fk ios::sync_with_stdio(0); cin.tie(0);cout.tie(0);
using namespace std;
typedef long long ll;
const int maxn = 1e6 + 5;
char l[maxn], r[maxn], tl[maxn];
int main() {
	int t = 1;
	while (t--) {
		int n;
		scanf("%d%s%s", &n, l + 1, r + 1);
		if (l[1] == '0' && r[1] == '1') {
			for (int i = 1; i <= n; ++i)printf("1"); puts("");
		}
		else {
			bool ok = true;
			for (int i = 1; i <= n; ++i) {
				if (l[i] != r[i]) {
					ok = false;
					break;
				}
			}
			if (!ok) {
				ok = true;
				memcpy(tl, l, sizeof(char) * (n + 2));
				int now = n;
				while (tl[now] == '1') {
					tl[now] = '0';
					now--;
				}
				tl[now] = '1';
				for (int i = 1; i <= n; ++i) {
					if (tl[i] != r[i]) {
						ok = false;
						break;
					}
				}
			}
			if (ok) {
				printf("%s\n", r + 1);
			}
			else {
				r[n] = '1';
				printf("%s\n", r + 1);
			}
		}
	}
}


	 			    	  	 	  			   		  			