#include <bits/stdc++.h>
using namespace std;
int n, m;
long long X[251], Y[251];
long long cnt[1000001];
void calc(long long Ax, long long Ay, long long Bx, long long By) {
  long long C1 = Ay - By;
  long long C2 = Bx - Ax;
  long long C3 = Ay * Bx - Ax * By;
  if (C1 == 0) return;
  if (C3 % C1 != 0) return;
  long long p = C3 / C1;
  if (p < 0 || p > n) return;
  long long s = 0;
  for (int i = 1; i <= m; i++)
    if (X[i] * C1 + Y[i] * C2 == C3) s++;
  cnt[p] = max(cnt[p], s);
}
int MAIN() {
  while (cin >> n >> m) {
    memset(cnt, 0, sizeof(cnt));
    for (int i = 1; i <= m; i++) cin >> X[i] >> Y[i];
    for (int i = 1; i <= m; i++)
      for (int j = i + 1; j <= m; j++) calc(X[i], Y[i], X[j], Y[j]);
    long long ret = 0;
    for (int i = 1; i <= n; i++) ret += max(cnt[i], 1LL);
    cout << ret << endl;
  }
  return 0;
}
int main() {
  ios ::sync_with_stdio(false);
  cout << fixed << setprecision(16);
  int RUN_RESULT = MAIN();
  return RUN_RESULT;
}
