#include <bits/stdc++.h>
using namespace std;
struct node {
  long long x, y;
} a[347];
bool b[347];
int f[1000010];
void init(int n) {
  for (int i = 1; i <= n; i++) {
    f[i] = 1;
  }
}
long long xx(long long x1, long long y1, long long x2, long long y2) {
  return x1 * y2 - x2 * y1;
}
bool check(node A, node B, node C) {
  return xx(B.x - A.x, B.y - A.y, C.x - A.x, C.y - A.y) == 0;
}
long long solve(node A, node B) {
  long long x = xx(A.x, A.y, B.x, B.y);
  if (A.y == B.y || x % (B.y - A.y)) return 0;
  return x / (B.y - A.y);
}
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  init(n);
  for (int i = 1; i <= m; i++) {
    scanf("%I64d%I64d", &a[i].x, &a[i].y);
  }
  for (int i = 1; i <= m; i++) {
    memset(b, 0, sizeof(b));
    for (int j = i + 1; j <= m; j++) {
      if (!b[j]) {
        long long z = solve(a[i], a[j]);
        b[j] = 1;
        if (z > 0 && z <= n) {
          int cnt = 2;
          for (int k = j + 1; k <= m; k++) {
            if (!b[k] && check(a[i], a[j], a[k])) {
              b[k] = 1;
              cnt++;
            }
          }
          f[z] = max(f[z], cnt);
        }
      }
    }
  }
  long long sum = 0;
  for (int i = 1; i <= n; i++) {
    sum += f[i];
  }
  printf("%I64d\n", sum);
  return 0;
}
