#include <bits/stdc++.h>
using namespace std;
constexpr long long mod = 1000000007;
map<pair<long long, long long>, long long> mp;
long long pw(long long a, long long x) {
  long long ret = 1;
  while (x) {
    if (x & 1) (ret *= a) %= mod;
    (a *= a) %= mod;
    x /= 2;
  }
  return ret;
}
long long gcd(long long a, long long b) {
  if (a < 0) a *= -1;
  if (b < 0) b *= -1;
  if (a < b) swap(a, b);
  if (b == 0) return a;
  return gcd(a % b, b);
}
int main() {
  int i, n, cnt = 0;
  cin >> n;
  for (i = 0; i < n; i++) {
    long long a, b;
    cin >> a >> b;
    if (a == 0 && b == 0) {
      cnt++;
    } else {
      long long x = gcd(a, b);
      a /= x;
      b /= x;
      if (a < 0) {
        a *= -1;
        b *= -1;
      }
      if (a == 0) {
        if (b < 0) b *= -1;
      }
      mp[{a, b}]++;
    }
  }
  long long ans = 1;
  for (auto p : mp) {
    auto pp = p.first;
    long long a = pp.first, b = pp.second;
    long long aa = -b, bb = a;
    if (aa < 0) {
      aa *= -1;
      bb *= -1;
    }
    if (aa == 0) {
      if (bb < 0) bb *= -1;
    }
    if (mp.find({aa, bb}) != mp.end()) {
      long long s = mp[{aa, bb}], t = p.second;
      (ans *= (pw(2, s) + pw(2, t) - 1)) %= mod;
      mp.erase({aa, bb});
    } else {
      (ans *= pw(2, p.second)) %= mod;
    }
  }
  ans += cnt;
  cout << ans - 1 << endl;
}
