#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int mod = 1000000007;
const double PI = acos(-1);
ll ab(ll x) { return max(x, -x); }
ll gcd(ll a, ll b) {
  if (a == 0) return ab(b);
  if (b == 0) return ab(a);
  if (ab(a) == ab(b)) return ab(a);
  if (ab(a) == 1 || ab(b) == 1) return 1;
  if (ab(a) > ab(b)) {
    return gcd(ab(a) % ab(b), ab(b));
  } else
    return gcd(ab(a), ab(b) % ab(a));
}
pair<ll, ll> f(pair<ll, ll> a) {
  pair<ll, ll> b;
  if (a.first == 0) {
    b.first = 0;
    b.second = ab(a.second);
  }
  if (a.first < 0) {
    b.first = -a.first;
    b.second = -a.second;
  } else
    b = a;
  return b;
}
pair<ll, ll> vert(pair<ll, ll> a) {
  pair<ll, ll> b;
  b.first = -a.second;
  b.second = a.first;
  b = f(b);
  return b;
}
ll modpow(ll a, ll b) {
  a %= mod;
  if (b == 0) return 1;
  if (b % 2 == 0) {
    return modpow(a, b / 2) * modpow(a, b / 2) % mod;
  } else
    return modpow(a, b - 1) * a % mod;
}
int main(void) {
  std::cin.tie(nullptr);
  std::ios::sync_with_stdio(false);
  ll n, num = 0, res = 0;
  cin >> n;
  vector<pair<ll, ll>> m(n);
  vector<pair<ll, ll>> t;
  map<pair<ll, ll>, ll> P;
  map<pair<ll, ll>, ll> Q;
  vector<ll> k(n);
  for (int i = 0; i < (int)n; ++i) {
    ll a, b;
    cin >> a >> b;
    if (a == 0 && b == 0) {
      num++;
      continue;
    }
    m[i].first = a / gcd(a, b);
    m[i].second = b / gcd(a, b);
    m[i] = f(m[i]);
    auto k = vert(m[i]);
    if (P.count(k) == 0) {
      P.emplace(k, 1);
    } else {
      P[k]++;
    }
  }
  ll indep = 0;
  for (int i = 0; i < (int)n; ++i) {
    if (Q.count(vert(m[i])) == 1) {
      continue;
    }
    if (P.count(m[i]) == 1) {
      if (Q.count(m[i]) == 1) {
        Q[m[i]]++;
      } else {
        Q.emplace(m[i], 1);
      }
    } else {
      ++indep;
    }
  }
  ll ans = 1;
  for (auto iter = Q.begin(); iter != Q.end(); ++iter) {
    ans *= (modpow(2, iter->second) + modpow(2, P[iter->first]) - 1) % mod;
    ans %= mod;
  }
  ans *= modpow(2, indep - num);
  ans--;
  ans += num;
  ans %= mod;
  cout << ans << endl;
  return 0;
}
