#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); }
long long rep_pow(int n, int p) {
  if (p == 0) {
    return 1;
  }
  if (p % 2 == 0) {
    long long t = rep_pow(n, p / 2);
    return t * t % MOD;
  } else {
    return n * rep_pow(n, p - 1) % MOD;
  }
}
int main() {
  int n;
  cin >> n;
  vector<pair<long long, long long>> ps(n);
  for (int i = 0; i < n; ++i) {
    long long a, b;
    cin >> a >> b;
    long long g = gcd(abs(a), abs(b));
    if (a < 0) {
      a *= -1;
      b *= -1;
    }
    ps[i] = {a / g, b / g};
  }
  sort(ps.begin(), ps.end());
  long long ans = 1;
  set<pair<long long, long long>> mp;
  for (int i = 0; i < n; ++i) {
    auto key = ps[i];
    if (mp.find(key) != mp.end()) {
      continue;
    }
    mp.insert(key);
    long long c = upper_bound(ps.begin() + i, ps.end(), key) -
                  lower_bound(ps.begin() + i, ps.end(), key);
    long long mul = rep_pow(2, c);
    pair<long long, long long> cor = {key.second, -key.first};
    if (cor.first < 0) {
      cor.first *= -1;
      cor.second *= -1;
    }
    mp.insert(cor);
    long long d = upper_bound(ps.begin() + i, ps.end(), cor) -
                  lower_bound(ps.begin() + i, ps.end(), cor);
    mul += rep_pow(2, d);
    --mul;
    ans *= mul;
    ans %= MOD;
  }
  cout << ans - 1;
  return 0;
}
