#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1000000007LL;
const long long INF = 1LL << 60;
using vll = vector<long long>;
using vb = vector<bool>;
using vvb = vector<vb>;
using vvll = vector<vll>;
using vstr = vector<string>;
using pair<long long, long long> = pair<long long, long long>;
using vc = vector<char>;
using vvc = vector<vc>;
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 dx[4] = {0, 1, 0, -1};
long long dy[4] = {1, 0, -1, 0};
long long modpow(long long a, long long n, long long mod) {
  long long res = 1;
  while (n > 0) {
    if (n & 1) res = res * a % mod;
    a = a * a % mod;
    n >>= 1;
  }
  return res;
}
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
long long lcm(long long a, long long b) { return a / gcd(a, b) * b; }
int main() {
  cout << fixed << setprecision(10);
  long long n;
  cin >> n;
  vector<long long> a(0), b(0);
  long long ro = 0;
  long long ao = 0;
  long long bo = 0;
  for (long long i = 0; i < (n); i++) {
    long long aa, bb;
    cin >> aa >> bb;
    if (aa == 0 && bb == 0) {
      ro++;
      continue;
    } else if (aa == 0)
      ao++;
    else if (bb == 0)
      bo++;
    long long h = gcd(abs(aa), abs(bb));
    aa /= h;
    bb /= h;
    a.push_back(aa);
    b.push_back(bb);
  }
  map<tuple<long long, long long, long long>, long long> p;
  for (long long i = 0; i < ((long long)(a).size()); i++) {
    if (a[i] == 0 || b[i] == 0) continue;
    long long j = 1;
    if (a[i] < 0 || b[i] < 0) j *= -1;
    p[tuple<long long, long long, long long>(abs(a[i]), abs(b[i]), j)]++;
  }
  n -= ro;
  long long ans = ro;
  for (long long i = 0; i < ((long long)(a).size()); i++) {
    if (a[i] == 0) {
      ans += modpow(2, n - bo - 1, MOD);
      ans %= MOD;
      ao--;
      n--;
    } else if (b[i] == 0) {
      ans += modpow(2, n - ao - 1, MOD);
      ans %= MOD;
      bo--;
      n--;
    } else {
      long long j = 1;
      if (a[i] < 0 || b[i] < 0) j *= -1;
      ans += modpow(2,
                    n -
                        p[tuple<long long, long long, long long>(
                            abs(b[i]), abs(a[i]), -1 * j)] -
                        1,
                    MOD);
      p[tuple<long long, long long, long long>(abs(a[i]), abs(b[i]), j)]--;
      ans %= MOD;
      n--;
    }
  }
  cout << (ans) << endl;
}
