#include<bits/stdc++.h>
#define fi first
#define se second
#define rep(i, n) for(int (i) = 0; (i) < (n); (i)++)
#define rrep(i, n) for (int (i) = 1; (i) <= (n); (i++))
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define pb push_back
#define eb emplace_back
#define yn {puts("Yes");}else {puts("No");}
#define printd(x) printf("%.20f\n", x);
template<class T> bool chmin(T& a, const T& b) {if (a > b) {a = b; return 1;} return 0;}
template<class T> bool chmax(T& a, const T& b) {if (a < b) {a = b; return 1;} return 0;}
using namespace std;
using ll = long long;

const int mod = 1000000007;

struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res+=a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res-=a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res*=a;
  }
  mint pow(ll t) const { 
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const {
    return pow(mod-2);
  }
  mint& operator/=(const mint a) {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const {
    mint res(*this);
    return res/=a;
  }
};


pair<ll, ll> rev(pair<ll, ll> a) {
	if (a.fi > 0) return make_pair(-a.se, a.fi);
	return make_pair(a.se, -a.fi);
}


int main() {
	int n;
	cin >> n;
	ll a[n], b[n];
	rep (i, n) cin >> a[i] >> b[i];

	int zero_zero = 0, zero_no = 0, no_zero = 0;
	map<pair<ll, ll>, int> cnt;
	rep (i, n) {
		if (a[i] == 0 && b[i] == 0) zero_zero++;
		else if (a[i] == 0) zero_no++;
		else if (b[i] == 0) no_zero++;
		else {
			ll g = gcd(a[i], b[i]);
			a[i] /= g;
			b[i] /= g;
			if (b[i] < 0) a[i] *= -1, b[i] *= -1;
			cnt[{a[i], b[i]}]++;
		}
	}


	mint ans = mint(2).pow(no_zero) + mint(2).pow(zero_no) - 1;
	set<pair<ll, ll>> used;
	for (auto x: cnt) {
		if (used.count(x.fi)) continue;
		int p = x.se;
		int pp = cnt[rev(x.fi)];
		if (pp) ans *= mint(2).pow(p) + mint(2).pow(pp) - 1;
		else ans *= mint(2).pow(p);
		used.insert(rev(x.fi));
	}

	ans += zero_zero;

	cout << ans.x - 1 << endl;
	return 0;
}