#include <bits/stdc++.h>
 
using namespace std;
 
#define f0r(a, b) for (long long a = 0; a < (b); a++)
#define f1r(a, b, c) for (long long a = (b); a < (c); a++)
#define f0rd(a, b) for (long long a = (b); a >= 0; a--)
#define f1rd(a, b, c) for (long long a = (b); a >= (c); a--)
#define ms(arr, v) memset(arr, v, sizeof(arr))
#define pb push_back
#define mp make_pair
#define f first
#define s second
using ll = long long;
using pll = pair<ll, ll>;
using vl = vector<ll>;
 
void fio() {
  ios_base::sync_with_stdio(0);
  cin.tie(0); 
  cout.tie(0);
}
 
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
 

 
const long double pi = 3.14159265358979323846;
const ll mod = 1000000007;

namespace modop {
	ll madd(ll a, ll b) {
	  return (a + b) % mod;
	}
	ll msub(ll a, ll b) {
	  return (((a - b) % mod) + mod) % mod;
	}
	ll mmul(ll a, ll b) {
	  return ((a % mod) * (b % mod)) % mod;
	}
	ll mpow(ll base, ll exp) {
	  ll res = 1;
	  while (exp) {
		if (exp % 2 == 1){
			res = (res * base) % mod;
		}
		exp >>= 1;
		base = (base * base) % mod;
	  }
	  return res;
	}
	ll minv(ll base) {
	  return mpow(base, mod - 2);
	}
	ll mdiv(ll a, ll b) {
	  return mmul(a, minv(b));
	}
}

using namespace modop;



pll reduce(ll x, ll y) {
  if (x == 0) return mp(0, 1);
  if (y == 0) return mp(1, 0);
  if (x < 0 && y < 0) {
    x = -x; y = -y;
  }
  if (x < 0) {
    x = -x; y = -y;
  }
  ll g = __gcd(abs(x), abs(y));
  return mp(x / g, y / g);
}

pll comp(pll frac) {
  pll r = mp(frac.s, frac.f);
  if (r.f < 0) r.f = -r.f;
  else r.s = -r.s;
  return r;
}

void solve() {
  ll c00 = 0, r = 1;

  ll n; cin >> n;
  pll fracs[n];
  map<pll, ll> cnt;
  f0r(i, n) {
    ll x, y; cin >> x >> y;
    if (x == 0 && y == 0) {
      ++c00;
      continue;
    }
    fracs[i] = reduce(x, y);
    ++cnt[fracs[i]];
  }

  for (auto x: cnt) {
    if (x.s == 0) continue;
    // cout << x.f.f << " " << x.f.s << " " << x.s << endl;
    pll y = comp(x.f);
    ll v = mpow(2, x.s);
    if (cnt.find(y) != cnt.end()) {
      v = (v + mpow(2, cnt[y])) % mod;
      v = (v + mod - 1) % mod;
      cnt[y] = 0;
    }
    cnt[x.f] = 0;

    r = (r * v) % mod;
  }

  cout << msub(r, 1) << '\n';
}
 
int main() {
  fio();
  
  int T = 1;
  // cin >> T;
  while (T--) solve();
} 