#include <bits/stdc++.h>
using namespace std;
const long long inf = 1e18 + 7;
const int MOD = 1000000007;
struct Nums {
  long long n;
  vector<long long> kaijo;
  Nums(int N) {
    n = N;
    kaijo.push_back(1);
    for (long long i = 1; i <= n; i++) {
      kaijo.push_back((kaijo[i - 1] * i) % MOD);
    }
  }
  long myPow(long x, long n, long m) {
    if (n == 0) return 1;
    if (n % 2 == 0)
      return myPow(x * x % m, n / 2, m);
    else
      return x * myPow(x, n - 1, m) % m;
  }
  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 comb(long long N, long long K, long long rest) {
    long long res = kaijo[N] * modinv(kaijo[K], rest) % rest;
    res *= modinv(kaijo[N - K], rest);
    res %= rest;
    return res;
  }
};
long long gcd(long long a, long long b) {
  if (b == 0) {
    return a;
  } else {
    return gcd(b, a % b);
  }
}
signed main() {
  int n;
  cin >> n;
  vector<long long> a(n);
  vector<long long> b(n);
  map<pair<long long, long long>, long long> memo;
  Nums lib(n + 5);
  long long cnt0 = 0;
  for (int i = 0; i < n; ++i) {
    cin >> a[i] >> b[i];
    if (a[i] == b[i] && a[i] == 0) {
      cnt0++;
      continue;
    }
    long long ba = abs(a[i]);
    int bb = abs(b[i]);
    long long g = gcd(ba, bb);
    if (a[i] <= 0 && b[i] <= 0) {
      a[i] *= -1;
      b[i] *= -1;
    } else if (a[i] <= 0 && b[i] >= 0) {
      a[i] *= -1;
      b[i] *= -1;
    }
    pair<long long, long long> buf = {a[i] / g, b[i] / g};
    memo[buf] += 1;
  }
  long long res = 1;
  long long sum = n;
  for (auto it = memo.begin(); it != memo.end(); ++it) {
    long long buf = 0;
    sum -= it->second;
    pair<long long, long long> mp;
    mp.first = it->first.second;
    mp.second = it->first.first;
    mp.first *= -1;
    int cur = 0;
    auto it2 = memo.find(mp);
    if (it2 != memo.end()) {
      cur += it2->second;
      it2->second = 0;
    }
    mp.first *= -1;
    mp.second *= -1;
    auto it3 = memo.find(mp);
    if (it3 != memo.end()) {
      cur += it3->second;
      it3->second = 0;
    }
    buf = lib.myPow(2, it->second, MOD) - 1;
    buf += lib.myPow(2, cur, MOD);
    buf %= MOD;
    res *= buf;
    res %= MOD;
    it->second = 0;
  }
  cout << (res - 1 + cnt0 + MOD) % MOD << "\n";
  return 0;
}
