#include <bits/stdc++.h>
using namespace std;
long long ggcd(long long a, long long b) {
  if (a < b) return ggcd(b, a);
  long long r;
  while ((r = a % b)) {
    a = b;
    b = r;
  }
  return b;
}
int main() {
  long long n;
  cin >> n;
  long long aaa = 0;
  long long aa = 0, bb = 0;
  long long ans = 1;
  long long p = 1000000007;
  map<pair<long long, long long>, long long> k;
  map<pair<long long, long long>, long long> l;
  for (int i = 0; i < (int)(n); i++) {
    long long a, b;
    cin >> a >> b;
    if (a == 0 && b == 0) {
      aaa++;
      continue;
    }
    if (a == 0 && b != 0) {
      aa++;
      continue;
    }
    if (a != 0 && b == 0) {
      bb++;
      continue;
    }
    long long c = ggcd(abs(a), abs(b));
    a /= c;
    b /= c;
    if (a < 0) {
      a = -1 * a;
      b = -1 * b;
    }
    k[make_pair(a, b)]++;
    if (b < 0) {
      a = -1 * a;
      b = -1 * b;
    }
    l[make_pair(b, a)]++;
  }
  long long u[200001];
  u[0] = 1;
  for (int i = 0; i < (int)(200000); i++) {
    u[i + 1] = u[i] * 2 % p;
  }
  set<pair<long long, long long>> s;
  for (pair<pair<long long, long long>, long long> w : k) {
    pair<long long, long long> o = w.first;
    long long z = w.second, x = o.first, y = o.second;
    long long xx = x, yy = y;
    if (yy < 0) {
      xx = -1 * xx;
      yy = -1 * yy;
    }
    if (s.count(make_pair(yy, xx))) continue;
    s.insert(make_pair(x, -y));
    ans = ans * ((u[z] + u[l[make_pair(x, -y)]] - 1) % p) % p;
  }
  ans = ans * ((u[aa] + u[bb] - 1) % p) % p;
  if (aaa > 0) ans++;
  cout << ans - 1 << endl;
}
