#include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007;
int gcd(int p, int q) {
  if (p % q == 0) return q;
  return gcd(q, p % q);
}
int main() {
  int n, tmp;
  cin >> n;
  int64_t a[n + 1], b[n + 1];
  int64_t zero = 0, xziku = 0, yziku = 0;
  map<pair<int64_t, int64_t>, pair<int64_t, int64_t>> muki;
  for (int i = 1; i <= n; i++) cin >> a[i] >> b[i];
  for (int i = 1; i <= n; i++) {
    if (a[i] == 0 && b[i] == 0)
      zero++;
    else if (a[i] == 0)
      yziku++;
    else if (b[i] == 0)
      xziku++;
    else if (a[i] > 0 && b[i] > 0) {
      muki[make_pair(a[i] / gcd(a[i], b[i]), b[i] / gcd(a[i], b[i]))].first++;
    } else if (a[i] < 0 && b[i] > 0) {
      tmp = a[i];
      a[i] = b[i];
      b[i] = -tmp;
      muki[make_pair(a[i] / gcd(a[i], b[i]), b[i] / gcd(a[i], b[i]))].second++;
    } else if (a[i] < 0 && b[i] < 0) {
      a[i] = -a[i];
      b[i] = -b[i];
      muki[make_pair(a[i] / gcd(a[i], b[i]), b[i] / gcd(a[i], b[i]))].first++;
    } else if (a[i] > 0 && b[i] < 0) {
      tmp = a[i];
      a[i] = -b[i];
      b[i] = tmp;
      muki[make_pair(a[i] / gcd(a[i], b[i]), b[i] / gcd(a[i], b[i]))].second++;
    }
  }
  vector<int64_t> pow2(200002, 1);
  for (int i = 0; i < 200001; i++) {
    pow2[i + 1] = 2 * pow2[i];
    pow2[i + 1] %= MOD;
  }
  int64_t multi = 1;
  for (auto c : muki) {
    multi *= pow2[c.second.first] + pow2[c.second.second] - 1;
    multi %= MOD;
  }
  if (yziku != 0 || xziku != 0) {
    multi *= pow2[yziku] + pow2[xziku] - 1;
    multi %= MOD;
  }
  multi = (multi - 1 + MOD) % MOD;
  cout << multi + zero << endl;
}
