#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;
  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;
      else if (a < 0)
        R[{-a, 0LL}];
    } else if (b < 0)
      ++R[{-a, -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;
    ll ci = r.second;
    if (p.first <= 0) continue;
    ll cj;
    if (p.first > 0 && p.second >= 0)
      cj = R[{-p.second, p.first}];
    else
      cj = R[{p.second, -p.first}];
    ll t = (modpow(2, ci, 1000000007) + modpow(2, cj, 1000000007) - 1 +
            1000000007) %
           1000000007;
    sum = (sum * t) % 1000000007;
  }
  cout << (sum + c - 1) << endl;
  return 0;
}
