#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e9;
const long long INFF = 1e18;
const long long MAXN = 510;
const long long MOD = 1e9 + 7;
const double PI = acos(-1.0);
const double INFD = 1E9;
const double EPS = 1e-9;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
struct point {
  long long x, y;
};
long long cnt[1000010];
point tab[255];
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long n, m;
  cin >> n >> m;
  for (long long i = 1; i <= n; i++) cnt[i] = 1;
  for (long long i = 1; i <= m; i++) {
    cin >> tab[i].x >> tab[i].y;
  }
  for (long long i = 1; i <= m; i++) {
    for (long long j = 1; j <= m; j++)
      if (j != i) {
        long long dy = tab[i].y - tab[j].y;
        long long dx = tab[i].x - tab[j].x;
        if (dy == 0) continue;
        if ((tab[i].y * dx) % dy == 0) {
          long long ret = 2;
          for (long long k = 1; k <= m; k++)
            if (i != k && j != k)
              ret += ((dy * (tab[i].x - tab[k].x)) ==
                      (dx * (tab[i].y - tab[k].y)));
          long long x = tab[i].x - (tab[i].y * dx / dy);
          if (1 <= x && x <= n) cnt[x] = max(cnt[x], ret);
        }
      }
  }
  long long ans = 0;
  for (long long i = 1; i <= n; i++) ans += cnt[i];
  cout << ans << endl;
  return 0;
}
