#include <bits/stdc++.h>
using namespace std;
constexpr long long MOD = 1000000007;
long long GCD(long long A, long long B) {
  if (B == 0) return A;
  return GCD(B, A % B);
}
long long Pow(long long X) {
  if (X == 0) return 1;
  if (X % 2 == 0) {
    long long Y = Pow(X / 2);
    return (Y * Y) % MOD;
  }
  return (2 * Pow(X - 1)) % MOD;
}
int main() {
  int N;
  cin >> N;
  vector<pair<long long, long long> > P(N);
  for (int i = 0; i < N; i++) {
    cin >> P[i].first >> P[i].second;
    if (P[i].first < 0) P[i].first = -P[i].first, P[i].second = -P[i].second;
    if (P[i].first == 0 || P[i].second == 0) {
      if (P[i].first != P[i].second) {
        if (P[i].first == 0)
          P[i].second = 1;
        else
          P[i].first = 1;
      }
    } else {
      long long G = GCD(abs(P[i].first), abs(P[i].second));
      P[i].first /= G, P[i].second /= G;
    }
  }
  long long Zero = 0;
  for (int i = 0; i < P.size(); i++) {
    if (P[i].first == 0 && P[i].second == 0) {
      Zero++;
      swap(P[i], P.back());
      P.pop_back();
    }
  }
  N -= Zero;
  map<pair<long long, long long>, int> mp;
  for (int i = 0; i < N; i++) {
    mp[P[i]]++;
  }
  long long ANS = 1;
  map<pair<long long, long long>, bool> mp2;
  for (int i = 0; i < N; i++) {
    if (!mp2[P[i]]) {
      pair<long long, long long> Q;
      Q.first = P[i].second, Q.second = -P[i].first;
      if (Q.first <= 0) Q.first = -Q.first, Q.second = -Q.second;
      long long X = mp[P[i]], Y = mp[Q];
      long long COUNT = Pow(X) + Pow(Y) + MOD - 1;
      COUNT %= MOD;
      ANS *= COUNT;
      ANS %= MOD;
      mp2[P[i]] = mp2[Q] = true;
    }
  }
  cout << (ANS + MOD - 1 + Zero) % MOD << endl;
}
