#include <bits/stdc++.h>
using namespace std;
const int N = 2 * 1e5 + 5;
long long n, a[N], b[N];
long long mod = 1e9 + 7;
long long modpow(long long a, long long b) {
  a %= mod;
  long long res = 1;
  while (b) {
    if (b & 1) res = (res * a) % mod;
    a = (a * a) % mod;
    b >>= 1;
  }
  return res;
}
map<pair<long long, long long>, long long> mp;
long long arr[2];
set<pair<long long, long long> > s;
void f(pair<long long, long long> a) {
  if (mp.find(a) == mp.end())
    mp[a] = 1;
  else
    mp[a]++;
}
long long f2(pair<long long, long long> a) {
  if (mp.find(a) == mp.end()) return 0;
  return mp[a];
}
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
void f3(pair<long long, long long> a) {
  pair<long long, long long> tmp;
  if (a.first < 0)
    tmp = {a.second, -a.first};
  else {
    tmp = {-a.second, a.first};
  }
  if (s.find(tmp) != s.end()) return;
  s.insert(a);
}
void solve() {
  long long ans = 0;
  arr[0] = arr[1] = 0;
  for (int i = 1; i <= n; i++) {
    if (a[i] == 0 && b[i] == 0)
      f({0, 0});
    else if (a[i] == 0)
      arr[0]++;
    else if (b[i] == 0)
      arr[1]++;
    else {
      int sgn1 = 0, sgn2 = 0;
      sgn1 = (a[i] > 0 ? 1 : 0);
      sgn2 = (b[i] > 0 ? 1 : 0);
      a[i] = abs(a[i]);
      b[i] = abs(b[i]);
      long long gd = gcd(a[i], b[i]);
      a[i] /= gd, b[i] /= gd;
      if (sgn1 ^ sgn2) {
        f({-a[i], b[i]});
        f3({-a[i], b[i]});
      } else {
        f({a[i], b[i]});
        f3({a[i], b[i]});
      }
    }
  }
  ans = (modpow(2, arr[0]) + modpow(2, arr[1]) - 1ll + mod) % mod;
  for (pair<long long, long long> i : s) {
    if (i.first < 0) {
      ans = (ans *
             (modpow(2, f2(i)) + modpow(2, f2({i.second, -i.first})) - 1ll +
              mod) %
             mod) %
            mod;
    } else {
      ans = (ans *
             (modpow(2, f2(i)) + modpow(2, f2({-i.second, i.first})) - 1ll +
              mod) %
             mod) %
            mod;
    }
  }
  ans = (ans * (f2({0, 0}) + 1ll) % mod) % mod;
  ans = (ans - 1ll + mod) % mod;
  cout << ans << endl;
}
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> a[i] >> b[i];
  solve();
}
