#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> P;
typedef vector<ll> VI;
typedef vector<VI> VVI;
const ll MOD = 1000000007;
const ll INF = 4611686018427387903;
#define REP(i, n) for (int i = 0; i < n; i++)
#define ALL(v) v.begin(), v.end()

ll power(ll x, ll y) {
	if (y==0) return 1;
	else if (y==1) return x%MOD;
	else if (y%2==0) { ll pow=power(x,y/2); return (pow*pow)%MOD; } 
	else { ll pow=power(x,y/2); return ((pow*pow)%MOD)*x%MOD; }
}

int main(){
	int n; cin >> n;
	VI a(n), b(n);
	REP(i,n) cin >> a[i] >> b[i];
	int z=0;
	map<P,P> mp;
	REP(i,n){
		if(a[i]==0||b[i]==0){
			if(a[i]==0){
				if(b[i]==0)
					z++;
				else
					mp[{0,1}].first++;
			}
			else
				mp[{0,1}].second++;
		}
		else{
			ll g=gcd(abs(a[i]),abs(b[i]));
			if(a[i]*b[i]>0)
				mp[{abs(a[i]/g),abs(b[i]/g)}].first++;
			else
				mp[{abs(b[i]/g),abs(a[i]/g)}].second++;
		}
	}
	ll ans=1;
	for(auto p:mp){
		ans*=power(2,p.second.first)+power(2,p.second.second)+MOD-1;
		ans%=MOD;
	}
	ans+=z; ans+=MOD-1;
	ans%=MOD;
	cout << ans << endl;
	return 0;
}