#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vec = vector<ll>;
using mat = vector<vec>;
ll gcd(ll a, ll b) {
  if (b == 0)
    return a;
  else
    return gcd(b, a % b);
}
ll modpow(ll a, ll n, ll m) {
  if (n == 0) return 1;
  ll t = modpow(a, n >> 1, m);
  t = t * t % m;
  if (n & 1) t = t * a % m;
  return t;
}
int main() {
  ll N;
  cin >> N;
  map<pair<ll, ll>, ll> R, S;
  ll c = 0;
  for (ll(i) = (0), (i_len) = (N); (i) < (i_len); ++(i)) {
    ll a, b;
    cin >> a >> b;
    if (b == 0) {
      if (a == 0) {
        ++c;
        continue;
      } else if (a < 0)
        a = -a;
    } else if (b < 0) {
      a = -a;
      b = -b;
    };
    ll g = gcd(abs(a), abs(b));
    ++R[{a / g, b / g}];
  }
  ll sum = 1;
  for (auto(r) : R) {
    pair<ll, ll> p = r.first, s;
    ll ci = r.second, cj;
    R[p] = 0;
    if (p.first > 0)
      s = {-p.second, p.first};
    else
      s = {p.second, -p.first};
    if (R.count(s) > 0) {
      cj = R[s];
      R[s] = 0;
    } else
      cj = 0;
    ll t = (modpow(2, ci, 1000000007) + modpow(2, cj, 1000000007) - 1 +
            1000000007) %
           1000000007;
    sum = (sum * t) % 1000000007;
  }
  cout << ((sum + c - 1) % 1000000007) << endl;
  return 0;
}
