#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000 * 1000 * 1000 + 7;
long long GCD(long long a, long long b) {
  if (a < 0) a *= -1;
  if (b < 0) b *= -1;
  if (a == 0) return b;
  return GCD(b % a, a);
}
void Normalize(long long& x, long long& y) {
  long long g = GCD(x, y);
  x /= g;
  y /= g;
  if (make_pair(x, y) < make_pair(-x, -y)) {
    x = -x;
    y = -y;
  }
}
long long Get(const vector<pair<int, int>>& v) {
  int min1 = mod;
  int min2 = mod;
  long long pow1 = 1;
  long long pow2 = 1;
  for (auto p : v) {
    if (p.first == 0) {
      min1 = min(min1, p.second);
      pow1 = pow1 * 2 % mod;
    } else {
      min2 = min(min2, p.second);
      pow2 = pow2 * 2 % mod;
    }
  }
  long long result = (pow1 + pow2 - 1 + mod) % mod;
  if (min1 > min2) result = 1;
  return result;
}
int main() {
  int n;
  cin >> n;
  vector<long long> x, y;
  long long add = 0;
  for (int i = 0; i < n; ++i) {
    long long a, b;
    cin >> a >> b;
    if (a == 0 && b == 0) {
      add = 1;
      continue;
    }
    x.push_back(a);
    y.push_back(b);
  }
  n = x.size();
  map<pair<long long, long long>, vector<pair<int, int>>> m;
  for (int i = 0; i < n; ++i) {
    long long cx = x[i];
    long long cy = y[i];
    Normalize(cx, cy);
    m[{cx, cy}].push_back({0, i});
    cx = y[i];
    cy = -x[i];
    Normalize(cx, cy);
    m[{cx, cy}].push_back({1, i});
  }
  long long result = 1;
  for (auto it : m) {
    auto v = it.second;
    result = result * Get(v) % mod;
  }
  result = max<long long>(0, result - 1);
  cout << (result + add - 1 + mod) % mod << endl;
  return 0;
}
