#include <bits/stdc++.h>
using namespace std;
using ll = long long;
constexpr ll mod = 1000000007;
constexpr ll mod998 = 998244353;
int N;
ll A[200000], B[200000], res;
map<pair<ll, ll>, ll> mp;
ll pw(ll x, ll y) {
  ll a = 1;
  while (y) {
    if (y & 1) {
      a = a * x % mod;
    }
    x = x * x % mod;
    y /= 2;
  }
  return a;
}
ll gcd(ll x, ll y) {
  if (y)
    return gcd(y, x % y);
  else
    return x;
}
int main() {
  cin >> N;
  for (int i = 0; i < N; i++) {
    cin >> A[i] >> B[i];
    if (A[i] < 0) {
      A[i] = -A[i];
      B[i] = -B[i];
    }
    if (A[i] == 0 && B[i] == 0)
      res++;
    else {
      ll g = gcd(A[i], abs(B[i]));
      A[i] /= g;
      B[i] /= g;
      mp[{A[i], B[i]}]++;
    }
  }
  ll c = 1;
  for (int i = 0; i < N; i++) {
    if (B[i] >= 0) {
      c *= pw(2, mp[{A[i], B[i]}]) + pw(2, mp[{B[i], -A[i]}]) - 1;
      c %= mod;
      mp[{A[i], B[i]}] = mp[{B[i], -A[i]}] = 0;
    } else {
      c *= pw(2, mp[{A[i], B[i]}]) + pw(2, mp[{-B[i], A[i]}]) - 1;
      c %= mod;
      mp[{A[i], B[i]}] = mp[{-B[i], A[i]}] = 0;
    }
  }
  c += mod - 1;
  res += c;
  res %= mod;
  cout << res << endl;
}
