#include <bits/stdc++.h>
using namespace std;
const int mod = 1000000007;
struct mint {
  long long x;
  mint(long long x = 0) : x((x % mod + mod) % mod) {}
  mint operator-() const { return mint(-x); }
  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 { 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(mod - 2); }
  mint& operator/=(const mint a) { return *this *= a.inv(); }
  mint operator/(const mint a) const { return mint(*this) /= a; }
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x; }
ostream& operator<<(ostream& os, const mint& a) { return os << a.x; }
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; }
int main() {
  long long n;
  cin >> n;
  map<pair<long long, long long>, long long> mp;
  for (long long i = 0; i < n; ++i) {
    long long a1, b1;
    cin >> a1 >> b1;
    if (a1 < 0) {
      a1 = -a1;
      b1 = -b1;
    }
    if (a1 == 0 and b1 == 0) {
      mp[make_pair(0, 0)] += 1;
    } else if (a1 != 0 and b1 == 0) {
      mp[make_pair(1, 0)] += 1;
    } else if (a1 == 0 and b1 != 0) {
      mp[make_pair(0, 1)] += 1;
    } else {
      long long g1 = gcd(a1, b1);
      mp[make_pair(a1 / g1, b1 / g1)] += 1;
    }
  }
  mint ans = 1;
  long long temp = mp[make_pair(0, 0)];
  long long nnew = n - temp;
  mp[make_pair(0, 0)] = 0;
  for (auto i = mp.begin(); i != mp.end(); i++) {
    pair<long long, long long> now = i->first;
    long long now1 = now.first;
    long long now2 = now.second;
    long long new1, new2;
    long long count = i->second;
    if (now2 < 0) {
      new1 = -now2;
      new2 = now1;
    }
    if (now2 >= 0) {
      new1 = now2;
      new2 = -now1;
    }
    long long cntnew = mp[make_pair(new1, new2)];
    if (cntnew == 0) continue;
    mint a1 = mint(2).pow(count);
    mint a2 = mint(2).pow(cntnew);
    a1 += a2;
    a1 -= 1;
    ans *= a1;
    nnew -= (count + cntnew);
  }
  mint a3 = mint(2).pow(nnew);
  ans *= a3;
  ans -= 1;
  ans += temp;
  cout << ans;
}
