#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
 
ll mod = 1000000007;
ll modpow(ll a, ll n){
    ll res = 1;
    while(n > 0){
        if(n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
 
int main(){
	int n;
	cin >> n;
	vector<int> a(n);
	vector<int> b(n);
	map<P, int> m;
	int zz = 0;
	int az = 0;
	int bz = 0;
	rep(i, n){
		int ia, ib;
		cin >> ia >> ib;
		a[i] = ia;
		b[i] = ib;
		if(ia != 0 && ib != 0){
			int gcd = __gcd(ia, ib);
			ia /= gcd;
			ib /= gcd;
			m[{ia, ib}]++;
		}else if(ia == 0 && ib == 0){
			zz++;
		}else if(ia == 0){
			az++;
		}else{
			bz++;
		}
	}
	ll ans = 1;
	rep(i, n){
		int ia, ib;
		ia = a[i];
		ib = b[i];
		ll sum = 0;
		if(ia != 0 && ib != 0){
			int gcd = __gcd(ia, ib);
			ia /= gcd;
			ib /= gcd;
			int g0 = m[{ia, ib}];
			g0 += m[{-ia, -ib}];
			int g1 = m[{ib, -ia}];
			g1 += m[{-ib, ia}];
			m[{ia, ib}] = 0;
			m[{-ia, -ib}] = 0;
			m[{ib, -ia}] = 0;
			m[{-ib, ia}] = 0;
			sum += modpow(2, g0);
			sum += modpow(2, g1);
			sum--;
			if(sum >= mod) sum %= mod;
			ans *= sum;
			if(ans >= mod) ans %= mod;
//			cout << ans << ' ' << g0 << ' ' << g1 << endl;
		}
	}
	int sum0 = 0;
	if(az != 0 && bz != 0){
		sum0 += modpow(2, az);
		sum0 += modpow(2, bz);
		sum0--;
	}else if(az != 0){
		sum0 += modpow(2, az);
	}else if(bz != 0){
		sum0 += modpow(2, bz);
	}
	if(az != 0 || bz != 0){
		if(sum0 >= mod) sum0 %= mod;
		ans *= sum0;
	}
	ans += zz;
	ans--;
	if(ans >= mod) ans %= mod;
	if(ans < 0) ans += mod;
	cout << ans << endl;
	return 0;
}