#include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007;
class Mint {
 public:
  Mint(long long x = 0, int m = MOD) : val((x % m + m) % m), mod(m) {}
  long long value() const { return val; }
  Mint& operator+=(const Mint a) {
    if ((val += a.val) >= mod) val -= mod;
    return *this;
  }
  Mint& operator-=(const Mint a) {
    if ((val += mod - a.val) >= mod) val -= mod;
    return *this;
  }
  Mint& operator*=(const Mint a) {
    (val *= a.val) %= 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;
  }

 private:
  long long val;
  int mod;
};
template <typename T>
T gcd(T a, T b) {
  if (b < a) {
    T tmp = b;
    b = a;
    a = tmp;
  }
  T r = b % a;
  while (r) {
    b = a;
    a = r;
    r = b % a;
  }
  return a;
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(0);
  int N;
  map<pair<long long, long long>, int> hist;
  set<pair<long long, long long>> var;
  cin >> N;
  for (int i = 0; i < (N); ++i) {
    long long A, B;
    cin >> A >> B;
    if (A == 0) {
      if (B != 0) {
        B = 1;
      }
    } else if (B == 0) {
      A = 1;
    } else {
      if (A < 0) {
        A = -A;
        B = -B;
      }
      long long g = gcd(A, abs(B));
      A /= g;
      B /= g;
    }
    pair<long long, long long> p = make_pair(A, B);
    if (0 < A && B != 0) {
      var.insert(p);
    }
    ++hist[p];
  }
  N -= hist[{0, 0}];
  Mint ans(1);
  while (!var.empty()) {
    pair<long long, long long> v = *(var.begin());
    pair<long long, long long> p;
    if (v.first == 0) {
      p = {1, 0};
    } else if (v.second == 0) {
      p = {0, 1};
    } else {
      if (v.second < 0) {
        p = {-v.second, v.first};
      } else {
        p = {v.second, -v.first};
      }
    }
    var.erase(v);
    if (0 < hist[p]) {
      var.erase(p);
      Mint tmp1 = (Mint(2).pow(hist[v]) - 1);
      Mint tmp2 = (Mint(2).pow(hist[p]) - 1);
      Mint tmp3 = 1;
      ans *= (tmp1 + tmp2 + tmp3);
    } else {
      Mint tmp(2);
      ans *= tmp.pow(hist[v]);
    }
  }
  ans -= 1;
  cout << ans.value() << endl;
  return 0;
}
