#include <bits/stdc++.h>
using namespace std;
int dy[] = {0, 0, 1, -1};
int dx[] = {1, -1, 0, 0};
struct mint {
  long long x;
  mint(long long x = 0)
      : x((x % (long long)(1e9 + 7) + (long long)(1e9 + 7)) %
          (long long)(1e9 + 7)) {}
  mint operator-() const { return mint(-x); }
  mint& operator+=(const mint a) {
    if ((x += a.x) >= (long long)(1e9 + 7)) x -= (long long)(1e9 + 7);
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += (long long)(1e9 + 7) - a.x) >= (long long)(1e9 + 7))
      x -= (long long)(1e9 + 7);
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= (long long)(1e9 + 7);
    return *this;
  }
  mint operator+(const mint a) const { return mint(*this) += a; }
  mint operator-(const mint a) const { return mint(*this) -= a; }
  mint operator*(const mint a) const { return mint(*this) *= 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((long long)(1e9 + 7) - 2); }
  mint& operator/=(const mint a) { return *this *= a.inv(); }
  mint operator/(const mint a) const { return mint(*this) /= a; }
};
long long gcd(long long a, long long b) {
  long long r, tmp;
  if (a < b) {
    tmp = a;
    a = b;
    b = tmp;
  }
  r = a % b;
  while (r != 0) {
    a = b;
    b = r;
    r = a % b;
  }
  return b;
}
istream& operator>>(istream& is, const mint& a) { return is >> a.x; }
ostream& operator<<(ostream& os, const mint& a) { return os << a.x; }
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  long long n;
  cin >> n;
  mint ans = mint(1);
  map<pair<long long, long long>, mint> mp;
  mint cnt00 = mint(0);
  mint cnt01 = mint(0);
  mint cnt10 = mint(0);
  for (int i = 0; i < n; ++i) {
    long long a, b;
    cin >> a >> b;
    if (a == 0 && b == 0) {
      cnt00 += mint(1);
    } else if (a == 0) {
      cnt01 += mint(1);
    } else if (b == 0) {
      cnt10 += mint(1);
    } else {
      long long ma = 1, mb = 1;
      if (a < 0) {
        ma = -1;
        a = -a;
      }
      if (b < 0) {
        mb = -1;
        b = -b;
      }
      long long gc = gcd(a, b);
      a /= gc;
      b /= gc;
      if (ma * mb < 0) {
        a = -a;
      }
      mp[make_pair(a, b)] += mint(0);
      if (a < 0) {
        mp[make_pair(b, -a)] += mint(1);
      } else {
        mp[make_pair(-b, a)] += mint(1);
      }
    }
  }
  for (auto p : mp) {
    mint xi = p.second;
    long long ai = p.first.first;
    long long bi = p.first.second;
    long long aj, bj;
    if (ai < 0) {
      aj = bi;
      bj = -ai;
    } else {
      aj = -bi;
      bj = ai;
    }
    mint xj = mp[make_pair(aj, bj)];
    mint two = mint(2);
    mint cnt = two.pow(xi.x) + two.pow(xj.x) - mint(1);
    ans *= (cnt);
    mp[make_pair(aj, bj)] = mint(0);
    mp[make_pair(ai, bi)] = mint(0);
  }
  mint zero = mint(1);
  zero += cnt01 * (cnt01 - mint(1));
  zero += cnt10 * (cnt10 - mint(1));
  ans *= zero;
  ans += cnt00 + cnt01 + cnt10;
  cout << ans.x - 1 << endl;
  return 0;
}
