#include <bits/stdc++.h>
using namespace std;
const int MAXN = 2e5 + 5;
const int mod = 1e9 + 7;
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
inline long long pw(long long a, int b) {
  long long res = 1;
  while (b) {
    if (b & 1) res = res * a % mod;
    a = a * a % mod;
    b >>= 1;
  }
  return res;
}
map<pair<long long, long long>, int> t;
int main(void) {
  int n;
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) {
    long long a, b;
    scanf("%lld%lld", &a, &b);
    if (a && !b) a = 1;
    if (b && !a) b = 1;
    if (a && b) {
      long long tmp = gcd(a, b);
      a /= tmp;
      b /= tmp;
    }
    if (a < 0) a = -a, b = -b;
    ++t[make_pair(a, b)];
  }
  long long ans = 1;
  for (map<pair<long long, long long>, int>::iterator it = t.begin();
       it != t.end(); ++it) {
    long long a = it->first.first;
    long long b = it->first.second;
    int x = it->second;
    long long aa = -b, bb = a;
    if (aa < 0) aa = -aa, bb = -bb;
    if (aa == a && bb == b)
      ans = ans * (x + 1) % mod;
    else {
      int y = t[make_pair(aa, bb)];
      t.erase(make_pair(aa, bb));
      ans = ans * (pw(2, x) + pw(2, y) - 1 + mod) % mod;
    }
  }
  printf("%lld", (ans - 1 + mod) % mod);
  return 0;
}
