#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;
typedef pair<ll, ll> P;
const int INF = 1001001001;
const int MOD = 1000000007;

ll beki(ll a, ll b) {
  if (b == 0) return 1;
  ll ret = beki(a, b / 2);
  ret = ret * ret % MOD;
  if (b & 1) ret = ret * a % MOD;
  return ret;
}

int main() {
  ll N;
  cin >> N;
  map<P, ll> mp;
  ll abzero = 0;
  rep(i, N) {
    ll a, b;
    cin >> a >> b;
    if (a == 0 && b == 0) {
      abzero++;
      continue;
    }
    ll g = gcd(a, b);
    mp[make_pair(a / g, b / g)]++;
  }
  ll ans = 1;
  set<P> visited;
  for (const auto& k : mp) {
    if (visited.count(k)) continue;
    int nl = 0, nr = 0;
    P l1 = k;
    P l2 = make_pair(-k.first, -k.second);
    P r1 = make_pair(k.second, -k.first);
    P r2 = make_pair(-k.second, k.first);
    visited.insert(l1);
    visited.insert(l2);
    visited.insert(r1);
    visited.insert(r2);
    nl = mp[l1] + mp[l2];
    nr = mp[r1] + mp[r2];
    ans = (ans * (beki(2, nl) + beki(2, nr) - 1)) % MOD;
  }
  ans = (ans + abzero - 1) % MOD;
  cout << ans << endl;

  return 0;
}