#include <bits/stdc++.h>

using namespace std;

template <class ...Args>
struct last;

template <class A, class ...Args>
struct last<A, Args...> {
        using type = typename last<Args...>::type;

        static type read(A &a, Args &...args) {
                cin >> a;
                return last<Args...>::read(args...);
        }
};

template <class A>
struct last<A> {
        using type = A;

        static type read(A &) {
                A result;
                cin >> result;
                return result;
        }
};

template <class ...Args>
typename last<Args...>::type read(Args &...args) {
        return last<Args...>::read(args...);
}

template <class ...Args>
struct multi_vector;

template <class Type, class Arg, class ...Args>
struct multi_vector<Type, Arg, Args...> {
        using type = vector<typename multi_vector<Type, Args...>::type>;
        static type create(const Type &value, Arg size, Args ...args) {
                return type(size, multi_vector<Type, Args...>::create(value, args...));
        }
};

template <class Type>
struct multi_vector<Type> {
        using type = Type;
        static type create(const Type &value) {
                return value;
        }
};

template <class ...Args>
typename multi_vector<Args...>::type make_vec(Args &&...args) {
        return multi_vector<Args...>::create(args...);
}

#define A(xs) xs.begin(), xs.end()
#define R(...) __VA_ARGS__ = read(__VA_ARGS__)

#define X first
#define Y second

using i64 = int64_t;
using f80 = long double;
template <class T> using Vec = std::vector<T>;
template <class K, class V, class H = std::hash<K>> using UM = std::unordered_map<K, V, H>;

using Pos = pair<int, int>;

int dist(Pos from, Pos to) {
        return abs(from.X - to.X) + abs(from.Y - to.Y) + 1;
}

string add_one(string s) {
        int i = s.size() - 1;
        for (; i > 0 && s[i] == '1'; --i) s[i] = '0';
        s[i] = '1';
        return s;
}

string xxor(string s1, string s2) {
  for (int i = 0; i < s1.size(); ++i) {
    s1[i] = '0' + s1[i] != s2[i];
  }
  return s1;
}

string remove_one(string s) {
  int i = s.size() - 1;
  for (; s[i] == '0'; --i) s[i] = '1';
  s[i] = '0';
  return s;
}

auto main() -> int {
        std::ios_base::sync_with_stdio(false);
        std::cin.tie(nullptr);

        int R(n);
        string R(s1, s2);

        int d = 0;
        for (string s = s1; d < 8 && s != s2; ++d, s = add_one(s));

        string best = s2;
  if (s1[0] == '0' && s2[0] != '0') {
    best = string(n, '1');
  } else if (s1 == s2 || add_one(s1) == s2) {
    best = s2;
  } else {
    best = s2;
    best.back() = '1';
  }
  
  cout << best << '\n';
        return 0;
}
				   			   	  								 		 			