#include <bits/stdc++.h>
using namespace std;
long long a[200005], b[200005];
long long GCD(long long a, long long b) { return a ? GCD(b % a, a) : b; }
long long mod = 1000000007ll;
long long binpow(long long a, long long n) {
  long long res = 1;
  while (n) {
    if (n & 1) {
      res = (res * a) % mod;
    }
    a = (a * a) % mod;
    n /= 2;
  }
  return res;
}
int main(void) {
  int n;
  scanf("%d", &n);
  map<pair<long long, long long>, int> m;
  for (int(i) = 0; (i) < (n); (i)++) {
    scanf("%lld%lld", &a[i], &b[i]);
    long long gcd = GCD(abs(a[i]), abs(b[i]));
    a[i] /= gcd;
    b[i] /= gcd;
    if (b[i] < 0) {
      b[i] = -b[i];
      a[i] = -a[i];
    }
    m[make_pair(a[i], b[i])]++;
  }
  set<pair<long long, long long> > s;
  long long mn = 1ll;
  long long prev = 1ll;
  for (map<pair<long long, long long>, int>::iterator it = m.begin();
       it != m.end(); it++) {
    pair<long long, long long> r((*it).first.second * -1, (*it).first.first);
    if (r.second < 0) {
      r.second = -r.second;
      r.first = -r.first;
    }
    if (s.find(r) != s.end()) {
      continue;
    }
    if (m.count(r) == 0) {
      mn = (mn * 2) % mod;
    } else {
      long long cnt =
          (binpow(2ll, (*it).second) + binpow(2ll, m[r]) + mod - 2) % mod;
      prev = ((prev * cnt) % mod + prev) % mod;
      s.insert((*it).first);
    }
  }
  long long res = (prev * mn + mod - 1) % mod;
  printf("%lld\n", res);
  return 0;
}
