#include <bits/stdc++.h>
#pragma GCC target("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
using namespace std;
void Yn(long long a) {
  if (a)
    printf("Yes\n");
  else
    printf("No\n");
}
void YN(long long a) {
  if (a)
    printf("YES\n");
  else
    printf("NO\n");
}
long long pwmn(long long a, long long n) {
  long long ans = 1;
  while (ans < a) ans *= n;
  return ans;
}
long long dig(long long n) {
  long long ret = 0;
  while (n) n /= 10, ret++;
  return ret;
}
long long LBn(vector<long long>& v, long long a) {
  long long mx = v.size(), mn = -1, md;
  while (mx - mn > 1) {
    md = (mx + mn) / 2;
    if (v[md] < a)
      mn = md;
    else
      mx = md;
  }
  return mx;
}
long long GCD(long long a, long long b) {
  long long c = 1, tmp = max(a, b);
  b = min(a, b);
  a = tmp;
  while (c != 0) {
    c = a % b;
    a = b;
    b = c;
  }
  return a;
}
long long LCM(long long a, long long b) { return a * b / GCD(a, b); }
int lcmp(const void* a, const void* b) {
  if (*(long long*)a > *(long long*)b) return 1;
  if (*(long long*)a < *(long long*)b) return -1;
  return 0;
}
int lcmpr(const void* a, const void* b) {
  if (*(long long*)a > *(long long*)b) return -1;
  if (*(long long*)a < *(long long*)b) return 1;
  return 0;
}
int ccmp(const void* a, const void* b) { return *(char*)a - *(char*)b; }
int ccmpr(const void* a, const void* b) { return *(char*)b - *(char*)a; }
int scmp(const void* a, const void* b) { return strcmp((char*)a, (char*)b); }
int scmpr(const void* a, const void* b) { return strcmp((char*)b, (char*)a); }
long long cmod(long long a, long long m) {
  if (a % m < 0)
    return a % m + abs(m);
  else
    return a % m;
}
long long DIV(long long a, long long d, long long m) {
  long long l = m, x = 1, y = 0, k;
  while (l) {
    k = d / l;
    d -= k * l;
    swap(l, d);
    x -= k * y;
    swap(x, y);
  }
  return cmod(a * cmod(x, m), m);
}
long long POW(long long a, long long n, long long m) {
  long long ans = 1;
  while (n > 0) {
    if (n & 1) ans = ans * a % m;
    a = a * a % m;
    n >>= 1;
  }
  return ans;
}
long long fact[200010], finv[200010], inv[200010];
void comi() {
  long long i;
  fact[0] = fact[1] = 1;
  finv[0] = finv[1] = 1;
  inv[1] = 1;
  for (i = 2; i < 200010; i++) {
    fact[i] = fact[i - 1] * i % 1000000007;
    inv[i] = 1000000007 - inv[1000000007 % i] * (1000000007 / i) % 1000000007;
    finv[i] = finv[i - 1] * inv[i] % 1000000007;
  }
}
long long com(long long n, long long k) {
  if (n < k || n < 0 || k < 0) return 0;
  return fact[n] * (finv[k] * finv[n - k] % 1000000007) % 1000000007;
}
bool cmps(pair<long long, long long> a, pair<long long, long long> b) {
  if (a.second != b.second) return a.second < b.second;
  return a.first < b.first;
}
template <typename T>
bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <typename T>
bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  long long i, N, a, ans = 1, k = 0;
  cin >> N;
  vector<long long> A(N), B(N);
  vector<pair<long long, long long>> v(N);
  vector<long long> u;
  map<pair<long long, long long>, long long> p, q;
  for (i = 0; i < N; i++) cin >> A[i] >> B[i];
  for (i = 0; i < N; i++) {
    if (A[i] == 0 || B[i] == 0) {
      if (A[i] == 0 && B[i] == 0) {
        k++;
        v[i] = {0, 0};
        p[make_pair(0, 0)]++;
      } else if (A[i] != 0) {
        v[i] = {1, 0};
        p[make_pair(1, 0)]++;
      } else if (B[i] != 0) {
        v[i] = {1, 0};
        q[make_pair(1, 0)]++;
      }
    } else if ((A[i] < 0 && B[i] > 0) || (A[i] > 0 && B[i] < 0)) {
      A[i] = abs(A[i]), B[i] = abs(B[i]);
      a = GCD(A[i], B[i]);
      v[i] = {B[i] / a, A[i] / a};
      q[make_pair(B[i] / a, A[i] / a)]++;
    } else {
      A[i] = abs(A[i]), B[i] = abs(B[i]);
      a = GCD(A[i], B[i]);
      v[i] = {A[i] / a, B[i] / a};
      p[make_pair(A[i] / a, B[i] / a)]++;
    }
  }
  for (i = 0; i < N; i++) {
    if (v[i].first == 0 && v[i].second == 0) continue;
    if (p[v[i]] == 1145141919810364364) continue;
    a = POW(2, p[v[i]], 1000000007) + POW(2, q[v[i]], 1000000007) - 1;
    a = cmod(a, 1000000007);
    cout << a << endl;
    u.push_back(a);
    p[v[i]] = 1145141919810364364, q[v[i]] = 1145141919810364364;
  }
  for (long long l : u) {
    ans *= l, ans %= 1000000007;
  }
  cout << cmod(ans - 1 + k, 1000000007) << endl;
}
