#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pll = pair<ll, ll>;
long long modpow(long long a, long long n, long long mod) {
  long long res = 1;
  while (n > 0) {
    if (n & 1) res = res * a % mod;
    a = a * a % mod;
    n >>= 1;
  }
  return res;
}
ll gcd(ll a, ll b) {
  if (a % b == 0) return (b);
  return (gcd(b, a % b));
}
int main() {
  ll mod = 1e9 + 7;
  int n;
  cin >> n;
  vector<pll> vec(n);
  ll a, b;
  map<pair<ll, ll>, ll> mp, mp2;
  map<pair<ll, ll>, int> mp3;
  for (int(i) = (0); (i) < (n); (i)++) {
    cin >> a >> b;
    vec[i] = make_pair(a, b);
    ll A = a / gcd(a, b);
    ll B = b / gcd(a, b);
    if ((A <= 0 && B <= 0) || (A >= 0 && B <= 0)) {
      A *= -1;
      B *= -1;
    }
    mp[make_pair(A, B)]++;
  }
  ll ans = 1;
  ll tot = 0;
  for (auto e : mp) {
    pll a = e.first;
    ll x = e.second;
    if (a.first == 0 && a.first == 0) {
      ans = (ans + x) % mod;
      continue;
    }
    ll op = mp[make_pair(-1 * a.second, a.first)] +
            mp[make_pair(a.second, -1 * a.first)];
    if (x > 0) {
      ll subt = (((modpow(2, x, mod) - 1 + mod) % mod) +
                 ((modpow(2, op, mod) - 1 + mod)) % mod) %
                mod;
      mp[a] = 0;
      mp[make_pair(-1 * a.second, a.first)] = 0;
      mp[make_pair(a.second, -1 * a.first)] = 0;
      subt = (subt + mod) % mod;
      subt = (subt + 1) % mod;
      ans = (ans * subt) % mod;
    }
  }
  ans = (ans - 1 + mod) % mod;
  cout << ans << endl;
  return 0;
}
