#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
ll mod = 1000000007;
ll modpow(ll a, ll n) {
  ll res = 1;
  while (n > 0) {
    if (n & 1) res = res * a % mod;
    a = a * a % mod;
    n >>= 1;
  }
  return res;
}
int main() {
  int n;
  cin >> n;
  map<double, int> m;
  vector<double> ina(n);
  vector<double> inb(n);
  int zz = 0;
  int az = 0;
  int bz = 0;
  for (int i = 0; i < (n); ++i) {
    double a, b;
    cin >> a >> b;
    if (a == 0 && b == 0) {
      zz++;
    } else if (a == 0) {
      az++;
    } else if (b == 0) {
      bz++;
    } else {
      m[a / b]++;
    }
    ina[i] = a;
    inb[i] = b;
  }
  int ans = 1;
  for (int i = 0; i < (n); ++i) {
    if (ina[i] != 0 && inb[i] != 0) {
      ll sum = 0;
      sum += modpow(2, m[ina[i] / inb[i]]);
      if (m[-inb[i] / ina[i]] != 0) {
        sum += modpow(2, m[-inb[i] / ina[i]]);
        sum--;
        if (sum >= mod) sum %= mod;
      }
      m[ina[i] / inb[i]] = 0;
      m[-inb[i] / ina[i]] = 0;
      ans *= sum;
      if (ans >= mod) ans %= mod;
    }
  }
  if (az != 0 || bz != 0) {
    int ma = max(az, bz);
    int mi = min(az, bz);
    ll sum0 = 0;
    sum0 += modpow(2, ma);
    if (mi != 0) {
      sum0 += modpow(2, mi);
      if (sum0 >= mod) sum0 %= mod;
      sum0--;
    }
    ans *= sum0;
    if (ans >= mod) ans %= mod;
  }
  ans--;
  ans += zz;
  if (ans >= mod) ans %= mod;
  if (ans < 0) ans += mod;
  cout << ans << endl;
  return 0;
}
