#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<ll, ll>;
const ll mod = 1e9 + 7;
const ll inf = 1e15;
ll power(ll a, ll b) {
  return b ? power(a * a % mod, b / 2) * (b % 2 ? a : 1) % mod : 1;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  ll n;
  cin >> n;
  map<double, ll> c, d;
  vector<double> a(n), b(n);
  vector<P> pairs;
  ll allzero = 0;
  for (long long i = 0; i < n; i++) {
    cin >> a[i] >> b[i];
    if (a[i] == 0 && b[i] != 0)
      c[0.0]++;
    else if (b[i] == 0 && a[i] != 0)
      d[0.0]++;
    else if (a[i] == 0 && b[i] == 0)
      allzero++;
    else {
      c[b[i] / a[i]]++;
      d[a[i] / b[i] * (-1)]++;
    }
  }
  n -= allzero;
  ll sum = 1;
  for (auto p : c) {
    if (d[p.first]) {
      ll x = p.second;
      ll y = d[p.first];
      if (p.first != 0)
        d[-1 / p.first] = 0;
      else
        d[0.0] = 0;
      n -= x;
      n -= y;
      sum *= (x + 1) * (y + 1) - 1;
      sum %= mod;
    }
  }
  ll ans = sum * power(2, n) % mod - 1;
  cout << ans % mod << endl;
  return 0;
}
