#include <bits/stdc++.h>
using namespace std;
using pint = pair<int, int>;
using ll = long long;
using ull = unsigned long long;
using vll = vector<long long>;
using pll = pair<ll, ll>;
constexpr ll INF = 1e15 + 7LL;
constexpr ll MOD = 1e9 + 7LL;
template <typename T>
istream &operator>>(istream &is, vector<T> &v) {
  for (int i = 0; i < v.size(); ++i) {
    is >> v[i];
  }
  return is;
}
template <typename T>
ostream &operator<<(ostream &os, const vector<T> &v) {
  for (int i = 0; i < v.size() - 1; ++i) {
    os << v[i] << " ";
  }
  if (v.size() > 0) {
    os << v[v.size() - 1] << endl;
  }
  return os;
}
ll gcd(ll a, ll b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
int main() {
  int n;
  cin >> n;
  vll a(n), b(n);
  for (int i = (0), i_end_ = (n); i < i_end_; i++) {
    cin >> a[i] >> b[i];
    if (b[i] < 0) {
      b[i] *= -1;
      a[i] *= -1;
    }
    if (a[i] == 0 && b[i] != 0) {
      b[i] = 1;
    } else if (a[i] != 0 && b[i] == 0) {
      a[i] = 1;
    }
    ll val = gcd(abs(a[i]), abs(b[i]));
    if (val > 0) {
      a[i] /= val;
      b[i] /= val;
    }
  }
  map<pair<ll, ll>, int> ma;
  for (int i = (0), i_end_ = (n); i < i_end_; i++) {
    ma[make_pair(a[i], b[i])]++;
  }
  vll twopar(300000, 1);
  for (int i = (0), i_end_ = (300000 - 1); i < i_end_; i++) {
    twopar[i + 1] = twopar[i] * 2 % MOD;
  }
  ll ans = 1;
  set<pll> seen;
  for (auto elem : ma) {
    pll now = elem.first;
    if (seen.find(now) != seen.end()) {
      continue;
    }
    pll val{-now.second, now.first};
    if (val.second < 0) {
      val.first *= -1;
      val.second *= -1;
    }
    seen.insert(val);
    ans = (ans *
           (((twopar[elem.second] + twopar[ma[val]]) % MOD - 1 + MOD) % MOD)) %
          MOD;
  }
  cout << ans - 1 << endl;
}
