#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
using dou = long double;
string yes = "yes";
string Yes = "Yes";
string YES = "YES";
string no = "no";
string No = "No";
string NO = "NO";
template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
const int INF = 1000000000;
const double dINF = 1000000000;
const long long INF64 = 922337203685477580ll;
const long long MOD = 1000000007ll;
const dou pi = 3.141592653589793 * 2;
long long ggd(long long a, long long b) {
  if (a < b) swap(a, b);
  if (b == 0) {
    return a;
  }
  return ggd(b, a % b);
}
long long lcm(long long number1, long long number2) {
  return number1 / ggd(number1, number2) * number2;
}
long long modpow(long long a, long long n) {
  long long res = 1;
  while (n > 0) {
    if (n & 1) res = res * a % MOD;
    a = a * a % MOD;
    n >>= 1;
  }
  return res;
}
long long modinv(long long a, long long m) {
  long long b = m, u = 1, v = 0;
  while (b) {
    long long t = a / b;
    a -= t * b;
    swap(a, b);
    u -= t * v;
    swap(u, v);
  }
  u %= m;
  if (u < 0) u += m;
  return u;
}
long long moddiv(long long a, long long b) {
  return (a * modinv(b, MOD) % MOD);
}
int main() {
  int n;
  std::cin >> n;
  std::vector<long long> a(n), b(n);
  std::map<long long, int> ma, mb, mao, mbo;
  for (long long i = 0; i < (long long)(n); i++) {
    std::cin >> a[i] >> b[i];
    long long d = ggd(abs(a[i]), abs(b[i]));
    if (d != 0) {
      a[i] /= d;
      b[i] /= d;
    }
    if (a[i] == 0) {
      mbo[b[i]]++;
    } else {
      mb[b[i]++];
    }
    if (b[i] == 0) {
      mao[a[i]]++;
    } else {
      ma[a[i]++];
    }
    if (b[i] < 0) {
      a[i] *= -1;
      b[i] *= -1;
    }
  }
  long long nn = n;
  std::map<pair<long long, long long>, int> m;
  long long c0 = 0, c = 0, cc = 0;
  long long ans = modpow(2, n);
  for (long long i = 0; i < (long long)(n); i++) {
    if (a[i] == 0) {
      if (b[i] == 0)
        c0++;
      else
        c++;
    } else if (b[i] == 0)
      cc++;
    else {
      m[make_pair(a[i], b[i])]++;
    }
  }
  if (m.size() != 0) {
    for (auto i : m) {
      long long aa = i.first.first;
      long long bb = i.first.second;
      long long du = m[i.first];
      if (aa > 0) break;
      if (m[make_pair(bb, aa * -1)]) {
        long long dudu = m[make_pair(bb, aa * -1)];
        ans = moddiv(ans, modpow(2, du + dudu));
        ans *= (modpow(2, du + dudu) -
                ((modpow(2, du) - 1) * (modpow(2, dudu) - 1)) % MOD);
      }
    }
  }
  for (long long i = 0; i < (long long)(c0); i++) {
    ans = moddiv(ans, 2);
  }
  long long du = c, dudu = cc;
  ans = moddiv(ans, modpow(2, du + dudu));
  ans *= (modpow(2, du + dudu) -
          ((modpow(2, du) - 1) * (modpow(2, dudu) - 1)) % MOD);
  for (auto i : mao) {
    if (i.first < 0)
      if (mao[i.first * -1]) {
        du = mao[i.first];
        dudu = mao[i.first * -1];
        ans -= (((modpow(2, (n - du - dudu)) * (modpow(2, du) - 1)) % MOD) *
                (modpow(2, dudu) - 1)) %
               MOD;
      }
    if (i.first != 0) {
      du = mao[i.first];
      dudu = ma[i.first * -1];
      ans -= (((modpow(2, (n - du - dudu)) * (modpow(2, du) - 1)) % MOD) *
              (modpow(2, dudu) - 1)) %
             MOD;
    }
  }
  for (auto i : mbo) {
    if (i.first < 0)
      if (mbo[i.first * -1]) {
        du = mbo[i.first];
        dudu = mbo[i.first * -1];
        ans -= (((modpow(2, (n - du - dudu)) * (modpow(2, du) - 1)) % MOD) *
                (modpow(2, dudu) - 1)) %
               MOD;
      }
    if (i.first != 0) {
      du = mbo[i.first];
      dudu = mb[i.first * -1];
      ans -= (((modpow(2, (n - du - dudu)) * (modpow(2, du) - 1)) % MOD) *
              (modpow(2, dudu) - 1)) %
             MOD;
    }
  }
  ans += MOD * 100000;
  std::cout << (ans - 1) % MOD << std::endl;
}
