#include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007;
const int N = 222222;
long long n;
long long a[N], b[N];
void init() {
  cin >> n;
  for (int i = 0; i < (int)(n); i++) {
    cin >> a[i] >> b[i];
  }
}
long long gcd(long long a, long long b) {
  while (1) {
    if (a < b) swap(a, b);
    if (!b) break;
    a %= b;
  }
  return a;
}
map<pair<long long, long long>, long long> dict;
set<pair<long long, long long> > used;
void solve() {
  long long kai[N] = {0};
  kai[0] = 1;
  for (int i = 1; i < (int)(n + 1); i++) {
    kai[i] = (kai[i - 1] * 2) % MOD;
  }
  long long zeroCount = 0;
  for (int i = 0; i < (int)(n); i++) {
    long long g = 1;
    if (a[i] != 0 && b[i] != 0) {
      g = gcd(abs(a[i]), abs(b[i]));
    }
    if (a[i] == 0 && b[i] == 0) {
      zeroCount++;
      continue;
    }
    if (a[i] == 0) {
      b[i] = 1;
    }
    if (b[i] == 0) {
      a[i] = 1;
    }
    long long aa = a[i] / g;
    long long bb = b[i] / g;
    if (aa < 0) {
      aa *= -1;
      bb *= -1;
    }
    pair<long long, long long> p = pair<long long, long long>(aa, bb);
    dict[p]++;
  }
  long long result = 1;
  for (map<pair<long long, long long>, long long>::iterator it = dict.begin();
       it != dict.end(); it++) {
    pair<long long, long long> key = it->first;
    pair<long long, long long> rev =
        pair<long long, long long>(key.second, -key.first);
    if (rev.first < 0) {
      rev.first *= -1;
      rev.second *= -1;
    }
    if (rev.first == 0) {
      rev.second = 1;
    }
    if (rev.second == 0) {
      rev.first = 1;
    }
    if (dict.find(rev) != dict.end()) {
      if (used.find(rev) == used.end()) {
        long long acount = it->second;
        long long bcount = dict[rev];
        long long kaiPlus = (kai[acount] + kai[bcount] - 1) % MOD;
        result = (result * kaiPlus) % MOD;
        used.insert(key);
        used.insert(rev);
      }
    } else {
      result = (result * 2) % MOD;
    }
  }
  result = (result + zeroCount) % MOD;
  result -= 1;
  if (result < 0) {
    result += MOD;
  }
  cout << result << endl;
}
int main() {
  init();
  solve();
}
