#include <bits/stdc++.h>
using namespace std;
vector<vector<int>> bingo(3, vector<int>(3));
int N, M;
int solve() {
  cin >> N;
  cin >> M;
  vector<int> si(M);
  vector<int> ci(M);
  for (int i = 0; i < M; i++) {
    cin >> si[i];
    cin >> ci[i];
  }
  if (M > 1) {
    cout << 0;
  }
  return 0;
}
int main() {
  solve();
  return 0;
}
