#include<bits/stdc++.h>
using namespace std;
using LL = long long;
const LL M = 1e9+7;

LL power(LL m, LL n) {
  if(!n) return 1;
  return (n & 1) ? (power(m, n - 1) * m % M) : power(m * m % M, n >> 1);
}

int main() {
  struct Fish {
    int a, b;
    Fish(int x, int y) : a(x/gcd(x,y)), b(y/gcd(x,y)) {
      if(b<0) a=-a, b=-b;
    }
    bool operator<(const Fish& f) const {return a!=f.a ? a<f.a : b<f.b;}
  };

  int N;
  vector<Fish> fish;
  cin >> N;
  for(auto i=0; i<N; ++i) {
    int x, y;
    cin >> x >> y;
    fish.emplace_back(x, y);
  }

  map<Fish, LL> h;
  for(auto& f: fish) ++h[f];

  LL ans = 1;
  set<Fish> used;
  for(auto p: h) {
    auto f=p.first; auto v=p.second;
    if(used.count(f)) continue;
    Fish n{-f.b, f.a};
    used.emplace(n);
    if(h.count(n)) (ans *= (power(2,h[f]) + power(2,h[n]) - 1)) %= M;
    else           (ans *= power(2,h[f])) %= M;
  }
  cout << ans - 1 << endl;
}
