#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  bool ans = true;
  vector<int> a(n, -1);
  for (int i = 0; i < (int)(m); i++) {
    int s, c;
    cin >> s >> c;
    if (a[s - 1] == -1)
      a[s - 1] = c;
    else if (a[s - 1] != c)
      ans = false;
  }
  if (n != 1 && a[0] == 0) ans = false;
  if (ans) {
    for (int i = 0; i < n; i++) {
      if (a[i] == -1) {
        if (i == 0 && n >= 2)
          a[i] = 1;
        else
          a[i] = 0;
      }
      cout << a[i];
    }
  }
  cout << endl;
}
