#include <bits/stdc++.h>
using namespace std;
template <typename T>
inline T sqr(const T &a) {
  return a * a;
}
template <typename T>
inline int nread(vector<T> &a) {
  int n;
  cin >> n;
  a.clear();
  a.resize(n);
  for (int i = 0; i < n; i++) cin >> a[i];
  return n;
}
struct P {
  long long int x, y;
  P(long long int x = 0, long long int y = 0) : x(x), y(y) {}
};
P operator-(P a, P b) { return P(a.x - b.x, a.y - b.y); }
bool operator==(P a, P b) { return a.x == b.x && a.y == b.y; }
P work;
vector<P> flam;
int ss;
double ang(P a) { return atan2((a - work).y, (a - work).x); }
bool ls(int a, int b) { return ang(flam[a]) < ang(flam[b]); }
long long int operator*(P a, P b) { return a.x * b.y - a.y * b.x; }
int main() {
  int n, m;
  cin >> n >> m;
  flam.assign(m, P());
  for (int i = 0; i < m; i++) {
    cin >> flam[i].x >> flam[i].y;
  }
  vector<int> best(n, 1);
  for (int s = 0; s < m; s++) {
    vector<int> perm;
    for (int j = 0; j < m; j++) {
      if (j != s) perm.push_back(j);
    }
    work = flam[s];
    ss = s;
    stable_sort(perm.begin(), perm.end(), ls);
    perm.insert(perm.end(), perm.begin(), perm.end());
    for (int i = 0; i < perm.size();) {
      int j;
      for (j = i + 1; j < perm.size(); j++) {
        if ((flam[perm[i]] - work) * (flam[perm[j]] - work) != 0) break;
      }
      if (work.y == flam[perm[i]].y) {
        i = j;
        continue;
      }
      if ((flam[perm[i]].x - work.x) * flam[perm[i]].y %
              (work.y - flam[perm[i]].y) ==
          0) {
        long long int k = flam[perm[i]].x +
                          (flam[perm[i]].x - work.x) * flam[perm[i]].y /
                              (work.y - flam[perm[i]].y) -
                          1;
        if (k >= 0 && k < n) best[k] = max(best[k], min(j - i + 1, m));
      }
      i = j;
    }
  }
  long long int res = 0;
  for (int i = 0; i < n; i++) {
    res += best[i];
  }
  cout << res << endl;
}
