#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
const ll mod = 1000000007;
ll f[2200000];
ll invf[2200000];
ll modpow(ll a, ll n, ll mod) {
  ll res = 1;
  while (n > 0) {
    if (n & 1) res = res * a % mod;
    a = a * a % mod;
    n >>= 1;
  }
  return res;
}
ll nCm(ll n, ll m) { return ((f[n] * invf[m]) % mod) * invf[n - m] % mod; }
long long gcd(long long x, long long y) {
  if (x % y == 0) return y;
  return gcd(y % x, x);
}
map<P, long long> mp1, mp2;
long long non;
signed main() {
  long long n;
  cin >> n;
  for (long long i = 0; i < (n); i++) {
    long long a, b;
    cin >> a >> b;
    if (a == 0 && b == 0)
      non++;
    else if (a == 0) {
      mp1[P(0, 1)]++;
      mp2[P(-1, 0)]++;
    } else if (b == 0) {
      mp1[P(1, 0)]++;
      mp2[P(0, -1)]++;
    } else if (a > 0 && b > 0) {
      long long hoge = gcd(a, b);
      mp1[P(a / hoge, b / hoge)]++;
      mp2[P(-b / hoge, a / hoge)]++;
    } else if (a > 0 && b < 0) {
      long long hoge = gcd(a, -b);
      mp1[P(-a / hoge, -b / hoge)]++;
      mp2[P(-b / hoge, a / hoge)]++;
    } else if (a < 0 && b > 0) {
      long long hoge = gcd(-a, b);
      mp1[P(a / hoge, b / hoge)]++;
      mp2[P(b / hoge, -a / hoge)]++;
    } else if (a < 0 && b < 0) {
      long long hoge = gcd(-a, -b);
      mp1[P(-a / hoge, -b / hoge)]++;
      mp2[P(b / hoge, -a / hoge)]++;
    }
  }
  long long ans = 1;
  for (auto tmp : mp1) {
    auto pr = tmp.first;
    auto p = tmp.second;
    auto q = mp2[pr];
    long long res = modpow(2ll, p, mod) + modpow(2ll, q, mod) - 1;
    long long a = pr.first, b = pr.second;
    if (a > 0 && b > 0) {
      mp2[P(-b, a)] = 0;
      mp1[P(-b, a)] = 0;
    } else if (a < 0 && b > 0) {
      mp2[P(b, -a)] = 0;
      mp1[P(b, -a)] = 0;
    }
    ans *= res;
    ans = (ans % mod + mod) % mod;
  }
  ans -= 1;
  ans += non;
  cout << (ans % mod + mod) % mod << endl;
  return 0;
}
