#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using uint = unsigned int;
using ldouble = long double;
template <typename T>
constexpr T gcd(T a, T b) {
  if (a % b == 0) {
    return (b);
  } else {
    return (gcd(b, a % b));
  }
}
long long mod(long long a, long long b) {
  return a - (long long)std::floor((double)a / (double)b) * b;
}
long long modpow(long long a, long long n, long long mod) {
  long long res = 1;
  while (n > 0) {
    if (n & 1) res = res * a % mod;
    a = a * a % mod;
    n >>= 1;
  }
  return res;
}
bool zero;
unordered_map<ll, unordered_map<ll, int>> mp;
int main() {
  int N;
  zero = false;
  int zerox = 0;
  int zeroy = 0;
  cin >> N;
  for (ll i = 0; i < (N); ++i) {
    ll a, b;
    cin >> a >> b;
    if (a == 0 && b == 0) {
      if (!zero) zero = true;
      continue;
    } else if (a == 0) {
      zerox++;
      continue;
    } else if (b == 0) {
      zeroy++;
      continue;
    }
    if (b < 0) {
      a = -a;
      b = -b;
    }
    ll g = gcd(a, b);
    a /= g;
    b /= g;
    if (mp.count(a) == 0) {
      mp.insert(pair<ll, unordered_map<ll, int>>(a, unordered_map<ll, int>()));
    }
    if (mp[a].count(b) == 0) {
      mp[a].insert(pair<ll, int>(b, 0));
    }
    mp[a][b]++;
  }
  ll res = 1;
  ll MOD = 1000000007;
  if (zero) res *= 2;
  if (zerox > 0) {
    if (zeroy > 0) {
      res *= (modpow(2, zerox, MOD) + modpow(2, zeroy, MOD));
    } else {
      res *= modpow(2, zerox, MOD);
    }
    res %= MOD;
  } else if (zeroy > 0) {
    res *= modpow(2, zeroy, MOD);
    res %= MOD;
  }
  for (auto itr = mp.begin(); itr != mp.end(); ++itr) {
    for (auto itr2 = itr->second.begin(); itr2 != itr->second.end(); ++itr2) {
      if (itr2->second == -1) continue;
      if ((mp.count(itr2->first) != 0 &&
           mp[itr2->first].count(-itr->first) != 0) ||
          (mp.count(-itr2->first) != 0 &&
           mp[-itr2->first].count(itr->first) != 0)) {
        res *= (modpow(2, itr2->second, MOD) +
                modpow(2, mp[-itr2->first][itr->first], MOD));
        mp[-itr2->first][itr->first] = -1;
      } else {
        res *= modpow(2, itr2->second, MOD);
      }
      res %= MOD;
    }
  }
  res = mod(res - 1, MOD);
  cout << res << endl;
  return 0;
}
