#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using uint = unsigned int;
const ll mod = 1000000007;
int main() {
  int n;
  cin >> n;
  //vector<ll> a(n), b(n);
  map<pair<ll, ll>, int> vct;
  rep(i, n) {
    ll a, b;
    cin >> a >> b;
    ll g = gcd(a, b);
    if (g != 0) {
      a /= g;
      b /= g;
    }
    if (a < 0) {
      a *= -1;
      b *= -1;
    }
    if (a == 0 || b == 0) {
      a = abs(a);
      b = abs(b);
    }
    vct[make_pair(a, b)]++;
  }
  ll prod = 1;
  ll zerov = 0;
  auto end = vct.end();
  for (auto it = vct.begin(); it != end; ++it) {
    if (it->second == 0) continue;
    pair v = it->first;
    if (v.first == 0 && v.second == 0) {
      zerov += it->second;
      it->second = 0;
      continue;
    }
    ll sum = ((ll)pow(2, it->second)) % mod;
    ll tmp = v.first;
    v.first = v.second;
    v.second = -tmp;
    if (v.first < 0) {
      v.first *= -1;
      v.second *= -1;
    }
    if (v.first == 0 || v.second == 0) {
      v.first = abs(v.first);
      v.second = abs(v.second);
    }
    auto p = vct.find(v);
    if (p != end) {
      sum = (sum + ((ll)pow(2, p->second) - 1) % mod) % mod;
      p->second = 0;
    }
    it->second = 0;
    prod = (prod * sum) % mod;
  }
  prod--;
  if (prod < 0) prod += mod;
  prod = (prod + zerov) % mod;
  cout << prod << endl;
  return 0;
}