#include <bits/stdc++.h>
using namespace std;
map<pair<long long, long long>, long long> cnt;
long long gcd(long long a, long long b) {
  long long r = a % b;
  while (r > 0) {
    a = b;
    b = r;
    r = a % b;
  }
  return b;
}
long long mod_div(long long a, long long b) {
  long long tmp = 1000000007 - 2, c = b, ret = 1;
  while (tmp > 0) {
    if (tmp & 1) {
      ret *= c;
      ret %= 1000000007;
    }
    c *= c;
    c %= 1000000007;
    tmp >>= 1;
  }
  return a * ret % 1000000007;
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  long long n;
  cin >> n;
  vector<pair<long long, long long>> pll(n);
  long long ho = 0;
  for (auto &a : pll) {
    cin >> a.first >> a.second;
    long long g = gcd(abs(a.first), abs(a.second));
    if (a.first > 0) {
      cnt[make_pair(a.first / g, a.second / g)]++;
    } else {
      cnt[make_pair(-a.first / g, -a.second / g)]++;
    }
  }
  long long kake = 1;
  long long ans = 0;
  vector<long long> be(222222);
  be[0] = 1;
  for (int i = 1; i < 222222; i++) {
    be[i] = be[i - 1] * 2;
    be[i] %= 1000000007;
  }
  for (auto a : cnt) {
    if (a.first.second > 0) {
      if (cnt[make_pair(a.first.second, -a.first.first)] == 0) {
        kake *= be[a.second];
      }
    } else {
      if (cnt[make_pair(-a.first.second, a.first.first)] == 0) {
        kake *= be[a.second];
      }
    }
    kake %= 1000000007;
  }
  ans = kake;
  vector<long long> rui;
  rui.push_back(0);
  map<pair<long long, long long>, bool> use;
  for (auto a : cnt) {
    if (cnt[make_pair(a.first.first, a.first.second)] == 0) continue;
    if (a.first.second > 0) {
      if (use[make_pair(a.first.first, a.first.second)] == false &&
          cnt[make_pair(a.first.second, -a.first.first)] &&
          use[make_pair(a.first.second, -a.first.first)] == false) {
        use[make_pair(a.first.second, -a.first.first)] = true;
        use[make_pair(a.first.first, a.first.second)] = true;
        long long su = (be[a.second] - 1 + 1000000007) % 1000000007 + 1 +
                       (be[cnt[make_pair(a.first.second, -a.first.first)]] - 1 +
                        1000000007) %
                           1000000007;
        su %= 1000000007;
        rui.push_back(su);
      }
    } else {
      if (use[make_pair(a.first.first, a.first.second)] == false &&
          cnt[make_pair(-a.first.second, a.first.first)] &&
          use[make_pair(-a.first.second, a.first.first)] == false) {
        use[make_pair(-a.first.second, a.first.first)] = true;
        use[make_pair(a.first.first, a.first.second)] = true;
        long long su = (be[a.second] - 1 + 1000000007) % 1000000007 + 1 +
                       (be[cnt[make_pair(-a.first.second, a.first.first)]] - 1 +
                        1000000007) %
                           1000000007;
        su %= 1000000007;
        rui.push_back(su);
      }
    }
    kake %= 1000000007;
  }
  long long ss = 1;
  for (long long i = 1; i < rui.size(); i++) {
    ss *= rui[i];
    ss %= 1000000007;
  }
  cout << ((ans * ss) % 1000000007 - 1 + 1000000007) % 1000000007 << endl;
  return 0;
}
