#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;
    }
    if (b < 0) {
      b = -b;
      a = -a;
    } else if (b == 0) {
      mp[make_pair(1, 0)]++;
      continue;
    }
    ll g = gcd(a, b);
    mp[make_pair(a / g, b / g)]++;
  }
  ll ans = 1;
  for (const auto& [k, v] : mp) {
    ll tmp = 1;
    P chokkou;
    if (k.first > 0) {
      chokkou = make_pair(-k.second, k.first);
    } else {
      chokkou = make_pair(k.second, -k.first);
    }
    tmp = (tmp + beki(2, v) - 1) % MOD;
    tmp = (tmp + beki(2, mp[chokkou]) - 1) % MOD;
    mp[k] = 0;
    mp[chokkou] = 0;
    ans = (ans * tmp) % MOD;
  }
  ans = (ans + abzero - 1) % MOD;
  cout << ans << endl;

  return 0;
}