#include <bits/stdc++.h>
using ll = long long;
using namespace std;
const int INF = 1001001001;
const int mod = 1000000007;
struct mint {
  ll x;
  mint(ll x = 0) : x((x % mod + mod) % mod){};
  mint pow(ll y) const {
    mint res(1);
    mint a(x);
    while (y > 0) {
      if (y & 1) res *= a;
      a *= a;
      y >>= 1;
    }
    return res;
  }
  mint inv() const { return pow(mod - 2); }
  mint& operator+=(const mint a) noexcept {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) noexcept {
    if ((x += mod - a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) noexcept {
    (x *= a.x) %= mod;
    return *this;
  }
  mint& operator/=(const mint a) noexcept { return (*this) *= a.inv(); }
  mint operator+(const mint a) const noexcept {
    mint res(*this);
    return res += a;
  }
  mint operator-(const mint a) const noexcept {
    mint res(*this);
    return res -= a;
  }
  mint operator*(const mint a) const noexcept {
    mint res(*this);
    return res *= a;
  }
  mint operator/(const mint a) const noexcept {
    mint res(*this);
    return res /= a;
  }
};
ostream& operator<<(ostream& stream, const mint& n) {
  stream << n.x;
  return stream;
};
struct comb {
  vector<mint> fact, ifact;
  comb(int n) : fact(n + 1), ifact(n + 1) {
    fact[0] = 1;
    for (int i = 1; i <= n; i++) fact[i] = fact[i - 1] * i;
    ifact[n] = fact[n].inv();
    for (int i = n; i >= 1; i--) ifact[i - 1] = ifact[i] * i;
  }
  mint operator()(int n, int k) const noexcept {
    if (k < 0 || n < k) return 0;
    return fact[n] * ifact[k] * ifact[n - k];
  }
};
using P = pair<ll, ll>;
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
int main(void) {
  ll n;
  cin >> n;
  ll zero = 0;
  map<P, P> mp;
  for (ll i = (0); i < (n); i++) {
    ll a, b;
    cin >> a >> b;
    if (a == 0 && b == 0) {
      zero++;
      continue;
    }
    ll g = gcd(a, b);
    a /= g;
    b /= g;
    if (b < 0) {
      a = -a;
      b = -b;
    }
    if (b == 0 && a < 0) a = -a;
    bool rot = (a <= 0);
    if (rot) {
      double tmp = a;
      a = b;
      b = -tmp;
    }
    if (rot)
      mp[{a, b}].first++;
    else
      mp[{a, b}].second++;
  }
  mint ans = 1;
  for (auto p : mp) {
    ll s = p.second.first;
    ll t = p.second.second;
    mint now = 1;
    now += mint(2).pow(s) - 1;
    now += mint(2).pow(t) - 1;
    ans *= now;
  }
  ans -= 1;
  ans += zero;
  cout << ans << endl;
  return 0;
}
