#include <bits/stdc++.h>
using namespace std;
void dout() { cerr << endl; }
template <typename Head, typename... Tail>
void dout(Head H, Tail... T) {
  cerr << H << ' ';
  dout(T...);
}
using long long = long long;
using pii = pair<long long, long long>;
using ld = long double;
using pll = pair<long long, long long>;
template <typename T>
void do_uniq(vector<T> vec) {
  sort((vec).begin(), (vec).end());
  vec.resize(unique((vec).begin(), (vec).end()) - vec.begin());
}
const int MAXN = 1e5 + 20;
long long mod = 1e9 + 7;
long long gcd(long long x, long long y) { return y == 0 ? x : gcd(y, x % y); }
long long add(long long a, long long b) { return (a + b) % mod; }
long long ml(long long a, long long b) { return (a * b) % mod; }
long long bin_p(long long b, long long p) {
  if (p == 0) return 1;
  if (p % 2 == 1) return ml(b, bin_p(b, p - 1));
  long long v = bin_p(b, p >> 1);
  return ml(v, v);
}
void solve() {
  int n;
  cin >> n;
  map<pair<long long, long long>, long long> mp1;
  long long cnt0 = 0;
  for (int i = 0; i < n; ++i) {
    long long a, b;
    cin >> a >> b;
    if (a < 0) {
      a *= -1;
      b *= -1;
    }
    if (abs(a) == 0) {
      if (b != 0)
        b = 1;
      else {
        ++cnt0;
        continue;
      }
    } else if (abs(b) == 0) {
      a = 1;
    } else {
      long long g = gcd(abs(a), abs(b));
      a /= g;
      b /= g;
    }
    mp1[{a, b}]++;
  }
  long long answr = 1;
  while (!mp1.empty()) {
    auto e = mp1.begin();
    long long x = e->first.first;
    long long y = e->first.second;
    long long cnt = e->second;
    long long cnt1 = mp1[{-y, x}] + mp1[{y, -x}];
    mp1.erase({x, y});
    mp1.erase({-y, x});
    mp1.erase({y, -x});
    if (cnt1 != 0) {
      long long curr = add(bin_p(2, cnt), bin_p(2, cnt1));
      answr *= (mod + curr - 1) % mod;
      answr %= mod;
    } else {
      answr *= bin_p(2, cnt);
      answr %= mod;
    }
  }
  answr *= cnt0 + 1;
  answr %= mod;
  if (answr != 1) {
    answr = mod + answr - 1;
    answr %= mod;
  }
  cout << answr;
}
void multisolve() {
  int t;
  cin >> t;
  int i = 1;
  while (t--) {
    solve();
    cout << "\n";
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr), cout.tie(nullptr);
  cout << fixed << setprecision(20);
  solve();
}
