#include <bits/stdc++.h>
using namespace std;

using ll = long long;
const ll MOD = 1e9 + 7;

// 繰り返し自乗法(x^nをmで割った余り) O(logn)
ll power(ll x, ll n, ll m) {
  ll res = 1;
  if (n > 0) {
    res = power(x, n / 2, m);
    if (n % 2 == 0) res = (res * res) % m;
    else res = (((res * res) % m) * x) % m;
  }
  return res;
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  int n;
  cin >> n;
  
  ll a_0 = 0, b_0 = 0, ab_0 = 0;
  map<pair<ll, ll>, ll> mp;
  for (int i = 0; i < n; i++) {
    ll a, b;
    cin >> a >> b;
    if (a == 0 && b == 0) {
      ab_0++;
    }
    else if (a == 0) {
      a_0++;
    }
    else if (b == 0) {
      b_0++;
    }
    else {
      if (b < 0) {
        a *= -1;
        b *= -1;
      }
      mp[make_pair(a / gcd(abs(a), abs(b)), b / gcd(abs(a), abs(b)))]++;
    }
  }
  
  ll ans = 1;
  ans *= power(2, a_0, MOD) + power(2, a_0, MOD) - 1;
  
  for (auto &i : mp) {
    auto [x, y] = i.first;
    auto z = i.second;
    if (z == 0) continue;
    ll keep = power(2, z, MOD) + power(2, mp[make_pair(y, -x)], MOD) - 1;
    ans *= (keep % MOD);
    ans %= MOD;
    i.second = 0;
    mp[make_pair(y, -x)] = 0;
  }
  
  cout << (ans + MOD - 1) % MOD << '\n';
}