#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
long long pw(long long a, long long b) {
  if (!b) return 1;
  if (b & 1) return (pw(a, b - 1) * a) % mod;
  long long v = pw(a, b / 2);
  return (v * v) % mod;
}
long long gcd(long long a, long long b) {
  if (a < b) swap(a, b);
  if (a % b == 0) return b;
  if (!b) return a;
  return gcd(b, a % b);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  int n;
  cin >> n;
  vector<pair<long long, long long>> v(n);
  map<pair<long long, long long>, long long> mp, rmp;
  long long ans = 1, cn = 0;
  for (int i = 0; i < n; ++i) {
    long long a, b;
    cin >> a >> b;
    bool ok = true;
    if (b == 0) {
      if (a > 0)
        v[i] = {1, 0};
      else if (a < 0)
        v[i] = {-1, 0};
      else {
        cn++;
        ok = false;
      }
    } else if (b > 0)
      v[i] = {a / gcd(abs(a), abs(b)), b / gcd(abs(a), abs(b))};
    else
      v[i] = {-a / gcd(abs(a), abs(b)), -b / gcd(abs(a), abs(b))};
    if (!ok) continue;
    a = v[i].first;
    b = v[i].second;
    pair<long long, long long> chk;
    if (a < 0)
      chk = {b, -a};
    else
      chk = {-b, a};
    if (mp.find(chk) != mp.end())
      rmp[chk]++;
    else
      mp[v[i]]++;
  }
  for (auto i : mp) {
    long long vl = pw(2, i.second);
    if (rmp.find(i.first) != rmp.end()) vl += pw(2, rmp[i.first]) - 1;
    ans = (ans * vl) % mod;
  }
  cout << ans + cn - 1;
}
