#include <bits/stdc++.h>
using namespace std;
int n, m;
int ans[1000020];
struct Punto {
  long long x, y;
};
Punto Dots[1000];
bool areColineal(Punto A, Punto B, Punto C) {
  return (C.y - B.y) * (B.x - A.x) == (B.y - A.y) * (C.x - B.x);
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> m;
  for (long long i = 0; i < m; i++) {
    cin >> Dots[i].x >> Dots[i].y;
  }
  for (long long i = 0; i < n + 1; i++) ans[i] = 1;
  for (long long i = 0; i < m; i++) {
    for (int j = i + 1; j < m; j++) {
      Punto A = Dots[i];
      Punto B = Dots[j];
      int cont = 2;
      for (int k = j + 1; k < m; k++) {
        if (areColineal(A, B, Dots[k])) {
          cont++;
        }
      }
      if (A.y != B.y) {
        if ((A.y * (A.x - B.x)) % (A.y - B.y) == 0) {
          long long corte = A.x - (A.y * (A.x - B.x)) / (A.y - B.y);
          if (corte >= 1 && corte <= n) {
            ans[corte] = max(ans[corte], cont);
          }
        }
      }
    }
  }
  long long sum = 0;
  for (long long i = 0; i < n; i++) {
    sum += ans[i + 1];
  }
  cout << sum << "\n";
  return 0;
}
