#include <bits/stdc++.h>
using namespace std;
template <class T>
bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
bool chmin(T &a, const T &b) {
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}
const long long MOD = 1e9 + 7;
long long gcd(long long a, long long b) {
  if (a < b) swap(a, b);
  if (b == 0)
    return a;
  else
    return gcd(b, a % b);
}
long long mod_pow(long long x, long long n, long long mod) {
  long long res = 1;
  while (n > 0) {
    if (n & 1) res = res * x % mod;
    x = x * x % mod;
    n >>= 1;
  }
  return res;
}
int main() {
  long long N;
  cin >> N;
  map<pair<long long, long long>, long long> X;
  long long A0 = 0, B0 = 0, AB0 = 0;
  for (int i = 0; i < N; i++) {
    long long a, b;
    cin >> a >> b;
    long long g = gcd(abs(a), abs(b));
    if (g == 0) {
      if (a == 0 && b == 0)
        AB0++;
      else if (a == 0)
        A0++;
      else
        B0++;
    }
    long long aa = a / g;
    long long bb = b / g;
    pair<long long, long long> p1;
    if (bb < 0) {
      p1 = make_pair(-aa, -bb);
    } else {
      p1 = make_pair(aa, bb);
    }
    X[p1]++;
  }
  long long ans = 1;
  for (auto &&p : X) {
    pair<long long, long long> ab = p.first;
    long long a = ab.first;
    long long b = ab.second;
    long long num = p.second;
    if (num == 0) continue;
    long long t;
    if (a < 0) {
      t = X[make_pair(b, -a)];
      X[make_pair(b, -a)] = 0;
    } else {
      t = X[make_pair(-b, a)];
      X[make_pair(-b, a)] = 0;
    }
    long long y1 = mod_pow(2, num, MOD);
    long long y2 = mod_pow(2, t, MOD);
    y1 %= MOD;
    y2 %= MOD;
    ans *= (y1 + y2 - 1);
    ans %= MOD;
  }
  ans *= (mod_pow(2, A0, MOD) % MOD + mod_pow(2, B0, MOD) % MOD - 1);
  ans %= MOD;
  ans += MOD - 1 + AB0;
  ans %= MOD;
  cout << ans << endl;
  return 0;
}
