#include <bits/stdc++.h>
long long A[200005], B[200005];
int main() {
  int N, N1;
  scanf("%d", &N);
  int i = 0;
  int sum = 0;
  N1 = N;
  while (N1--) {
    scanf("%lld %lld", &A[i], &B[i]);
    int j = i;
    while (j--) {
      long long temp;
      temp = A[i] * A[j] + B[i] * B[j];
      if (temp == 0) sum++;
    }
    i++;
  }
  long long ans = 1;
  long long j;
  for (j = 1; j <= N; j++) ans = ans * j;
  ans -= sum;
  ans %= 1000000007;
  printf("%lld\n", ans);
  return 0;
}
