#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1000000007;
long long gcd(long long x, long long y) {
  if (y < 0) y = -y;
  if (x < y) {
    long long xx = x;
    x = y;
    y = xx;
  }
  while (y > 0) {
    long long r = x % y;
    x = y;
    y = r;
  }
  return x;
}
int main() {
  long long N;
  cin >> N;
  vector<long long> A(N), B(N);
  bool zeroflag = false;
  for (long long i = 0; i < N; i++) {
    long long a, b;
    cin >> a >> b;
    if (a == 0 && b == 0) {
      zeroflag = true;
    } else if (a == 0) {
      b = 1;
    } else {
      if (a < 0) {
        a = -a;
        b = -b;
      }
      long long d = gcd(a, b);
      a = a / d;
      b = b / d;
    }
    A[i] = a;
    B[i] = b;
  }
  map<pair<long long, long long>, pair<long long, long long>> m;
  for (long long i = 0; i < N; i++) {
    if (A[i] == 0 && B[i] == 0) continue;
    if (B[i] > 0) {
      pair<long long, long long> k = make_pair(A[i], B[i]);
      if (m.count(k) == 1) {
        m[k].first++;
      } else {
        m[k] = make_pair(1, 0);
      }
    } else {
      pair<long long, long long> k = make_pair(-B[i], A[i]);
      if (m.count(k) == 1) {
        m[k].second++;
      } else {
        m[k] = make_pair(0, 1);
      }
    }
  }
  long long result = 1;
  for (auto k : m) {
    long long x = k.second.first;
    long long y = k.second.second;
    long long xx = 1;
    long long yy = 1;
    for (long long i = 0; i < x; i++) xx = (xx * 2) % MOD;
    for (long long i = 0; i < y; i++) yy = (yy * 2) % MOD;
    result = (result * ((xx + yy + MOD - 1) % MOD)) % MOD;
  }
  if (!zeroflag) result = (result + MOD - 1) % MOD;
  cout << result << endl;
}
