#include <bits/stdc++.h>
using namespace std;
template <typename T>
void chmin(T &a, T b) {
  if (a > b) a = b;
}
template <typename T>
void chmax(T &a, T b) {
  if (a < b) a = b;
}
int in() {
  int x;
  scanf("%d", &x);
  return x;
}
long long lin() {
  long long x;
  scanf("%lld", &x);
  return x;
}
long long GCD(long long a, long long b) {
  if (b == 0)
    return a;
  else
    return GCD(b, a % b);
}
long long mod = 1e9 + 7;
long long powll(long long x, long long y) {
  x %= mod;
  long long res = 1LL;
  while (y) {
    if (y & 1LL) res *= x;
    res %= mod;
    x = (x * x) % mod;
    y >>= 1LL;
  }
  return res;
}
int main() {
  long long N;
  cin >> N;
  vector<pair<long long, long long> > iwashi(N);
  long long zero = 0, a_zero = 0, b_zero = 0;
  for (int i = 0; i < N; ++i) {
    long long a, b, a_abs, b_abs;
    cin >> a >> b;
    if (a == 0 && b == 0) {
      zero++;
    } else if (b != 0 && a == 0) {
      a = 0;
      b = 1;
      a_zero++;
    } else if (b == 0 && a != 0) {
      a = 1;
      b = 0;
      b_zero++;
    } else {
      a_abs = abs(a);
      b_abs = abs(b);
      long long gcd = GCD(a_abs, b_abs);
      a /= gcd;
      b /= gcd;
      if (a < 0 && b < 0) {
        a = -a;
        b = -b;
      } else if (a < 0 && b > 0) {
        a = -a;
        b = -b;
      }
    }
    iwashi[i].first = a;
    iwashi[i].second = b;
  }
  set<pair<long long, long long> > frac;
  map<pair<long long, long long>, long long> cnt;
  map<pair<long long, long long>, bool> used;
  for (int i = 0; i < N; ++i) {
    pair<long long, long long> p = make_pair(iwashi[i].first, iwashi[i].second);
    frac.insert(p);
    cnt[p]++;
  }
  vector<long long> choice;
  for (pair<long long, long long> p : frac) {
    if (p.first == 0 || p.second == 0) continue;
    long long a = p.second, b = p.first;
    if ((a < 0 && b > 0) || (a < 0 && b < 0)) {
      a = -a;
      b = -b;
    }
    auto inv = frac.find(make_pair(a, -b));
    if (inv != frac.end() && !used[p] && !used[*inv]) {
      choice.push_back((powll(2, cnt[p]) + powll(2, cnt[*inv]) - 1) % mod);
      used[p] = true;
      used[*inv] = true;
    } else if (inv == frac.end()) {
      choice.push_back((powll(2, cnt[p])) % mod);
      used[p] = true;
    }
  };
  long long ans = 1;
  for (int i = 0; i < choice.size(); ++i) {
    ans *= choice[i];
    ans %= mod;
  }
  ans *= (powll(2, a_zero) + powll(2, b_zero) - 1) % mod;
  ans %= mod;
  cout << (ans + zero - 1) % mod << endl;
  return 0;
}
