#include <bits/stdc++.h>
using namespace std;
using ll = long long;
ll gcd(ll x, ll y) {
  x = (x >= 0) ? x : -x;
  y = (y >= 0) ? y : -y;
  if (x > y) {
    return gcd(y, x);
  }
  if (x == 0) {
    return y;
  }
  return gcd(y % x, x);
}
const ll Mod = 1000000007;
ll val(ll n) {
  ll sq = 2LL;
  ll res = 1LL;
  while (n > 0) {
    if (n % 2 == 1) {
      res = (res * sq) % Mod;
    }
    n /= 2;
    sq = (sq * sq) % Mod;
  }
  return res;
}
int main() {
  assert(val(0) == 1);
  assert(val(1) == 2);
  assert(val(2) == 4);
  assert(val(3) == 8);
  assert(val(4) == 16);
  int n;
  cin >> n;
  map<pair<ll, ll>, int> counts;
  int n_zeros = 0;
  for (int i = 0; i < n; ++i) {
    ll a, b;
    cin >> a >> b;
    if (a == 0 && b == 0) {
      ++n_zeros;
    } else {
      if (a < 0 || (a == 0 && b < 0)) {
        a *= -1;
        b *= -1;
      }
      const ll g = gcd(labs(a), labs(b));
      a /= g;
      b /= g;
      counts[make_pair(a, b)]++;
    }
  }
  for (auto p : counts) {
    ll a, b;
    tie(a, b) = p.first;
    if (b > 0) {
      counts[make_pair(b, -a)];
    } else if (b == 0) {
      counts[make_pair(0, 1)];
    } else {
      counts[make_pair(-b, a)];
    }
  }
  ll ans = 1;
  for (auto p : counts) {
    ll a, b;
    tie(a, b) = p.first;
    if (b < 0) continue;
    const ll factor =
        val(counts[make_pair(a, b)]) + val(counts[make_pair(b, -a)]) - 1;
    ans = (ans * factor) % Mod;
  }
  ans = (ans + n_zeros) % Mod;
  ans = (ans - 1 + Mod) % Mod;
  cout << ans << "\n";
  return 0;
}
