#include <bits/stdc++.h>
using namespace std;
int64_t gcd(int64_t a, int64_t b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
const int64_t MOD = 1e9l + 7;
int64_t Power(int64_t base, int64_t e) {
  if (e == 0) return 1;
  int64_t ans = base;
  e--;
  while (e) {
    if (e & 1) ans = (((ans % MOD) * (base % MOD)) % MOD + MOD) % MOD;
    base = (((base % MOD) * (base % MOD)) % MOD + MOD) % MOD;
    e >>= 1;
  }
  return (ans + MOD) % MOD;
}
int main() {
  int64_t n;
  cin >> n;
  int64_t aa, bb;
  map<pair<int64_t, int64_t>, pair<int64_t, int64_t>> mp;
  for (int64_t i = 0; i < n; i++) {
    cin >> aa >> bb;
    if (aa == 0 && bb == 0)
      ;
    else if (aa == 0)
      mp[{1, 0}].first++;
    else if (bb == 0)
      mp[{1, 0}].second++;
    else if ((aa < 0) && (bb < 0)) {
      int64_t h1 = abs(bb);
      int64_t h2 = abs(aa);
      int64_t h3 = gcd(h1, h2);
      h1 = h1 / h3;
      h2 = h2 / h3;
      mp[{h2, h1}].first++;
    } else if ((aa < 0) || (bb < 0)) {
      int64_t h1 = abs(bb);
      int64_t h2 = abs(aa);
      int64_t h3 = gcd(h1, h2);
      h1 = h1 / h3;
      h2 = h2 / h3;
      mp[{h1, h2}].second++;
    } else {
      int64_t h1 = abs(bb);
      int64_t h2 = abs(aa);
      int64_t h3 = gcd(h1, h2);
      h1 = h1 / h3;
      h2 = h2 / h3;
      mp[{h2, h1}].first++;
    }
  }
  int64_t aans = 1;
  for (auto pp : mp) {
    auto t = pp.second;
    aans =
        (aans * (Power(2, t.first) + Power(2, t.second) - 1 + MOD) % MOD) % MOD;
  }
  aans = (aans - 1) % MOD;
  cout << aans << endl;
}
