#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) {
  if (a < b) gcd(b, a);
  long long r = 1;
  while (r != 0) {
    r = a % b;
    a = b;
    b = r;
  }
  return a;
}
long long modpow(long long a, long long n, long long mod = 1000000007) {
  long long res = 1;
  while (n > 0) {
    if (n & 1) res = res * a % mod;
    a = a * a % mod;
    n >>= 1;
  }
  return res;
}
int main() {
  int n;
  cin >> n;
  vector<long long> a(n), b(n);
  map<pair<long long, long long>, long long> r1, r2;
  for (int i = 0; i < n; i++) {
    cin >> a[i] >> b[i];
    long long g = gcd(abs(a[i]), abs(b[i]));
    long long sig = a[i] * b[i];
    if (a[i] * b[i] > 0) {
      sig = 1;
    }
    if (a[i] * b[i] < 0) {
      sig = -1;
    }
    r1[make_pair(sig * abs(a[i]) / g, abs(b[i]) / g)]++;
    r2[make_pair(abs(b[i]) / g, -sig * abs(a[i]) / g)]++;
  }
  long long ans = 1;
  for (auto &e : r1) {
    auto tmp = e.first;
    swap(tmp.first, tmp.second);
    ans *= modpow(2, e.second) + modpow(2, r2[tmp]) - 1;
    ans %= 1000000007;
    r2[tmp] = 0;
    e.second = 0;
  }
  cout << ans - 1 << endl;
}
