#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
long long lcm(long long a, long long b) { return a / gcd(a, b) * b; }
const long long mod = 1000000007;
struct mint {
  long long x;
  mint(long long x = 0) : x((x % mod + mod) % mod) {}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod - a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res += a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res -= a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res *= a;
  }
  mint pow(long long t) const {
    if (!t) return 1;
    mint a = pow(t >> 1);
    a *= a;
    if (t & 1) a *= *this;
    return a;
  }
  mint inv() const { return pow(mod - 2); }
  mint& operator/=(const mint a) { return (*this) *= a.inv(); }
  mint operator/(const mint a) const {
    mint res(*this);
    return res /= a;
  }
};
struct combination {
  vector<mint> fact, ifact;
  combination(int n) : fact(n + 1), ifact(n + 1) {
    assert(n < mod);
    fact[0] = 1;
    for (int i = 1; i <= n; ++i) fact[i] = fact[i - 1] * i;
    ifact[n] = fact[n].inv();
    for (int i = n; i >= 1; --i) ifact[i - 1] = ifact[i] * i;
  }
  mint operator()(int n, int k) {
    if (k < 0 || k > n) return 0;
    return fact[n] * ifact[k] * ifact[n - k];
  }
  mint p(int n, int k) { return fact[n] * ifact[n - k]; }
};
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  mint ans(1);
  map<pair<long long, long long>, pair<long long, long long> > counter;
  for (long long i = 0; i < long long(n); i++) {
    long long a, b;
    cin >> a >> b;
    if (b < 0) {
      a = -a;
      b = -b;
    }
    if (a == 0 && b == 0) {
      counter[make_pair(0, 0)].first++;
    } else {
      long long g = abs(gcd(a, b));
      a /= g;
      b /= g;
      if (a <= 0) {
        counter[make_pair(b, -a)].second++;
      } else {
        counter[make_pair(a, b)].first++;
      }
    }
  }
  for (auto p : counter) {
    mint mult = mint(2).pow(p.second.first) + mint(2).pow(p.second.second) +
                mint(mod - 1ll);
    ans *= mult;
  }
  ans += mint(counter[make_pair(0ll, 0ll)].first - 1);
  cout << ans.x << endl;
}
