#include <bits/stdc++.h>
using namespace std;
long long N, M;
pair<long long, long long> A[1000];
long long dp[1000000];
long long gcd(long long a, long long b) {
  while (a) {
    b %= a;
    swap(a, b);
  }
  return b;
}
void relax_dp(long long i, long long j) {
  long long x1 = A[i].first;
  long long y1 = A[i].second;
  long long x2 = A[j].first;
  long long y2 = A[j].second;
  long long a = y1 - y2, b = -(x1 - x2), c = (x1 * y2 - x2 * y1);
  long long g = gcd(gcd(a, b), c);
  a /= g;
  b /= g;
  c /= g;
  long long t = 0;
  for (long long i = 0; i < M; i++)
    if (a * A[i].first + b * A[i].second + c == 0) t++;
  if (a == 0) return;
  if (c % a != 0) return;
  long long q = -(c / a);
  if (q >= 0 && q < N) dp[q] = max(dp[q], t);
}
int main() {
  cin >> N >> M;
  for (long long i = 0; i < M; i++) {
    cin >> A[i].first >> A[i].second;
    A[i].first--;
  }
  for (long long i = 0; i < N; i++) dp[i] = 1;
  for (long long i = 0; i < M; i++)
    for (long long j = i + 1; j < M; j++) {
      relax_dp(i, j);
    }
  long long s = 0;
  for (long long i = 0; i < N; i++) s += dp[i];
  cout << s << endl;
  return 0;
}
