#include <bits/stdc++.h>
using namespace std;
int in() {
  int x;
  scanf("%d", &x);
  return x;
}
long long lin() {
  long long x;
  scanf("%lld", &x);
  return x;
}
string stin() {
  string s;
  cin >> s;
  return s;
}
long long gcd(long long a, long long b) {
  if (a < b) return gcd(b, a);
  if (b == 0) return a;
  return gcd(b, a % b);
}
long long mod = 1000000007;
long long modpow(long long a, long long b) {
  if (b == 0) return 1;
  if (b % 2 == 0) {
    long long d = modpow(a, b / 2);
    return d * d % mod;
  }
  return a * modpow(a, b - 1) % mod;
}
long long divide(long long a, long long b) {
  return a * modpow(b, mod - 2) % mod;
}
int main() {
  int n = in();
  vector<pair<long long, long long> > a(n);
  for (long long i = 0; i < n; i++) {
    a[i] = make_pair(lin(), lin());
  }
  map<pair<long long, long long>, int> m;
  for (long long i = 0; i < n; i++) {
    long long x = a[i].first;
    long long y = a[i].second;
    long long g = gcd(abs(x), abs(y));
    x /= g;
    y /= g;
    if (x < 0) {
      x = -x;
      y = -y;
    }
    m[make_pair(x, y)]++;
  }
  long long ans = 1;
  auto itr = m.begin();
  while (itr != m.end()) {
    long long x = itr->first.first;
    long long y = itr->first.second;
    long long c = itr->second;
    long long d = 0;
    if (m.find(make_pair(-y, x)) != end(m)) {
      d = m[make_pair(-y, x)];
    } else if (m.find(make_pair(y, -x)) != end(m)) {
      d = m[make_pair(y, -x)];
    }
    ans *= (modpow(2, c) + modpow(2, d) - 1) % mod;
    itr++;
    m[make_pair(x, y)] = 0;
    if (m.find(make_pair(-y, x)) != end(m)) {
      m[make_pair(-y, x)] = 0;
    } else if (m.find(make_pair(y, -x)) != end(m)) {
      d = m[make_pair(y, -x)] = 0;
    }
  }
  cout << (ans - 1) % mod << "\n";
}
