#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, M;
  int s[6] = {0};
  int c[6] = {0};
  int x[6] = {0};
  int n = -1;
  cin >> N >> M;
  for (int i = 0; i < M; i++) {
    cin >> s[i] >> c[i];
  }
  for (int i = 0; i < M; i++) {
    x[s[i] - 1] = c[i];
  }
  int p = 1;
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < N - i - 1; j++) {
      p *= 10;
    }
    n += x[i] * p;
    p = 1;
  }
  cout << n << endl;
  return 0;
}
