#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 gcd(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;
  unordered_map<long long, unordered_map<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 && b != 0) {
      zpair.first++;
      continue;
    }
    if (b == 0 && a != 0) {
      zpair.second++;
      continue;
    }
    long long d = gcd(llabs(a), llabs(b));
    a /= d;
    b /= d;
    if (a < 0) {
      a *= -1ll;
      b *= -1ll;
    }
    if (b > 0) {
      if (umap.count(a) == 0) {
        unordered_map<long long, pair<int, int>> u;
        u[b] = {1, 0};
        umap[a] = u;
      } else {
        if (umap[a].count(b) == 0) {
          umap[a][b] = {1, 0};
        } else {
          umap[a][b].first++;
        }
      }
    } else {
      long long t = b;
      b = a;
      a = -t;
      if (umap.count(a) == 0) {
        unordered_map<long long, pair<int, int>> u;
        u[b] = {0, 1};
        umap[a] = u;
      } else {
        if (umap[a].count(b) == 0) {
          umap[a][b] = {0, 1};
        } else {
          umap[a][b].second++;
        }
      }
    }
  }
  long long answer = (fac2[zpair.first] + fac2[zpair.second] - 1ll) % MOD;
  for (auto item : umap) {
    for (auto item2 : item.second) {
      answer *= (fac2[item2.second.first] + fac2[item2.second.second] - 1ll);
      answer %= MOD;
    }
  }
  cout << (answer - 1ll + zero) % MOD << endl;
  return 0;
}
