#include <bits/stdc++.h>
using ll = long long;
using namespace std;
const ll mod = 1000000007;
ll GCD(ll a, ll b) { return (b == 0 ? a : GCD(b, a % b)); }
ll modpow(ll a, ll n, ll p = mod) {
  ll res = 1;
  while (n) {
    if (n & 1) res = res * a % p;
    a = a * a % p;
    n >>= 1;
  }
  return res;
}
int main() {
  ll n;
  cin >> n;
  ll count00 = 0;
  ll count0a = 0;
  ll count0b = 0;
  map<pair<ll, ll>, pair<ll, ll>> data;
  for (int i = 0; i < (n); i++) {
    ll a, b;
    cin >> a >> b;
    if (a == 0 && b == 0)
      count00++;
    else if (a == 0)
      count0a++;
    else if (b == 0)
      count0b++;
    else {
      ll div = GCD(abs(a), abs(b));
      a /= div;
      b /= div;
      if (b < 0) {
        a *= -1;
        b *= -1;
      }
      if (a > 0)
        data[make_pair(a, b)].first++;
      else
        data[make_pair(b, -a)].second++;
    }
  }
  ll ans = modpow(2, count0a + count0b) -
           (modpow(2, count0a) - 1) * (modpow(2, count0b) - 1) % mod + mod;
  ans %= mod;
  for (auto P : data) {
    auto p = P.second;
    ans *= (modpow(2, p.first + p.second) -
            (modpow(2, p.first) - 1) * (modpow(2, p.second) - 1) % mod + mod) %
           mod;
    ans %= mod;
  }
  cout << (ans + count00 - 1) % mod << endl;
  return 0;
}
