#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
ll gcd(ll x, ll y) {
  if (y == 0) return x;
  return gcd(y, x % y);
}
ll mod_pow(ll n, ll p, ll m) {
  if (p == 0) return 1;
  if (p % 2 == 0) {
    ll t = mod_pow(n, p / 2, m);
    return (t * t) % m;
  }
  return n * mod_pow(n, p - 1, m) % m;
}
ll n;
ll a[200005], b[200005];
map<pair<ll, ll>, ll> mp;
int main() {
  cin >> n;
  for (int i = 0; i < (n); i++) cin >> a[i] >> b[i];
  ll zz = 0, sz = 0, zs = 0;
  for (int i = 0; i < (n); i++) {
    if (a[i] == 0 && b[i] == 0) {
      zz++;
    } else if (a[i] == 0) {
      zs++;
    } else if (b[i] == 0) {
      sz++;
    } else {
      ll x = gcd(a[i], b[i]);
      a[i] /= x, b[i] /= x;
      if (!((a[i] > 0 && b[i] > 0) || (a[i] < 0 && b[i] > 0))) {
        a[i] *= -1, b[i] *= -1;
      }
      mp[{a[i], b[i]}]++;
    }
  }
  ll ans = 1;
  for (auto now : mp) {
    ll x, y;
    if (now.first.first > 0 && now.first.second > 0) {
      x = now.second;
      y = mp[{now.first.second * -1, now.first.first}];
    } else {
      mp[{now.first.second, now.first.first * -1}] += 0;
      continue;
    }
    ans *= mod_pow(2, x, 1000000007) + mod_pow(2, y, 1000000007) - 1;
    ans %= 1000000007;
  }
  ans *= mod_pow(2, zs, 1000000007) + mod_pow(2, sz, 1000000007) - 1;
  ans %= 1000000007;
  ans += zz;
  ans %= 1000000007;
  cout << ans - 1 << endl;
  return 0;
}
