#include <bits/stdc++.h>
using namespace std;
typedef unsigned int UI;
typedef long int LI;
typedef unsigned long int ULI;
typedef long long int LL;
typedef unsigned long long int ULL;
const LL MOD = 1e9 + 7;
inline int scanInt() {
  int n = 0;
  char ch = getchar();
  int sign = 1;
  while (ch < '0' || ch > '9') {
    if (ch == '-') sign = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    n = (n << 1) + (n << 3) + (int)(ch - '0');
    ch = getchar();
  }
  return n * sign;
}
inline LL scanLong() {
  LL n = 0;
  char ch = getchar();
  LL sign = 1;
  while (ch < '0' || ch > '9') {
    if (ch == '-') sign = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    n = (n << 1) + (n << 3) + (LL)(ch - '0');
    ch = getchar();
  }
  return n * sign;
}
LL gcd(LL a, LL b) {
  if (a == 0) return b;
  return gcd(b % a, a);
}
pair<LL, LL> conjugate(pair<LL, LL> p) {
  if (p.first == 0) return make_pair(1, 0);
  if (p.second == 0) return make_pair(0, 1);
  pair<LL, LL> res = make_pair(-p.second, p.first);
  if (res.second < 0) {
    res.first = -res.first;
    res.second = -res.second;
  }
  return res;
}
LL modpow(LL a, LL n, LL m) {
  LL res = 1;
  while (n != 0) {
    if (n % 2 == 1) res = (res * a) % m;
    a = (a * a) % m;
    n >>= 1;
  }
  return res;
}
int main() {
  LL n = scanLong();
  ;
  map<pair<LL, LL>, LL> counts;
  LL total = 0;
  LL azero = 0, bzero = 0, abzero = 0;
  for (__typeof(n) i = (0) - ((0) > (n)); i != (n) - ((0) > (n));
       i += 1 - 2 * ((0) > (n))) {
    LL a = scanLong();
    ;
    LL b = scanLong();
    ;
    if (a == 0 && b == 0)
      abzero++;
    else if (a == 0)
      counts[make_pair(0, 1)]++;
    else if (b == 0)
      counts[make_pair(1, 0)]++;
    else {
      if (b < 0) {
        a = -a;
        b = -b;
      }
      LL g = gcd(abs(a), abs(b));
      pair<LL, LL> p = make_pair(a / g, b / g);
      counts[p]++;
      total++;
    }
  }
  LL ans = 1;
  for (auto it : counts) {
    pair<LL, LL> p = it.first;
    pair<LL, LL> cp = conjugate(p);
    cout << p.first << " " << p.second << " : " << cp.first << " " << cp.second
         << endl;
    cout << counts[p] << " " << counts[cp] << endl;
    ans *= ((modpow(2ll, counts[p], MOD) + modpow(2ll, counts[cp], MOD) - 1 +
             MOD) %
            MOD);
    ans %= MOD;
    counts[p] = counts[cp] = 0;
  }
  ans = (ans - 1 + MOD) % MOD;
  if (total > abzero && abzero > 0) {
    ans = (ans + 1) % MOD;
  }
  printf("%lld ", ans);
  printf("\n");
}
