#include <bits/stdc++.h>
using namespace std;
long long mod = 1000000007;
long long gcd(long long a, long long b) {
  if (a < b) return gcd(b, a);
  if (b > 0) {
    return gcd(b, a % b);
  } else {
    return a;
  }
}
long long pow2mod(long long a) {
  long long x = 1;
  for (size_t i = 0; i < a; i++) {
    (x *= 2);
    x = x % mod;
  }
  return x;
}
int main(void) {
  int N;
  cin >> N;
  vector<long long> A(N), B(N);
  map<pair<long long, long long>, size_t> countsPerSlope;
  for (size_t i = 0; i < N; i++) {
    long long a, b, x;
    cin >> a >> b;
    if (a != 0) {
      x = gcd(abs(a), abs(b));
      a = a / x;
      b = b / x;
    }
    if (a >= 0) {
      countsPerSlope[make_pair(a, b)]++;
    } else {
      countsPerSlope[make_pair(-a, -b)]++;
    }
  }
  long long all = 1;
  for (map<pair<long long, long long>, size_t>::iterator it =
           countsPerSlope.begin();
       it != countsPerSlope.end(); it++) {
    long long a = it->first.first, b = it->first.second, cnt = it->second,
              factor;
    if (b >= 0) {
      map<pair<long long, long long>, size_t>::iterator it2 =
          countsPerSlope.find(make_pair(b, -a));
      if (it2 != countsPerSlope.end()) {
        factor = (pow2mod(cnt) + pow2mod(it2->second) - 1);
      } else {
        factor = pow2mod(cnt);
      }
      all *= factor;
      all = all % mod;
    } else {
      map<pair<long long, long long>, size_t>::iterator it2 =
          countsPerSlope.find(make_pair(-b, a));
      if (it2 == countsPerSlope.end()) {
        factor = pow2mod(cnt);
        all *= factor;
        all = all % mod;
      }
    }
  }
  cout << all - 1 << endl;
  return 0;
}
