#include <bits/stdc++.h>
using namespace std;
set<pair<long long int, long long int> > S;
map<pair<long long int, long long int>, int> C;
int N;
long long int A[200005], B[200005];
map<pair<long long int, long long int>, int> used;
long long int gcd(long long int a, long long int b) {
  if (b == 0) {
    return a;
  }
  return gcd(b, a % b);
}
long long int MOD = 1000000007;
long long int P[200005];
int main(void) {
  cin >> N;
  for (int i = 1; i <= N; i++) {
    cin >> A[i] >> B[i];
  }
  P[0] = 1;
  P[1] = 2;
  for (long long int i = 2; i <= (long long int)N; i++) {
    P[i] = P[i - 1] * i;
    P[i] %= MOD;
  }
  for (int i = 1; i <= N; i++) {
    long long int tmp = gcd(abs(A[i]), abs(B[i]));
    long long int a = A[i] / tmp;
    long long int b = B[i] / tmp;
    if (b < 0) {
      a = -a;
      b = -b;
    }
    S.insert(make_pair(a, b));
    C[make_pair(a, b)]++;
  }
  long long int ans = 1;
  for (auto y : S) {
    if (used[y] == 1) {
      continue;
    }
    pair<long long int, long long int> z;
    z.first = y.second;
    z.second = -y.first;
    if (z.second < 0) {
      z.first = -z.first;
      z.second = -z.second;
    }
    long long int m, n = 0;
    m = C[y];
    if (C[z] != 0) {
      n = C[z];
    }
    ans *= (P[m] - 1 + P[n] - 1 + 1);
    ans %= MOD;
    used[z] = 1;
  }
  ans--;
  cout << ans << endl;
  return 0;
}
