#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int mod = 1e9 + 7;
ostream &operator<<(ostream &os, const pair<int, int> p) {
  os << "(" << p.first << ", " << p.second << ")";
  return os;
}
template <typename T>
T gcd(T a, T b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
ll modpow(ll n, int k) {
  ll r = 1;
  while (k > 0) {
    if (k & 1) (r *= n) %= mod;
    (n *= n) %= mod;
    k >>= 1;
  }
  return r;
}
pair<int, int> flip(const pair<int, int> &p) {
  int a = p.first;
  int b = p.second;
  assert(b >= 0);
  if (a < 0) {
    return {b, -a};
  } else {
    return {-b, a};
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  map<pair<ll, ll>, ll> cnt;
  int n;
  cin >> n;
  ll res0 = 0;
  ll res = 1;
  for (int i = 0; i < n; ++i) {
    ll a, b;
    cin >> a >> b;
    if (a == 0 && b == 0) {
      ++res0;
      continue;
    }
    if (b < 0) {
      a = -a;
      b = -b;
    }
    ll g = gcd(a, b);
    a /= g;
    b /= g;
    if (b < 0) {
      a = -a;
      b = -b;
    }
    ++cnt[{a, b}];
  }
  set<pair<int, int>> invalid;
  for (const auto &elem : cnt) {
    ll a = elem.first.first;
    ll b = elem.first.second;
    auto fl = flip(elem.first);
    map<pair<ll, ll>, ll>::iterator bad;
    if (a == 0 || b == 0) {
      bad = cnt.find({b, a});
    } else {
      bad = cnt.find(fl);
    }
    ll amt = modpow(2, elem.second);
    if (bad != cnt.end()) {
      amt = amt + (modpow(2, (*bad).second)) + mod - 1;
      cnt.erase(bad);
    } else {
    }
    res = (res * amt) % mod;
  }
  ll ans = (res + res0 + mod - 1) % mod;
  cout << ans << "\n";
  return 0;
}
