#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
template <class T>
void print_container(T &container, string delim = " ") {
  bool first = true;
  for (auto &t : container) {
    if (!first) {
      cout << delim;
    }
    first = false;
    cout << t;
  }
  cout << endl;
}
const int MOD = 1e9 + 7;
ll power(int n, int p) {
  if (p == 0) return 1;
  long long res = 1;
  long long add = n;
  while (p > 0) {
    if (p & 1) res = (res * add) % MOD;
    p >>= 1;
    add = add * add % MOD;
  }
  return res;
}
ll gcd(ll a, ll b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
int main() {
  int n;
  cin >> n;
  vector<ll> a, b;
  ll ab0 = 0;
  for (int((i)) = (0); ((i)) < ((n)); ((i))++) {
    int ta, tb;
    cin >> ta >> tb;
    if (ta == 0 && tb == 0) {
      ab0++;
    } else {
      a.push_back(ta);
      b.push_back(tb);
    }
  }
  n = a.size();
  map<pair<ll, ll>, ll> dic;
  for (int((i)) = (0); ((i)) < ((n)); ((i))++) {
    ll ta = a[i], tb = b[i];
    bool minus = (ta > 0 && tb < 0) || (ta < 0 && tb > 0);
    ta = abs(ta);
    tb = abs(tb);
    ll g = gcd(ta, tb);
    ta /= g;
    tb /= g;
    ta = (minus ? -ta : ta);
    dic[{ta, tb}]++;
  }
  ll ans = 1;
  for (auto p : dic) {
    if (p.second == 0) continue;
    ll ta = p.first.first, tb = p.first.second;
    pair<ll, ll> target;
    if (ta < 0) {
      target = make_pair(tb, -ta);
    } else {
      target = make_pair(-tb, ta);
    }
    if (dic.count(target)) {
      ll tomul = (power(2, p.second) + power(2, dic[target]) - 1) % MOD;
      ans = (ans * tomul) % MOD;
      p.second = 0;
      dic[target] = 0;
    } else {
      ans = (ans * power(2, p.second)) % MOD;
    }
  }
  ans = (ans + ab0) % MOD;
  cout << (ans + MOD - 1) % MOD << endl;
  return 0;
}
