#include <bits/stdc++.h>
using namespace std;
const long long MAX_N = 234567;
long long MOD = long long(1000000000 + 7);
long long fac2[MAX_N];
long long mygcd(long long a, long long b) {
  if (a < b) {
    swap(a, b);
  }
  long long r = a % b;
  while (r != 0) {
    a = b;
    b = r;
    r = a % b;
  }
  return b;
}
void init() {
  fac2[0] = 1ll;
  for (int i = 1; i < MAX_N; i++) {
    fac2[i] = (fac2[i - 1] * 2ll) % MOD;
  }
}
int main(void) {
  init();
  long long N;
  cin >> N;
  map<pair<long long, long long>, pair<int, int>> umap;
  pair<int, int> zpair = {0, 0};
  long long zero = 0;
  for (int i = 0; i < N; i++) {
    long long a, b;
    cin >> a >> b;
    if (a == 0 && b == 0) {
      zero++;
      continue;
    }
    if (a == 0) {
      zpair.first++;
      continue;
    }
    if (b == 0) {
      zpair.second++;
      continue;
    }
    long long d = mygcd(llabs(a), llabs(b));
    a /= d;
    b /= d;
    if (a < 0) {
      a *= -1ll;
      b *= -1ll;
    }
    if (b > 0) {
      umap[{a, b}].first += 1;
    } else {
      umap[{-b, a}].second += 1;
    }
  }
  long long answer = (fac2[zpair.first] + fac2[zpair.second] - 1ll) % MOD;
  for (auto item : umap) {
    answer *= (fac2[item.second.first] + fac2[item.second.second] - 1ll);
    answer %= MOD;
  }
  cout << (answer - 1ll + zero) % MOD << endl;
  return 0;
}
