#include <bits/stdc++.h>
template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
using ll = long long;
using ld = long double;
const ll INF = 1LL << 60;
const ll mod = 1e9 + 7;
using namespace std;
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
const ll MAX = 100005;
ll fac[MAX], finv[MAX], inv[MAX];
void COMinit() {
  fac[0] = fac[1] = 1;
  finv[0] = finv[1] = 1;
  inv[1] = 1;
  for (int i = 2; i < MAX; i++) {
    fac[i] = fac[i - 1] * i % mod;
    inv[i] = mod - inv[mod % i] * (mod / i) % mod;
    finv[i] = finv[i - 1] * inv[i] % mod;
  }
}
long long COM(int n, int k) {
  if (n < k) return 0;
  if (n < 0 || k < 0) return 0;
  return fac[n] * (finv[k] * finv[n - k] % mod) % mod;
}
long long modpow(ll a, ll b) {
  ll res = 1;
  while (b) {
    if (b & 1) res = res * a % mod;
    a = a * a % mod;
    b >>= 1;
  }
  return res;
}
map<tuple<ll, ll, ll>, ll> p, q;
vector<pair<ll, ll>> r;
int main() {
  COMinit();
  ll n, m = 0, x, y, ans = 0, hateiwashi = 0;
  cin >> n;
  ll pm;
  for (ll i = ll(0); i < ll(n); i++) {
    pm = 0;
    cin >> x >> y;
    if ((y < 0 && x >= 0) || (y >= 0 && x < 0)) {
      y = labs(y);
      x = labs(x);
      pm = 1;
    }
    if (x == 0 && y == 0)
      m++;
    else if (y == 0)
      p[{1, 0, 0}]++;
    else {
      p[{x / gcd(x, y), y / gcd(x, y), pm}]++;
      q[{x / gcd(x, y), y / gcd(x, y), pm}] = 1;
    }
  }
  if (m > 0) {
    hateiwashi += m;
  }
  for (map<tuple<ll, ll, ll>, ll>::iterator it = p.begin(); it != p.end();
       it++) {
    tuple<ll, ll, ll> f = it->first;
    ll g = it->second;
    ll s1 = get<0>(f), s2 = get<1>(f), s3 = get<2>(f);
    ll g2 = p[{s2, s1, pm}];
    ll pm2;
    if (s3 == 0)
      pm2 = 1;
    else
      pm2 = 0;
    if (q[f] && q[{s2, s1, pm2}] && g > 0 && g2 > 0) {
      cout << s1 << " " << s2 << " " << s3 << " " << g << " " << g2 << endl;
      hateiwashi += g + g2;
      r.push_back({g, g2});
      q[f] = 0, q[{s2, s1, pm2}] = 0;
    }
  }
  ll fans = modpow(2, n - hateiwashi) - 1;
  ans = fans;
  for (ll mask = 0; mask < powl(3, r.size()); mask++) {
    ll tmp = 0;
    for (ll i = ll(0); i < ll(r.size()); i++) {
      ll p3 = powl(3, i + 1);
      if (mask % p3 == 0)
        tmp += r[i].first;
      else if (mask % p3 == 1)
        tmp += r[i].second;
    }
    ans = (ans + (fans + 1) * (modpow(2, tmp) - 1)) % mod;
  }
  cout << (ans + mod) % mod;
}
