#include <bits/stdc++.h>
using namespace std;
const int maxn = 1000 * 1000 + 10, maxm = 250 + 10;
long long n, m, ox[maxm], oy[maxm], mx[maxn], ans;
int main() {
  cin >> n >> m;
  for (int i = 1; i <= m; i++) cin >> ox[i] >> oy[i];
  for (int i = 1; i <= m; i++)
    for (int j = 1; j <= m; j++) {
      long long x = oy[i] - oy[j], y = ox[i] - ox[j], sum = 0;
      if (x != 0)
        if (x * ((y * oy[i]) / x) == (y * oy[i])) {
          long long arz = ox[i] - ((y * oy[i]) / x);
          if (1 <= arz && arz <= n) {
            for (int l = 1; l <= m; l++)
              if (x * ((y * oy[l]) / x) == (y * oy[l]))
                if (arz == ox[l] - ((y * oy[l]) / x)) sum++;
            mx[arz] = max(mx[arz], sum);
          }
        }
    }
  for (int i = 1; i <= n; i++) {
    mx[i] = max(mx[i], 1ll);
    ans += mx[i];
  }
  cout << ans << endl;
  return 0;
}
