#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1000000007;
long long gcd(long long a, long long b) {
  while (b) {
    long long c = b;
    b = a % b;
    a = c;
  }
  return a;
}
long long pow_mod(long long n, long long k, long long m) {
  long long r = 1;
  for (; k > 0; k >>= 1) {
    if (k & 1) r = (r * n) % m;
    n = (n * n) % m;
  }
  return r;
}
int main() {
  int N;
  cin >> N;
  long long A, B;
  map<pair<long long, long long>, long long> cnt;
  long long zero = 0;
  for (int i = 0; i < (int)(N); i++) {
    cin >> A >> B;
    if (A == 0 && B == 0) {
      zero++;
      continue;
    }
    if (A < 0 || (A == 0 && B < 0)) {
      A *= -1;
      B *= -1;
    }
    long long g = gcd(A, B);
    A /= g;
    B /= g;
    cnt[make_pair(A, B)]++;
  }
  long long ans = 1;
  long long x1, y1;
  auto begin = cnt.begin(), end = cnt.end();
  for (auto iter = begin; iter != end; iter++) {
    auto i = iter->first;
    auto num = iter->second;
    x1 = i.second;
    y1 = i.first * -1;
    if (x1 < 0 || (x1 == 0 && y1 < 0)) {
      x1 *= -1;
      y1 *= -1;
    }
    auto p = make_pair(x1, y1);
    if (cnt.find(p) != end) {
      ans *= ((pow_mod(2, num, MOD) + pow_mod(2, cnt[p], MOD) - 1) % MOD);
      ans %= MOD;
      cnt.erase(p);
    } else {
      ans *= pow_mod(2, num, MOD);
      ans %= MOD;
    }
  }
  ans += zero - 1;
  ans %= MOD;
  cout << ans << endl;
}
