#include <bits/stdc++.h>
using namespace std;
using VP = vector<pair<long long, long long> >;
using VVP = vector<VP>;
using VI = vector<long long>;
using VVI = vector<VI>;
using VVVI = vector<VVI>;
const int inf = 1e9 + 7;
const long long INF = 1LL << 61;
const long long mod = 1e9 + 7;
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;
}
long long gcd(long long a, long long b) {
  if (a < b) swap(a, b);
  if (a % b == 0)
    return b;
  else
    return gcd(b, a % b);
}
pair<long long, long long> arrange(pair<long long, long long> u) {
  if (u.first == 0) return pair<long long, long long>(0, 1);
  if (u.second == 0) return pair<long long, long long>(1, 0);
  if (u.first < 0) {
    u.first = -u.first;
    u.second = -u.second;
  }
  long long g = gcd(abs(u.first), abs(u.second));
  u.first /= g;
  u.second /= g;
  return u;
}
vector<long long> inv, fact, invfact;
void Mod_build(int n = 201010) {
  fact.resize(n + 1);
  inv.resize(n + 1);
  invfact.resize(n + 1);
  fact[0] = inv[0] = invfact[0] = 1;
  inv[1] = 1;
  for (long long i = 0; i < n; i++) {
    fact[i + 1] = fact[i] * (i + 1) % mod;
    if (i > 0) inv[i + 1] = mod - inv[mod % (i + 1)] * (mod / (i + 1)) % mod;
    invfact[i + 1] = invfact[i] * inv[i + 1] % mod;
  }
}
long long perm(int n, int k) {
  if (n < 0 || k < 0 || k > n) return 0;
  return fact[n] * invfact[n - k] % mod;
}
long long comb(int n, int k) {
  if (n < 0 || k < 0 || k > n) return 0;
  return (fact[n] * invfact[n - k] % mod) * invfact[k] % mod;
}
long long powmod(long long n, long long k) {
  k %= mod - 1;
  if (k < 0) k += mod - 1;
  long long ret = 1;
  while (k) {
    if (k & 1) ret = ret * n % mod;
    n = n * n % mod;
    k >>= 1;
  }
  return ret;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  Mod_build();
  int i, j;
  map<pair<long long, long long>, long long> ma;
  int n;
  cin >> n;
  long long a[n], b[n];
  for (i = 0; i < n; i++) {
    cin >> a[i] >> b[i];
  }
  long long c = 0;
  for (i = 0; i < n; i++) {
    if (a[i] == 0 && b[i] == 0) {
      c++;
    } else {
      ma[arrange(pair<long long, long long>(b[i], a[i]))]++;
    }
  }
  long long ans = 1;
  for (i = 0; i < n; i++) {
    if (a[i] == 0 && b[i] == 0) continue;
    ans *= (powmod(2, ma[arrange(pair<long long, long long>(b[i], a[i]))]) +
            powmod(2, ma[arrange(pair<long long, long long>(-a[i], b[i]))]) +
            mod - 1) %
           mod;
    ma[arrange(pair<long long, long long>(b[i], a[i]))] = 0;
    ma[arrange(pair<long long, long long>(-a[i], b[i]))] = 0;
  }
  cout << (ans + c - 1 + mod) % mod << endl;
}
