#include <bits/stdc++.h>
using namespace std;
class mll {
  unsigned long long val = 0;

 public:
  mll(long long y = 0) : val(((y % 1000000007) + 1000000007) % 1000000007) {}
  mll operator+(const mll& y) { return mll(*this) += y; }
  mll& operator+=(const mll& y) {
    val = (val + y.val) % 1000000007;
    return *this;
  }
  mll operator-(const mll& y) { return mll(*this) -= y; }
  mll& operator-=(const mll& y) {
    val = (val - y.val + 1000000007) % 1000000007;
    return *this;
  }
  mll operator*(const mll& y) { return mll(*this) *= y; }
  mll& operator*=(const mll& y) {
    val = (val * y.val) % 1000000007;
    return *this;
  }
  mll operator/(const mll& y) { return mll(*this) /= y; }
  mll& operator/=(const mll& y) {
    long long a = y.val, b = 1000000007, u = 1, v = 0;
    while (b) {
      long long t = a / b;
      a -= t * b;
      swap(a, b);
      u -= t * v;
      swap(u, v);
    }
    mll c = val * u;
    val = c.val;
    return *this;
  }
  bool operator>=(const mll& y) { return this->val >= y.val; }
  mll pow(long long t) const {
    if (!t) return 1;
    mll a = pow(t >> 1);
    a *= a;
    if (t & 1) a *= *this;
    return a;
  }
  unsigned long long getVal() { return val; }
  friend ostream& operator<<(ostream& os, mll& y) {
    os << y.val;
    return os;
  }
};
long long gcd(long long a, long long b) {
  return (a % b == 0 ? b : gcd(b, a % b));
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  int N;
  cin >> N;
  map<pair<long long, long long>, pair<int, int> > V;
  int zeros = 0;
  for (int i = 0; i < N; i++) {
    long long A, B;
    cin >> A >> B;
    if (A == 0 && B == 0) {
      zeros++;
      continue;
    }
    long long g = gcd(A, B);
    A /= g;
    B /= g;
    if (A < 0) A *= -1, B *= -1;
    if (A == 0 && B < 0) B *= -1;
    if (B <= 0) {
      V[{-B, A}].second++;
    } else {
      V[{A, B}].first++;
    }
  }
  mll prd = mll(1);
  for (auto it = V.begin(); it != V.end(); it++) {
    mll sum = (mll(2).pow(it->second.second) - mll(1)) + mll(1) +
              (mll(2).pow(it->second.first) - mll(1));
    prd *= sum;
  }
  prd += mll(zeros) - mll(1);
  cout << prd.getVal() << endl;
  return (0);
}
