#include <bits/stdc++.h>
using namespace std;
using ll = long long;
template <class T>
bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
bool chmin(T &a, const T &b) {
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}
inline void Yes(bool condition) {
  if (condition)
    cout << "Yes"
         << "\n";
  else
    cout << "No"
         << "\n";
}
template <class itr>
void cins(itr first, itr last) {
  for (auto i = first; i != last; i++) {
    cin >> (*i);
  }
}
template <class itr>
void array_output(itr start, itr goal) {
  string ans = "", k = " ";
  for (auto i = start; i != goal; i++) ans += to_string(*i) + k;
  if (!ans.empty()) ans.pop_back();
  cout << ans << "\n";
}
ll gcd(ll a, ll b) { return a ? gcd(b % a, a) : b; }
const ll INF = 1e15;
const ll MOD = 1000000007;
const ll MOD2 = 998244353;
const ll MAX = 200010;
constexpr ll nx[8] = {1, 0, -1, 0, -1, -1, 1, 1};
constexpr ll ny[8] = {0, 1, 0, -1, -1, 1, -1, 1};
ll RepeatSquaring(ll N, ll pair<ll, ll>, ll M) {
  if (pair<ll, ll> == 0) return 1;
  if (pair<ll, ll> % 2 == 0) {
    ll t = RepeatSquaring(N, pair<ll, ll> / 2, M);
    return t * t % M;
  }
  return N * RepeatSquaring(N, pair<ll, ll> - 1, M) % M;
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll n;
  cin >> n;
  vector<pair<ll, ll> > p, m;
  ll azero = 0, bzero = 0, a, b, p1 = 0, m1 = 0;
  for (ll i = ll(0); i < ll(n); ++i) {
    cin >> a >> b;
    if (a == 0 && b == 0)
      continue;
    else if (a == 0) {
      azero++;
    } else if (b == 0) {
      bzero++;
    } else if (a == b) {
      p1++;
    } else if (a == -b) {
      m1++;
    } else if ((a > 0 && b > 0) || (a < 0 && b < 0)) {
      p.push_back(pair<ll, ll>(abs(a), abs(b)));
    } else {
      m.push_back(pair<ll, ll>(abs(a), abs(b)));
    }
  }
  map<pair<ll, ll>, ll> pu, pd, mu, md;
  vector<pair<ll, ll> > num;
  for (pair<ll, ll> q : p) {
    tie(a, b) = q;
    ll k = gcd(a, b);
    a /= k;
    b /= k;
    if (a > b) {
      num.push_back(pair<ll, ll>(a, b));
      pu[pair<ll, ll>(a, b)]++;
    } else if (a < b) {
      num.push_back(pair<ll, ll>(b, a));
      pd[pair<ll, ll>(b, a)]++;
    }
  }
  for (pair<ll, ll> q : m) {
    tie(a, b) = q;
    ll k = gcd(a, b);
    a /= k;
    b /= k;
    if (a > b) {
      num.push_back(pair<ll, ll>(a, b));
      mu[pair<ll, ll>(a, b)]++;
    } else if (a < b) {
      num.push_back(pair<ll, ll>(b, a));
      md[pair<ll, ll>(b, a)]++;
    }
  }
  sort((num).begin(), (num).end());
  num.erase(unique((num).begin(), (num).end()), num.end());
  ll ans =
      (RepeatSquaring(2, p1, MOD) + RepeatSquaring(2, m1, MOD) + MOD - 1) % MOD;
  for (pair<ll, ll> v : num) {
    ans *= (RepeatSquaring(2, pu[v], MOD) + RepeatSquaring(2, md[v], MOD) - 1) %
           MOD;
    ans %= MOD;
    ans *= (RepeatSquaring(2, pd[v], MOD) + RepeatSquaring(2, mu[v], MOD) - 1) %
           MOD;
    ans %= MOD;
  }
  ans *= (RepeatSquaring(2, azero, MOD) + RepeatSquaring(2, bzero, MOD) + MOD -
          1) %
         MOD;
  cout << (ans + MOD - 1) % MOD << "\n";
}
