#include <algorithm>
#include <iostream>
#include <string>
#include <random>
#include <cassert>
#include <cstring>
#include <chrono>
#include <set>
#include <map>

using namespace std;

typedef long long ll;

const ll mod = 1000 * 1000 * 1000 + 7;

ll GCD(ll a, ll b) {
  if (a < 0) a *= -1;
  if (b < 0) b *= -1;
  if (a == 0) return b;
  return GCD(b % a, a);
}

void Normalize(ll& x, ll& y) {
  ll g = GCD(x, y);
  x /= g;
  y /= g;
  if (make_pair(x, y) < make_pair(-x, -y)) {
    x = -x;
    y = -y;
  }
}

ll Get(const vector<pair<int, int>>& v) {
  int min1 = mod;
  int min2 = mod;
  ll pow1 = 1;
  ll 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;
    }
  }
  ll result = (pow1 + pow2 - 1 + mod) % mod;
  if (min1 > min2) result = 1;
  return result;
}

int main()
{
  int n;
  cin >> n;
  vector<ll> x, y;
  ll add = 0;
  for (int i = 0; i < n; ++i) {
    ll a, b;
    cin >> a >> b;
    if (a == 0 && b == 0) {
      add++;
      continue;
    }
    x.push_back(a);
    y.push_back(b);
  }

  n = x.size();

  map<pair<ll, ll>, vector<pair<int, int>>> m;

  for (int i = 0; i < n; ++i) {
    ll cx = x[i];
    ll 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});
  }

  ll result = 1;
  for (auto it : m) {
    auto v = it.second;
    result = result * Get(v) % mod;
  }

  result = max<ll>(0, result - 1);
  cout << result + add << endl;

  return 0;
}
