#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll mod = 1000000007;
ll pow(ll t) {
  if (!t) return 1;
  ll a = pow(t >> 1);
  a *= a;
  a %= mod;
  if (t & 1) a *= 2LL;
  return a % mod;
}
ll gcd(ll a, ll b) {
  if (a < b) swap(a, b);
  if (a % b == 0) return b;
  return gcd(b, a % b);
}
int main() {
  ll n;
  cin >> n;
  ll zz = 0;
  map<pair<int, int>, int> mem;
  for (int i = 0; i < n; i++) {
    ll a, b;
    cin >> a >> b;
    if (a == 0 && b == 0)
      zz++;
    else if (a == 0)
      mem[make_pair(0, 1)]++;
    else if (b == 0)
      mem[make_pair(1, 0)]++;
    else {
      bool neg = false;
      if (a * b < 0) {
        neg = true;
      }
      a = abs(a);
      b = abs(b);
      ll g = gcd(a, b);
      if (neg)
        mem[make_pair(a / g, -b / g)]++;
      else
        mem[make_pair(a / g, b / g)]++;
    }
  }
  ll ans = 1;
  ll cnt = zz;
  for (auto x : mem) {
    ll a, b;
    tie(a, b) = x.first;
    if (b > 0) {
      if (mem.count(make_pair(b, -a))) {
        ll i = x.second, j = mem[make_pair(b, -a)];
        ans *= (pow(i) + pow(j) - 1LL + mod) % mod;
        ans %= mod;
        cnt += i + j;
      }
    }
  }
  ans *= pow(n - cnt - zz);
  ans = (ans + zz - 1 + mod) % mod;
  cout << ans << endl;
  return 0;
}
