#include <bits/stdc++.h>
#pragma comment(linker, "/stack:512000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,tune=native")
#pragma GCC optimize("unroll-loops")
using namespace std;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
mt19937_64 gen(time(nullptr));
ll mod = 1e9 + 7;
namespace {
ll mul(ll a, ll b) {
  ll val = a * b - (ll)((ld)a * b / mod) * mod;
  if (val < 0) val += mod;
  if (val >= mod) val -= mod;
  return val;
}
ll poww(ll a, ll b) {
  ll val = 1;
  a %= mod;
  while (b > 0) {
    if (b % 2) val = mul(a, val);
    a = mul(a, a);
    b >>= 1;
  }
  return val % mod;
}
ll inv(ll a) { return poww(a, mod - 2); }
}  // namespace
ll const maxn = 3e5 + 5;
map<pair<ll, ll>, ll> cnt;
map<pair<ll, ll>, bool> used;
ll gcd(ll a, ll b) { return (a == 0 ? b : gcd(b % a, a)); }
pair<ll, ll> norm(pair<ll, ll> p) {
  if (p.first == 0) return {0, 1};
  if (p.second == 0) return {1, 0};
  ll znak = (((p.first < 0) ^ (p.second < 0)) ? -1 : 1);
  ll g = gcd(abs(p.first), abs(p.second));
  return {znak * abs(p.first) / g, abs(p.second) / g};
}
pair<ll, ll> obr(pair<ll, ll> p) {
  if (p.first == 0) return {p.second, p.first};
  if (p.second == 0) return {p.second, p.first};
  ll znak = (p.first < 0 ? 1 : -1);
  return {znak * abs(p.second), abs(p.first)};
}
ll pw[maxn];
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  pw[0] = 1;
  for (ll i = 1; i < maxn; i++) pw[i] = mul(pw[i - 1], 2);
  ll n;
  cin >> n;
  for (ll i = 0; i < n; i++) {
    ll x, y;
    cin >> x >> y;
    if (x == 0 and y == 0) continue;
    pair<ll, ll> p = {x, y};
    p = norm(p);
    cnt[p]++;
  }
  ll ans = 1;
  for (auto pp : cnt) {
    auto p = pp.first;
    auto p1 = obr(p);
    if (used[p] or used[p1]) continue;
    used[p] = 1, used[p1] = 1;
    ll n = cnt[p], m = cnt[p1];
    ll kek = pw[n] + pw[m] - 1;
    kek %= mod;
    if (kek < 0) kek += mod;
    ans = mul(ans, kek);
  }
  ans--;
  ans %= mod;
  if (ans < 0) ans += mod;
  cout << ans << endl;
  return 0;
}
