#include <bits/stdc++.h>
using namespace std;
const int inf = 1e9 + 7;
const long long longinf = 1LL << 60;
const long long mod = 1e9 + 7;
long long binary_pow(long long a, long long N) {
  long long ans = 1;
  long long tmp = a;
  while (N > 0) {
    if (N % 2 == 1) {
      ans *= tmp;
      ans %= mod;
    }
    N /= 2;
    tmp *= tmp;
    tmp %= mod;
  }
  return ans;
}
long long gcd(long long x, long long y) {
  if (x > y)
    return gcd(y, x);
  else if (x == 0)
    return y;
  else
    return gcd(y % x, x);
}
int main() {
  int N;
  cin >> N;
  vector<long long> A(N), B(N);
  map<pair<long long, long long>, long long> mp;
  long long cnt00 = 0, cntA0 = 0, cnt0B = 0;
  for (int i = (int)(0); i < (int)(N); i++) {
    cin >> A[i] >> B[i];
    if (A[i] == 0 && B[i] == 0) {
      cnt00++;
    } else if (B[i] == 0) {
      cntA0++;
    } else if (A[i] == 0) {
      cnt0B++;
    } else {
      long long G = gcd(abs(A[i]), abs(B[i]));
      if (A[i] < 0 && B[i] < 0)
        mp[make_pair(-A[i] / G, -B[i] / G)]++;
      else if (A[i] < 0)
        mp[make_pair(A[i] / G, B[i] / G)]++;
      else if (B[i] < 0)
        mp[make_pair(-A[i] / G, -B[i] / G)]++;
      else
        mp[make_pair(A[i] / G, B[i] / G)]++;
    }
  }
  set<pair<long long, long long>> done;
  long long ans = 1;
  if (cntA0 && cnt0B) {
    (ans *= (binary_pow(2, cntA0) + binary_pow(2, cnt0B) - 1 + mod) % mod) %=
        mod;
  } else if (cntA0) {
    (ans *= binary_pow(2, cntA0)) %= mod;
  } else if (cnt0B) {
    (ans *= binary_pow(2, cnt0B)) %= mod;
  }
  for (auto m : mp) {
    auto val = m.first;
    pair<long long, long long> val2;
    if (val.first < 0)
      val2 = make_pair(val.second, -val.first);
    else
      val2 = make_pair(-val.second, val.first);
    if (done.count(val2)) continue;
    if (mp.count(val2)) {
      (ans *= (binary_pow(2, m.second) + binary_pow(2, mp[val2]) - 1 + mod) %
              mod) %= mod;
    } else {
      (ans *= binary_pow(2, m.second)) %= mod;
    }
    done.insert(val);
  }
  cout << (ans + mod - 1) % mod + (cnt00 ? 1 : 0) << endl;
  return 0;
}
