#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) {
  if (a < b) return gcd(b, a);
  long long r = a % b;
  while (r != 0) {
    a = b;
    b = r;
    r = a % b;
  }
  return b;
}
long long lcm(long long a, long long b) {
  long long ret = a / gcd(a, b) * b;
  return ret;
}
long long mod_pow(long long a, long long n, long long mod) {
  long long ret = 1;
  while (n > 0) {
    if (n & 1) ret = (ret * (a % mod)) % mod;
    a = ((a % mod) * (a % mod)) % mod;
    n = n >> 1;
  }
  return ret;
}
const long long mod = 1000000007;
int main() {
  long long n;
  cin >> n;
  vector<long long> a, b;
  long long ans = 0;
  for (long long i = (0); i < (long long)(n); i++) {
    long long u, v;
    cin >> u >> v;
    if (u == 0 && v == 0)
      ans++;
    else {
      a.push_back(u);
      b.push_back(v);
    }
  }
  map<pair<long long, long long>, pair<long long, long long>> mp;
  long long m = a.size();
  for (long long i = (0); i < (long long)(m); i++) {
    if (a[i] == 0) {
      mp[{1, 0}].second++;
    } else if (b[i] == 0) {
      mp[{1, 0}].first++;
    } else if (a[i] * b[i] > 0) {
      long long pa = abs(a[i]);
      long long pb = abs(b[i]);
      long long g = gcd(pa, pb);
      mp[{pa / g, pb / g}].first++;
    } else if (a[i] * b[i] < 0) {
      long long pa = abs(a[i]);
      long long pb = abs(b[i]);
      long long g = gcd(pa, pb);
      mp[{pb / g, pa / g}].second++;
    }
  }
  long long comb = 1;
  for (auto p : mp) {
    long long fac =
        mod_pow(2, p.second.first, mod) + mod_pow(2, p.second.second, mod) - 1;
    fac %= mod;
    comb *= fac;
    comb %= mod;
  }
  cerr << comb << endl;
  ans += comb - 1 + mod;
  cout << ans % mod << endl;
  return 0;
}
