#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using pll = pair<ll, ll>;
using vl = vector<ll>;
using vll = vector<vl>;
using vpll = vector<pll>;
const ld PI = 3.1415926535897932;
void in() {}
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head h, Tail... t) {
  cerr << " " << h;
  if (sizeof...(t) > 0) cerr << " :";
  debug_out(t...);
}
template <typename T>
ostream& operator<<(ostream& os, vector<T> vec) {
  for (size_t i = 0; i < vec.size(); i++)
    os << vec[i] << (i + 1 == vec.size() ? "" : " ");
  return os;
}
ll ctoi(char c) {
  switch (c) {
    case '0':
      return 0;
    case '1':
      return 1;
    case '2':
      return 2;
    case '3':
      return 3;
    case '4':
      return 4;
    case '5':
      return 5;
    case '6':
      return 6;
    case '7':
      return 7;
    case '8':
      return 8;
    case '9':
      return 9;
    default:
      return 0;
  }
}
bool pairCompare(const pll firstElof, pll secondElof) {
  return firstElof.first > secondElof.first;
}
ll i, j, k, l;
ll N, M, K, H, W, L, X, Y, Z, R, Q;
ll MOD = 1000000007;
ll INF = 1LL << 60;
ll ans = 0;
ll z = 0, o = 1;
vl flag, D;
vll path;
vl Ans;
ll gcd(ll x, ll y) {
  ll r;
  if (x < y) {
    swap(x, y);
  }
  while (y > 0) {
    r = x % y;
    x = y;
    y = r;
  }
  return x;
}
ll lcm(ll x, ll y) { return x * y / gcd(x, y); }
ll Npow(ll x, ll n) {
  if (n == 0) return 1;
  if (n % 2 == 0)
    return Npow(x * x % MOD, n / 2);
  else
    return x * Npow(x, n - 1) % MOD;
}
int main() {
  cin >> N;
  vl A(N), B(N);
  vpll G(N);
  map<pll, ll> M;
  ll pre2 = N;
  ll zz = 0;
  for (i = 0; i < N; i++) {
    cin >> A[i] >> B[i];
    if (A[i] == 0 && B[i] == 0) {
      zz++;
    } else {
      if (B[i] == 0) {
        G[i] = make_pair(1, 0);
      } else if (B[i] > 0) {
        ll D = gcd(abs(A[i]), abs(B[i]));
        G[i] = make_pair(A[i] / D, B[i] / D);
      } else {
        ll D = gcd(abs(A[i]), abs(B[i]));
        G[i] = make_pair(-A[i] / D, -B[i] / D);
      }
      M[G[i]]++;
    }
  }
  ans = 1;
  for (auto x : M) {
    ll a = x.second;
    ll b = M[make_pair(-x.first.second, x.first.first)];
    if (a > 0 && b > 0) {
      ll pre = (((Npow(2, a) - 1) + (Npow(2, b) - 1) + 1) % MOD + MOD) % MOD;
      (ans *= pre) %= MOD;
      pre2 -= a + b;
    }
  }
  pre2 -= zz;
  (ans *= Npow(2, pre2)) %= MOD;
  ans--;
  if (zz > 0) {
    ans += zz;
  }
  cout << ans;
}
